Skip to content

Commit

Permalink
* Fixing #190 add missing chromaloc parameter for x265 (thanks to Etz)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdgriffith committed Jan 27, 2021
1 parent 4b0f50e commit 625f63a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Adding #178 selector for number of autocrop positions throughout video (thanks to bmcassagne)
* Adding Windows 10 notification for queue complete success
* Fixing #187 cleaning up partial download of FFmpeg (thanks to Todd Wilkinson)
* Fixing #190 add missing chromaloc parameter for x265 (thanks to Etz)

## Version 4.1.2

Expand Down
6 changes: 6 additions & 0 deletions fastflix/encoders/hevc_x265/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@

color_matrix_mapping = {"bt2020_ncl": "bt2020nc", "bt2020_cl": "bt2020c"}

chromaloc_mapping = {"left": 0, "center": 1, "topleft": 2, "top": 3, "bottomleft": 4, "bottom": 5}


def build(fastflix: FastFlix):
settings: x265Settings = fastflix.current_video.video_settings.video_encoder_settings
Expand Down Expand Up @@ -134,6 +136,10 @@ def build(fastflix: FastFlix):

x265_params.append(f"hdr10={'1' if settings.hdr10 else '0'}")

current_chroma_loc = fastflix.current_video.current_video_stream.get("chroma_location")
if current_chroma_loc in chromaloc_mapping:
x265_params.append(f"chromaloc={chromaloc_mapping[current_chroma_loc]}")

if settings.hdr10plus_metadata:
x265_params.append(f"dhdr10-info='{settings.hdr10plus_metadata}'")

Expand Down
8 changes: 5 additions & 3 deletions fastflix/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ class Config(BaseModel):
config_path: Path = fastflix_folder / "fastflix.yaml"
ffmpeg: Path = Field(default_factory=lambda: find_ffmpeg_file("ffmpeg"))
ffprobe: Path = Field(default_factory=lambda: find_ffmpeg_file("ffprobe"))
hdr10plus_parser: Path = Field(default_factory=lambda: Path(shutil.which("hdr10plus_parser") or "") or None)
mkvpropedit: Path = Field(default_factory=lambda: Path(shutil.which("mkvpropedit") or "") or None)
hdr10plus_parser: Optional[Path] = Field(
default_factory=lambda: Path(shutil.which("hdr10plus_parser") or "") or None
)
mkvpropedit: Optional[Path] = Field(default_factory=lambda: Path(shutil.which("mkvpropedit") or "") or None)
flat_ui: bool = True
language: str = "en"
logging_level: int = 10
Expand Down Expand Up @@ -192,7 +194,7 @@ def load(self):
"there may be non-recoverable errors while loading it."
)

paths = ("work_path", "ffmpeg", "ffprobe")
paths = ("work_path", "ffmpeg", "ffprobe", "hdr10plus_parser", "mkvpropedit")
for key, value in data.items():
if key == "profiles":
self.profiles = {}
Expand Down

0 comments on commit 625f63a

Please sign in to comment.