Skip colorspace filter for unknown source metadata
This commit is contained in:
+9
-1
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user