diff --git a/.github/workflows/build_windows_7.yaml b/.github/workflows/build_windows_7.yaml new file mode 100644 index 00000000..8f632aa6 --- /dev/null +++ b/.github/workflows/build_windows_7.yaml @@ -0,0 +1,79 @@ +name: Build executables for Windows 7 (legacy) +on: + push: + branches: [ master, develop, build ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Gather build version + shell: powershell + run: | + mkdir dist + New-Item -Path Env: -Name VERSION -Value $(python.exe scripts\get_version.py) + echo "Building branch $env:GITHUB_REF - version $env:VERSION" + echo "::set-env name=VERSION::$env:VERSION" + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Insatll requirements + shell: cmd + run: | + python -m pip install --upgrade pip setuptools --ignore-installed + python -m pip install --upgrade pypiwin32 wheel + python -m pip install -r requirements-build.txt + + - name: Grab iso-639 lists + shell: powershell + run: | + copy $(python -c "import iso639; print(iso639.mapping.TABLE_PATH)") iso-639-3.tab + copy $(python -c "import iso639; print(iso639.mapping.MAPPING_PATH)") iso-639-3.json + + - name: Build single executable + shell: cmd + run: pyinstaller FastFlix_Windows_OneFile.spec + + - name: Build installer executable + shell: cmd + run: pyinstaller FastFlix_Windows_Installer.spec + + - name: Package installer + shell: cmd + run: | + makensis.exe FastFlix.nsi + move FastFlix_installer.exe FastFlix_${{ env.VERSION }}_installer.exe + + - name: Test executable + run: | + dist\FastFlix.exe --version + dist\FastFlix.exe --test + + - name: Package single executable + shell: cmd + run: | + move dist\*.exe . + move docs\build-licenses.txt LICENSE + + - name: Upload standalone executable artifact + uses: actions/upload-artifact@v2 + with: + name: FastFlix_${{ env.VERSION }}_win64_windows7 + path: | + FastFlix.exe + LICENSE + + - name: Upload installer artifact + uses: actions/upload-artifact@v2 + with: + name: FastFlix_${{ env.VERSION }}_installer_windows7 + path: FastFlix_${{ env.VERSION }}_installer.exe diff --git a/CHANGES b/CHANGES index 626cced2..f7dd1f0d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,15 @@ # Changelog +## Version 4.0.2 + +* Fixing #144 Remove HDR not working (thanks to Chad Johnson) +* Fixing #135 color information wasn't passed through correctly (thanks to leonardyan) +* Fixing #143 by adding legacy windows builds with Python 3.8 for time being (thanks to odignal) +* Fixing queue breaks if there is an error during conversion +* Fixing Remove HDR doesn't stay selected when returning item from queue +* Fixing resolution doesn't stay after returning from queue +* Fixing thumbnail generation preview for videos with arib-std-b67 color transfer + ## Version 4.0.1 * Fixing #141 FastFlix v4.0.0 Windows Installer - Unable to launch (thanks to pcf1) diff --git a/README.md b/README.md index d92fc552..89d41772 100644 --- a/README.md +++ b/README.md @@ -77,11 +77,11 @@ have this support as of 10/23/2020 and may require a [manual upgrade](https://gi ## HLG -Currently, HLG is broken with FastFlix (will use the wrong color transfers) so please don't rely on it for HLG until [#135](https://github.com/cdgriffith/FastFlix/issues/135) is resolved. +FastFlix (v4.0.2+) passes through HLG color transfer information to everything except webp and GIF. ## Dolby Vision -FastFlix does not plan to support Dolby Vision's proprietary format, as it requires royalties. +FastFlix does not plan to support Dolby Vision's proprietary format at this time. # License diff --git a/fastflix/conversion_worker.py b/fastflix/conversion_worker.py index 9284cd57..d1d6a7d0 100644 --- a/fastflix/conversion_worker.py +++ b/fastflix/conversion_worker.py @@ -82,6 +82,7 @@ def start_command(): # Stop working! currently_encoding = False status_queue.put(("error", commands_to_run[0][0], commands_to_run[0][1])) + commands_to_run = [] allow_sleep_mode() if gui_died: return @@ -141,7 +142,7 @@ def start_command(): log_path = Path(request[1]) for command in request[2]: if command not in commands_to_run: - logger.debug(t(f"Adding command to the queue for {command[4]}")) + logger.debug(t(f"Adding command to the queue for {command[4]} - {command[2]}")) commands_to_run.append(command) # else: # logger.debug(t(f"Command already in queue: {command[1]}")) diff --git a/fastflix/encoders/av1_aom/command_builder.py b/fastflix/encoders/av1_aom/command_builder.py index 9eddf68c..c0c98344 100644 --- a/fastflix/encoders/av1_aom/command_builder.py +++ b/fastflix/encoders/av1_aom/command_builder.py @@ -2,7 +2,7 @@ import re import secrets -from fastflix.encoders.common.helpers import Command, generate_all, null +from fastflix.encoders.common.helpers import Command, generate_all, null, generate_color_details from fastflix.models.encode import AOMAV1Settings from fastflix.models.fastflix import FastFlix @@ -17,15 +17,12 @@ def build(fastflix: FastFlix): f"-tile-rows {settings.tile_rows} " f"-tile-columns {settings.tile_columns} " f"-usage {settings.usage} " + f"{generate_color_details(fastflix)} " ) if settings.row_mt.lower() == "enabled": beginning += f"-row-mt 1 " - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - if fastflix.current_video.color_space.startswith("bt2020"): - beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc" - beginning = re.sub("[ ]+", " ", beginning) if settings.bitrate: diff --git a/fastflix/encoders/avc_x264/command_builder.py b/fastflix/encoders/avc_x264/command_builder.py index 489a7af2..d96fa2a5 100644 --- a/fastflix/encoders/avc_x264/command_builder.py +++ b/fastflix/encoders/avc_x264/command_builder.py @@ -2,7 +2,7 @@ import re import secrets -from fastflix.encoders.common.helpers import Command, generate_all, null +from fastflix.encoders.common.helpers import Command, generate_all, null, generate_color_details from fastflix.models.encode import x264Settings from fastflix.models.fastflix import FastFlix @@ -12,16 +12,11 @@ def build(fastflix: FastFlix): beginning, ending = generate_all(fastflix, "libx264") - beginning += f'{f"-tune {settings.tune}" if settings.tune else ""} ' + beginning += f'{f"-tune {settings.tune}" if settings.tune else ""} ' f"{generate_color_details(fastflix)} " if settings.profile and settings.profile != "default": beginning += f"-profile {settings.profile} " - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - - if fastflix.current_video.color_space.startswith("bt2020"): - beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc" - pass_log_file = fastflix.current_video.work_path / f"pass_log_file_{secrets.token_hex(10)}.log" if settings.bitrate: diff --git a/fastflix/encoders/common/helpers.py b/fastflix/encoders/common/helpers.py index 9a429be5..98097e43 100644 --- a/fastflix/encoders/common/helpers.py +++ b/fastflix/encoders/common/helpers.py @@ -202,3 +202,17 @@ def generate_all( ) return beginning, ending + + +def generate_color_details(fastflix: FastFlix): + if fastflix.current_video.video_settings.remove_hdr: + return + + details = [] + if fastflix.current_video.color_primaries: + details.append(f"-color_primaries {fastflix.current_video.color_primaries}") + if fastflix.current_video.color_transfer: + details.append(f"-color_trc {fastflix.current_video.color_transfer}") + if fastflix.current_video.color_space: + details.append(f"-colorspace {fastflix.current_video.color_space}") + return " ".join(details) diff --git a/fastflix/encoders/common/setting_panel.py b/fastflix/encoders/common/setting_panel.py index 2bc6ba21..e2b5142f 100644 --- a/fastflix/encoders/common/setting_panel.py +++ b/fastflix/encoders/common/setting_panel.py @@ -236,16 +236,6 @@ def ffmpeg_extra_update(self): def new_source(self): if not self.app.fastflix.current_video or not self.app.fastflix.current_video.streams: return - # elif ( - # self.app.fastflix.current_video.streams["video"][self.main.video_track] - # .get("color_space", "") - # .startswith("bt2020") - # ): - # self.widgets.remove_hdr.setDisabled(False) - # self.labels.remove_hdr.setStyleSheet("QLabel{color:#000}") - # else: - # self.widgets.remove_hdr.setDisabled(True) - # self.labels.remove_hdr.setStyleSheet("QLabel{color:#000}") def update_profile(self): for widget_name, opt in self.opts.items(): diff --git a/fastflix/encoders/hevc_x265/command_builder.py b/fastflix/encoders/hevc_x265/command_builder.py index c7bcf909..83f8b9dd 100644 --- a/fastflix/encoders/hevc_x265/command_builder.py +++ b/fastflix/encoders/hevc_x265/command_builder.py @@ -6,6 +6,74 @@ from fastflix.models.encode import x265Settings from fastflix.models.fastflix import FastFlix +x265_valid_color_primaries = [ + "bt709", + "unknown", + "reserved", + "bt470m", + "bt470bg", + "smpte170m", + "smpte240m", + "film", + "bt2020", + "smpte428", + "smpte431", + "smpte432", +] + +x265_valid_color_transfers = [ + "bt709", + "unknown", + "reserved", + "bt470m", + "bt470bg", + "smpte170m", + "smpte240m", + "linear", + "log100", + "log316", + "iec61966-2-4", + "bt1361e", + "iec61966-2-1", + "bt2020-10", + "bt2020-12", + "smpte2084", + "smpte428", + "arib-std-b67", +] + +x265_valid_color_matrix = [ + "gbr", + "bt709", + "unknown", + "reserved", + "fcc", + "bt470bg", + "smpte170m", + "smpte240m", + "ycgco", + "bt2020nc", + "bt2020c", + "smpte2085", + "chroma-derived-nc", + "chroma-derived-c", + "ictcp", +] + +color_primaries_mapping = {"smpte428_1": "smpte428"} + +color_transfer_mapping = { + "iec61966_2_4": "iec61966-2-4", + "iec61966_2_1": "iec61966-2-1", + "bt2020_10": "bt2020-10", + "bt2020_10bit": "bt2020-10", + "bt2020_12": "bt2020-12", + "bt2020_12bit": "bt2020-12", + "smpte428_1": "smpte428", +} + +color_matrix_mapping = {"bt2020_ncl": "bt2020nc", "bt2020_cl": "bt2020c"} + def build(fastflix: FastFlix): settings: x265Settings = fastflix.current_video.video_settings.video_encoder_settings @@ -27,28 +95,44 @@ def build(fastflix: FastFlix): x265_params.append(f"b-adapt={settings.b_adapt}") x265_params.append(f"frame-threads={settings.frame_threads}") - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - x265_params.append(f"hdr10_opt={'1' if settings.hdr10_opt else '0'}") - - if fastflix.current_video.color_space.startswith("bt2020"): - x265_params.extend(["colorprim=bt2020", "transfer=smpte2084", "colormatrix=bt2020nc"]) - - if fastflix.current_video.master_display: - settings.hdr10 = True - x265_params.append( - "master-display=" - f"G{fastflix.current_video.master_display.green}" - f"B{fastflix.current_video.master_display.blue}" - f"R{fastflix.current_video.master_display.red}" - f"WP{fastflix.current_video.master_display.white}" - f"L{fastflix.current_video.master_display.luminance}" - ) - - if fastflix.current_video.cll: - settings.hdr10 = True - x265_params.append(f"max-cll={fastflix.current_video.cll}") - - x265_params.append(f"hdr10={'1' if settings.hdr10 else '0'}") + if not fastflix.current_video.video_settings.remove_hdr: + if fastflix.current_video.color_primaries: + if fastflix.current_video.color_primaries in x265_valid_color_primaries: + x265_params.append(f"colorprim={fastflix.current_video.color_primaries}") + elif fastflix.current_video.color_primaries in color_primaries_mapping: + x265_params.append(f"colorprim={color_primaries_mapping[fastflix.current_video.color_primaries]}") + + if fastflix.current_video.color_transfer: + if fastflix.current_video.color_transfer in x265_valid_color_transfers: + x265_params.append(f"transfer={fastflix.current_video.color_transfer}") + elif fastflix.current_video.color_transfer in color_transfer_mapping: + x265_params.append(f"transfer={color_transfer_mapping[fastflix.current_video.color_transfer]}") + + if fastflix.current_video.color_space: + if fastflix.current_video.color_space in x265_valid_color_matrix: + x265_params.append(f"colormatrix={fastflix.current_video.color_space}") + elif fastflix.current_video.color_space in color_matrix_mapping: + x265_params.append(f"colormatrix={color_matrix_mapping[fastflix.current_video.color_space]}") + + if settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): + x265_params.append(f"hdr10_opt={'1' if settings.hdr10_opt else '0'}") + + if fastflix.current_video.master_display: + settings.hdr10 = True + x265_params.append( + "master-display=" + f"G{fastflix.current_video.master_display.green}" + f"B{fastflix.current_video.master_display.blue}" + f"R{fastflix.current_video.master_display.red}" + f"WP{fastflix.current_video.master_display.white}" + f"L{fastflix.current_video.master_display.luminance}" + ) + + if fastflix.current_video.cll: + settings.hdr10 = True + x265_params.append(f"max-cll={fastflix.current_video.cll}") + + x265_params.append(f"hdr10={'1' if settings.hdr10 else '0'}") if settings.hdr10plus_metadata: x265_params.append(f"dhdr10-info='{settings.hdr10plus_metadata}'") diff --git a/fastflix/encoders/hevc_x265/settings_panel.py b/fastflix/encoders/hevc_x265/settings_panel.py index 0fbfa1b8..25126be9 100644 --- a/fastflix/encoders/hevc_x265/settings_panel.py +++ b/fastflix/encoders/hevc_x265/settings_panel.py @@ -479,7 +479,7 @@ def hdr_opts(): return bit_depth = self.app.fastflix.current_video.streams["video"][self.main.video_track].bit_depth - if self.main.remove_hdr == 1: + if self.main.remove_hdr: self.widgets.pix_fmt.clear() self.widgets.pix_fmt.addItems([pix_fmts[0]]) self.widgets.pix_fmt.setCurrentIndex(0) diff --git a/fastflix/encoders/rav1e/command_builder.py b/fastflix/encoders/rav1e/command_builder.py index 58aa6fc5..a94d65e6 100644 --- a/fastflix/encoders/rav1e/command_builder.py +++ b/fastflix/encoders/rav1e/command_builder.py @@ -5,7 +5,7 @@ import re import secrets -from fastflix.encoders.common.helpers import Command, generate_all, null +from fastflix.encoders.common.helpers import Command, generate_all, null, generate_color_details from fastflix.models.encode import rav1eSettings from fastflix.models.fastflix import FastFlix @@ -22,29 +22,28 @@ def build(fastflix: FastFlix): f"-tile-columns {settings.tile_columns} " f"-tile-rows {settings.tile_rows} " f"-tiles {settings.tiles} " + f"{generate_color_details(fastflix)} " ) - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - if fastflix.current_video.color_space.startswith("bt2020"): - beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc" + # if not fastflix.current_video.video_settings.remove_hdr: - # Currently unsupported https://github.com/xiph/rav1e/issues/2554 - # rav1e_options = [] - # if side_data.master_display: - # rav1e_options.append( - # "mastering-display=" - # f"G{side_data.master_display.green}" - # f"B{side_data.master_display.blue}" - # f"R{side_data.master_display.red}" - # f"WP{side_data.master_display.white}" - # f"L{side_data.master_display.luminance}" - # ) - # - # if side_data.cll: - # rav1e_options.append(f"content-light={side_data.cll}") - # if rav1e_options: - # opts = ":".join(rav1e_options) - # beginning += f'-rav1e-params "{opts}"' + # Currently unsupported https://github.com/xiph/rav1e/issues/2554 + # rav1e_options = [] + # if side_data.master_display: + # rav1e_options.append( + # "mastering-display=" + # f"G{side_data.master_display.green}" + # f"B{side_data.master_display.blue}" + # f"R{side_data.master_display.red}" + # f"WP{side_data.master_display.white}" + # f"L{side_data.master_display.luminance}" + # ) + # + # if side_data.cll: + # rav1e_options.append(f"content-light={side_data.cll}") + # if rav1e_options: + # opts = ":".join(rav1e_options) + # beginning += f'-rav1e-params "{opts}"' beginning = re.sub("[ ]+", " ", beginning) diff --git a/fastflix/encoders/svt_av1/command_builder.py b/fastflix/encoders/svt_av1/command_builder.py index 7fba3d74..8450d424 100644 --- a/fastflix/encoders/svt_av1/command_builder.py +++ b/fastflix/encoders/svt_av1/command_builder.py @@ -7,7 +7,7 @@ import reusables -from fastflix.encoders.common.helpers import Command, generate_all, null +from fastflix.encoders.common.helpers import Command, generate_all, null, generate_color_details from fastflix.models.encode import SVTAV1Settings from fastflix.models.fastflix import FastFlix @@ -25,13 +25,9 @@ def build(fastflix: FastFlix): f"-tile_columns {settings.tile_columns} " f"-tile_rows {settings.tile_rows} " f"-tier {settings.tier} " + f"{generate_color_details(fastflix)} " ) - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - - if fastflix.current_video.color_space.startswith("bt2020"): - beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc" - beginning = re.sub("[ ]+", " ", beginning) if not settings.single_pass: diff --git a/fastflix/encoders/vp9/command_builder.py b/fastflix/encoders/vp9/command_builder.py index 22b0bc88..a551c4c6 100644 --- a/fastflix/encoders/vp9/command_builder.py +++ b/fastflix/encoders/vp9/command_builder.py @@ -2,7 +2,7 @@ import re import secrets -from fastflix.encoders.common.helpers import Command, generate_all, null +from fastflix.encoders.common.helpers import Command, generate_all, null, generate_color_details from fastflix.models.encode import VP9Settings from fastflix.models.fastflix import FastFlix @@ -11,15 +11,16 @@ def build(fastflix: FastFlix): settings: VP9Settings = fastflix.current_video.video_settings.video_encoder_settings beginning, ending = generate_all(fastflix, "libvpx-vp9") - beginning += f'{"-row-mt 1" if settings.row_mt else ""} ' + beginning += f'{"-row-mt 1" if settings.row_mt else ""} ' f"{generate_color_details(fastflix)} " if not settings.single_pass: pass_log_file = fastflix.current_video.work_path / f"pass_log_file_{secrets.token_hex(10)}.log" beginning += f'-passlogfile "{pass_log_file}" ' - if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): - if fastflix.current_video.color_space.startswith("bt2020"): - beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -color_range 1" + # TODO color_range 1 + # if not fastflix.current_video.video_settings.remove_hdr and settings.pix_fmt in ("yuv420p10le", "yuv420p12le"): + # if fastflix.current_video.color_space.startswith("bt2020"): + # beginning += "-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -color_range 1" beginning = re.sub("[ ]+", " ", beginning) diff --git a/fastflix/flix.py b/fastflix/flix.py index f29bcc7e..0a4603c0 100644 --- a/fastflix/flix.py +++ b/fastflix/flix.py @@ -22,6 +22,10 @@ logger = logging.getLogger("fastflix") +def x265_color_matrix(color_space): + pass + + def guess_bit_depth(pix_fmt: str, color_primaries: str = None) -> int: eight = ( "bgr0", @@ -109,6 +113,8 @@ def probe(app: FastFlixApp, file: Path) -> Box: f"{app.fastflix.config.ffprobe}", "-v", "quiet", + "-loglevel", + "panic", "-print_format", "json", "-show_format", @@ -373,18 +379,15 @@ def parse_hdr_details(app: FastFlixApp, **_): logger.exception(f"Unexpected error while processing master-display from {streams.video[0]}") else: if master_display: - app.fastflix.current_video.pix_fmt = streams.video[video_track].get("pix_fmt", "") - app.fastflix.current_video.color_space = streams.video[video_track].get("color_space", "") - app.fastflix.current_video.color_primaries = streams.video[video_track].get( - "color_primaries", "" - ) - app.fastflix.current_video.color_transfer = streams.video[video_track].get("color_transfer", "") app.fastflix.current_video.master_display = master_display app.fastflix.current_video.cll = cll return + result = execute( [ f"{app.fastflix.config.ffprobe}", + "-loglevel", + "panic", "-select_streams", f"v:{video_track}", "-print_format", @@ -421,9 +424,5 @@ def parse_hdr_details(app: FastFlixApp, **_): except Exception: logger.exception(f"Unexpected error while processing master-display from {streams.video[0]}") else: - app.fastflix.current_video.pix_fmt = data.pix_fmt - app.fastflix.current_video.color_space = data.color_space - app.fastflix.current_video.color_primaries = data.color_primaries - app.fastflix.current_video.color_transfer = data.color_transfer app.fastflix.current_video.master_display = master_display app.fastflix.current_video.cll = cll diff --git a/fastflix/models/video.py b/fastflix/models/video.py index 90f2b239..be85344e 100644 --- a/fastflix/models/video.py +++ b/fastflix/models/video.py @@ -79,15 +79,9 @@ class Video(BaseDataClass): streams: Box = None work_path: Path = None - pix_fmt: str = "" format: Box = None interlaced: bool = True - # Color Range Details - color_space: str = "" - color_primaries: str = "" - color_transfer: str = "" - # HDR10 Details master_display: Box = None cll: str = "" @@ -95,3 +89,38 @@ class Video(BaseDataClass): video_settings: VideoSettings = field(default_factory=VideoSettings) status: Status = field(default_factory=Status) uuid: str = field(default_factory=lambda: str(uuid.uuid4())) + + @property + def current_video_stream(self): + try: + return [x for x in self.streams.video if x.index == self.video_settings.selected_track][0] + except IndexError: + return None + + @property + def color_space(self): + stream = self.current_video_stream + if not stream: + return "" + return stream.get("color_space", "") + + @property + def color_primaries(self): + stream = self.current_video_stream + if not stream: + return "" + return stream.get("color_primaries", "") + + @property + def color_transfer(self): + stream = self.current_video_stream + if not stream: + return "" + return stream.get("color_transfer", "") + + @property + def pix_fmt(self): + stream = self.current_video_stream + if not stream: + return "" + return stream.get("pix_fmt", "") diff --git a/fastflix/resources.py b/fastflix/resources.py index b49bc242..3c1a7dfa 100644 --- a/fastflix/resources.py +++ b/fastflix/resources.py @@ -34,3 +34,4 @@ text_left_icon = str(Path(pkg_resources.resource_filename(__name__, "data/icons/text-align-left.png")).resolve()) poll_icon = str(Path(pkg_resources.resource_filename(__name__, "data/icons/poll.png")).resolve()) working_icon = str(Path(pkg_resources.resource_filename(__name__, "data/icons/pending-work.png")).resolve()) +advanced_icon = str(Path(pkg_resources.resource_filename(__name__, "data/icons/advanced.png")).resolve()) diff --git a/fastflix/version.py b/fastflix/version.py index ace34cf8..c0263c33 100644 --- a/fastflix/version.py +++ b/fastflix/version.py @@ -1,4 +1,4 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -__version__ = "4.0.1" +__version__ = "4.0.2" __author__ = "Chris Griffith" diff --git a/fastflix/widgets/main.py b/fastflix/widgets/main.py index 0537ebd1..7a881582 100644 --- a/fastflix/widgets/main.py +++ b/fastflix/widgets/main.py @@ -1057,8 +1057,6 @@ def reload_video_from_queue(self, video: Video): self.widgets.crop.bottom.setText(bottom) self.widgets.start_time.setText(self.number_to_time(video.video_settings.start_time)) self.widgets.end_time.setText(self.number_to_time(end_time)) - self.widgets.scale.width.setText(str(self.app.fastflix.current_video.width)) - self.widgets.scale.height.setText(str(self.app.fastflix.current_video.height)) self.widgets.video_title.setText(self.app.fastflix.current_video.video_settings.video_title) self.output_video_path_widget.setText(str(video.video_settings.output_path)) self.widgets.deinterlace.setChecked(self.app.fastflix.current_video.video_settings.deinterlace) @@ -1075,6 +1073,20 @@ def reload_video_from_queue(self, video: Video): if video.video_settings.vertical_flip and video.video_settings.horizontal_flip: self.widgets.flip.setCurrentIndex(3) + if self.app.fastflix.current_video.video_settings.scale: + w, h = self.app.fastflix.current_video.video_settings.scale.split(":") + + self.widgets.scale.width.setText(w) + if h.startswith("-"): + self.widgets.scale.height.setText("Auto") + self.widgets.scale.keep_aspect.setChecked(True) + else: + self.widgets.scale.height.setText(h) + else: + self.widgets.scale.width.setText(str(self.app.fastflix.current_video.width)) + self.widgets.scale.height.setText("Auto") + self.widgets.scale.keep_aspect.setChecked(True) + self.video_options.reload() self.enable_all() @@ -1101,6 +1113,18 @@ def update_video_info(self): self.clear_current_video() return + # if self.app.fastflix.current_video.color_space and self.app.fastflix.current_video.color_space not in ffmpeg_valid_color_space: + # logger.warning(f'Unknown color space "{self.app.fastflix.current_video.color_space}", removing') + # self.app.fastflix.current_video.color_space = "" + # + # if self.app.fastflix.current_video.color_transfer and self.app.fastflix.current_video.color_transfer not in ffmpeg_valid_color_transfers: + # logger.warning(f'Unknown color transfer "{self.app.fastflix.current_video.color_transfer}", removing') + # self.app.fastflix.current_video.color_transfer = "" + # + # if self.app.fastflix.current_video.color_primaries and self.app.fastflix.current_video.color_primaries not in ffmpeg_valid_color_primaries: + # logger.warning(f'Unknown color primaries "{self.app.fastflix.current_video.color_primaries}", removing') + # self.app.fastflix.current_video.ffmpeg_valid_color_primaries = "" + text_video_tracks = [ f'{x.index}: {t("codec")} {x.codec_name} - {x.get("pix_fmt")} - {t("profile")} {x.get("profile")}' for x in self.app.fastflix.current_video.streams.video @@ -1212,7 +1236,11 @@ def generate_thumbnail(self): ): settings["remove_hdr"] = True - filters = helpers.generate_filters(custom_filters="scale='min(320\\,iw):-8'", **settings) + custom_filters = "scale='min(320\\,iw):-8'" + if self.app.fastflix.current_video.color_transfer == "arib-std-b67": + custom_filters += ",select=eq(pict_type\\,I)" + + filters = helpers.generate_filters(custom_filters=custom_filters, **settings) preview_place = ( self.app.fastflix.current_video.duration // 10 @@ -1295,6 +1323,7 @@ def get_all_settings(self): remove_metadata=self.remove_metadata, copy_chapters=self.copy_chapters, video_title=self.title, + remove_hdr=self.remove_hdr, ) self.video_options.get_settings() @@ -1654,7 +1683,7 @@ def run(self): if status[0] == "complete": self.main.completed.emit(0) elif status[0] == "error": - self.main.status_update_signal.emit("exit::") + self.main.status_update_signal.emit(":".join(status)) self.main.completed.emit(1) elif status[0] == "cancelled": self.main.cancelled.emit(":".join(status[1:])) diff --git a/fastflix/widgets/video_options.py b/fastflix/widgets/video_options.py index 9171e0dc..6f29c59a 100644 --- a/fastflix/widgets/video_options.py +++ b/fastflix/widgets/video_options.py @@ -14,7 +14,18 @@ from fastflix.widgets.panels.status_panel import StatusPanel from fastflix.widgets.panels.subtitle_panel import SubtitleList -from fastflix.resources import editing_icon, cc_icon, music_icon, photo_icon, poll_icon, text_left_icon, working_icon +# from fastflix.widgets.panels.advanced_panel import AdvancedPanel + +from fastflix.resources import ( + editing_icon, + cc_icon, + music_icon, + photo_icon, + poll_icon, + text_left_icon, + working_icon, + advanced_icon, +) logger = logging.getLogger("fastflix") @@ -34,11 +45,13 @@ def __init__(self, parent, app: FastFlixApp, available_audio_encoders): self.status = StatusPanel(self, self.app) self.attachments = CoverPanel(self, self.app) self.queue = EncodingQueue(self, self.app) + # self.advanced = AdvancedPanel(self, self.app) self.addTab(self.current_settings, QtGui.QIcon(editing_icon), t("Quality")) self.addTab(self.audio, QtGui.QIcon(music_icon), t("Audio")) self.addTab(self.subtitles, QtGui.QIcon(cc_icon), t("Subtitles")) self.addTab(self.attachments, QtGui.QIcon(photo_icon), t("Cover")) + # self.addTab(self.advanced, QtGui.QIcon(advanced_icon), t("Advanced")) self.addTab(self.commands, QtGui.QIcon(text_left_icon), t("Raw Commands")) self.addTab(self.status, QtGui.QIcon(working_icon), t("Encoding Status")) self.addTab(self.queue, QtGui.QIcon(poll_icon), t("Encoding Queue"))