diff --git a/unshackle/commands/dl.py b/unshackle/commands/dl.py index ca6fc66..27d571f 100644 --- a/unshackle/commands/dl.py +++ b/unshackle/commands/dl.py @@ -2484,6 +2484,25 @@ class dl: task_tracks = clone_tracks_for_audio(base_tracks, codec_audio_tracks) multiplex_tasks.append((task_id, task_tracks, audio_codec)) + def mux_video_standalone(video_track: Optional[Video]) -> None: + if video_track and video_track.dv_compatible_bitstream: + apply_dv_fixup(video_track) + + task_description = "Multiplexing" + if video_track: + if len(quality) > 1: + task_description += f" {video_track.height}p" + if len(range_) > 1: + task_description += f" {video_track.range.name}" + if len(vcodec) > 1: + task_description += f" {video_track.codec.name}" + + task_tracks = Tracks(title.tracks) + title.tracks.chapters + title.tracks.attachments + if video_track: + task_tracks.videos = [video_track] + + enqueue_mux_tasks(task_description, task_tracks) + if any(r == Video.Range.HYBRID for r in range_) and title.tracks.videos: self.log.info("Processing Hybrid HDR10+DV tracks...") @@ -2541,45 +2560,15 @@ class dl: # Mux every requested range standalone, skipping the ingredient-only DV. for video_track in original_videos: - if getattr(video_track, "hybrid_base_only", False): + if video_track.hybrid_base_only: continue - if getattr(video_track, "dv_compatible_bitstream", False): - apply_dv_fixup(video_track) - - task_description = "Multiplexing" - if len(quality) > 1: - task_description += f" {video_track.height}p" - if len(range_) > 1: - task_description += f" {video_track.range.name}" - if len(vcodec) > 1: - task_description += f" {video_track.codec.name}" - - task_tracks = Tracks(title.tracks) + title.tracks.chapters + title.tracks.attachments - task_tracks.videos = [video_track] - - enqueue_mux_tasks(task_description, task_tracks) + mux_video_standalone(video_track) console.print() else: # Normal mode: process each video track separately for video_track in title.tracks.videos or [None]: - if video_track and getattr(video_track, "dv_compatible_bitstream", False): - apply_dv_fixup(video_track) - - task_description = "Multiplexing" - if video_track: - if len(quality) > 1: - task_description += f" {video_track.height}p" - if len(range_) > 1: - task_description += f" {video_track.range.name}" - if len(vcodec) > 1: - task_description += f" {video_track.codec.name}" - - task_tracks = Tracks(title.tracks) + title.tracks.chapters + title.tracks.attachments - if video_track: - task_tracks.videos = [video_track] - - enqueue_mux_tasks(task_description, task_tracks) + mux_video_standalone(video_track) try: with Live(Padding(progress, (0, 5, 1, 5)), console=console): diff --git a/unshackle/core/tracks/video.py b/unshackle/core/tracks/video.py index e8678cc..71ed529 100644 --- a/unshackle/core/tracks/video.py +++ b/unshackle/core/tracks/video.py @@ -296,6 +296,7 @@ class Video(Track): self.closed_captions: list[dict[str, Any]] = closed_captions or [] self.needs_duration_fix = False self.dv_compatible_bitstream = dv_compatible_bitstream + self.hybrid_base_only = False def to_dict(self) -> dict[str, Any]: data = super().to_dict()