mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-18 23:15:08 +00:00
feat(video): normalize SPS VUI to match manifest-derived range
Some services ship HDR10/HLG bitstreams whose SPS VUI still carries BT.709 colour primaries/transfer/matrix, causing mediainfo and downstream players to mis-classify the file. The manifest-derived `Video.range` is the source of truth; rewrite the VUI with ffmpeg h264_metadata/hevc_metadata BSF after repackage and before mux. Skips SDR, DV, and HYBRID; no-op when the VUI is already correct.
This commit is contained in:
@@ -2310,6 +2310,13 @@ class dl:
|
||||
# we don't want to fill up the log with "Repacked x track"
|
||||
self.log.info("Repacked one or more tracks with FFMPEG")
|
||||
|
||||
with console.status("Normalizing video VUI..."):
|
||||
for track in title.tracks.videos:
|
||||
try:
|
||||
track.normalize_vui()
|
||||
except Exception as e: # noqa: BLE001
|
||||
self.log.warning(f"VUI normalization skipped for {track.id}: {e}")
|
||||
|
||||
muxed_paths = []
|
||||
muxed_audio_codecs: dict[Path, Optional[Audio.Codec]] = {}
|
||||
append_audio_codec_suffix = True
|
||||
|
||||
Reference in New Issue
Block a user