mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 04:15:09 +00:00
fix(dl): mux all requested ranges and select highest DV alongside hybrid
When -r included HYBRID, the dl pipeline only muxed the hybrid output and dropped every other downloaded range. DV was also treated purely as a hybrid ingredient pool, so an explicitly requested DV range never produced a standalone deliverable - only the lowest DV (the RPU ingredient) was selected. - Select the best DV per resolution as a standalone deliverable when DV is in -r, while still using the lowest DV as the hybrid ingredient (dv_is_deliverable). - Flag the ingredient-only DV (hybrid_base_only) so it is downloaded for the hybrid build but skipped during standalone muxing. - Mux every requested range standalone after hybrid processing; build hybrids from deepcopied ingredients so the originals stay muxable. - Add Tracks.merge_video_selections to de-dup the ingredient/deliverable overlap so a shared DV track is not downloaded or muxed twice.
This commit is contained in:
@@ -325,6 +325,20 @@ class Tracks:
|
||||
new_tracks.attachments = list(self.attachments)
|
||||
return new_tracks
|
||||
|
||||
@staticmethod
|
||||
def merge_video_selections(*groups: list[Video]) -> list[Video]:
|
||||
"""Concatenate video selections, dropping duplicates (by track id, order-preserving).
|
||||
|
||||
A DV track can be chosen as both the hybrid ingredient (lowest) and an explicit
|
||||
deliverable; without dedup the same track would be muxed/downloaded twice.
|
||||
"""
|
||||
merged: list[Video] = []
|
||||
for group in groups:
|
||||
for video in group:
|
||||
if video not in merged:
|
||||
merged.append(video)
|
||||
return merged
|
||||
|
||||
def select_hybrid(self, tracks, quality, worst: bool = False):
|
||||
# Prefer HDR10+ over HDR10 as the base layer (preserves dynamic metadata)
|
||||
base_ranges = (Video.Range.HDR10P, Video.Range.HDR10)
|
||||
|
||||
Reference in New Issue
Block a user