From 184f56091b6fb4756b7f7d9b74ff0b00fd79d2a3 Mon Sep 17 00:00:00 2001 From: Melbar Date: Thu, 7 May 2026 18:17:43 +0200 Subject: [PATCH] Skip colorspace filter for unknown source metadata --- pvd_mezzanine.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pvd_mezzanine.py b/pvd_mezzanine.py index cfd68c2..610ba9d 100644 --- a/pvd_mezzanine.py +++ b/pvd_mezzanine.py @@ -86,6 +86,7 @@ class VideoProfile: target_space: str target_name: str needs_conversion: bool + can_convert_colorspace: bool @dataclass @@ -214,6 +215,10 @@ def analyze_video(v_stream: dict) -> VideoProfile: or source_trc != target_trc or source_space != target_space ) + can_convert_colorspace = all( + value not in ("unknown", None, "") + for value in (source_prim, source_trc, source_space) + ) return VideoProfile( width=width, @@ -228,6 +233,7 @@ def analyze_video(v_stream: dict) -> VideoProfile: target_space=target_space, target_name=target_name, needs_conversion=needs_conversion, + can_convert_colorspace=can_convert_colorspace, ) @@ -339,7 +345,7 @@ def build_video_filters(plan: JobPlan) -> list[str]: profile = plan.video_profile if profile.is_interlaced: filters.append("bwdif=mode=0:parity=auto") - if profile.needs_conversion: + if profile.needs_conversion and profile.can_convert_colorspace: filters.append( "colorspace=" f"primaries={profile.target_prim}:" @@ -497,6 +503,8 @@ def log_plan(plan: JobPlan, log: Callable[[str], None] = print) -> None: profile = plan.video_profile log(f"Quelle: {plan.input_file}") log(f"Video: {profile.width}x{profile.height} @ {profile.fps:.3f} fps, {profile.target_name}") + if profile.needs_conversion and not profile.can_convert_colorspace: + log("Farbraum: Quell-Metadaten unvollstaendig; setze Ziel-Metadaten ohne Colorspace-Filter.") log(f"MP4: {plan.pvd_mp4}") if plan.german_mov: log(f"Deutsche Audio-MOV: {plan.german_mov}")