Skip to content

Commit

Permalink
Version 4.0.2 (#145)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cdgriffith authored Dec 30, 2020
1 parent 928e7d2 commit 0f22dc7
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 102 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build_windows_7.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion fastflix/conversion_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]}"))
Expand Down
7 changes: 2 additions & 5 deletions fastflix/encoders/av1_aom/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down
9 changes: 2 additions & 7 deletions fastflix/encoders/avc_x264/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions fastflix/encoders/common/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 0 additions & 10 deletions fastflix/encoders/common/setting_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
128 changes: 106 additions & 22 deletions fastflix/encoders/hevc_x265/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}'")
Expand Down
2 changes: 1 addition & 1 deletion fastflix/encoders/hevc_x265/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 0f22dc7

Please sign in to comment.