Repository navigation
feat(dash): download SegmentBase streams and skip non-MP4 representations - #619
Conversation
…ions On-demand DASH (isoff-on-demand, as Shaka Packager writes it) stores each representation as one file with a segment index, which Ketch refused with "DASH requires SegmentList or SegmentTemplate". Such a track is now fetched whole, with one request, when it is the only one; merged with separate audio, its initialization and each fragment its sidx lists are fetched, timed so the tracks interleave as SegmentTemplate ones do. Manifests offering WebM beside MP4 (Shaka's angel-one) were refused as a whole with "Only MP4 DASH representations are supported"; representations in other containers are now left out, and only a manifest with no MP4 at all is refused.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e53c286caf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A Representation's SegmentBase may set only its indexRange while its AdaptationSet's carries the Initialization, timescale and presentation time offset. Their attributes now fold from the period down, each level overriding what it sets, as SegmentTemplate's do.
Found while downloading public DASH streams with the CLI: Shaka's demo stream (
https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd) failed to list or download. It hit two limits in turn:Only MP4 DASH representations are supported: the manifest offers WebM (VP9, Opus) adaptation sets beside MP4 (H.264, AAC) ones, and one WebM representation made Ketch refuse the whole stream.DASH requires SegmentList or SegmentTemplate: on-demand profiles (isoff-on-demand, as Shaka Packager and many VOD services write them) store each representation as one fragmented MP4 file. The manifest gives aBaseURLandSegmentBase(initialization range and asidxsegment index) instead of listing segments.What changes
video/mp4,audio/mp4,application/mp4) are considered. A manifest is refused only when it has no MP4 at all.SegmentBase/ single-file representations (DashTrack.SingleFile):MediaDownloadHelper.fetchRange, at most 1 MiB, with the stream's origin-scoped headers) and parses thesidx(parseSegmentIndex, versions 0 and 1). The plan is the initialization range plus each fragment's byte range, with start times (minuspresentationTimeOffset), so audio and video interleave exactly asSegmentTemplatetracks do. A file without an index follows whole after its initialization; one without an initialization range can't be merged and is refused with a reason.sidx) are refused with a reason.resolveplans without them, since it only needs the container and the track count.docs/media.mdand AGENTS.md describe the new support.Verification
ketch --list-fileson angel-one lists its 5 H.264 variants (before: the error above). Downloading 144p and the default 576p gives H.264 + AAC MP4s of 60.02 s,ffmpeg -f nulldecodes them with no errors, andffprobeshows video and audio packets interleaved.SegmentBaseAAC track: the output is byte-identical to the source file, from one request.-single_file 1,SegmentListwith byte ranges) still works, merged and video-only.SegmentIndexTest(versions 0/1, boxes before thesidx, nested and truncated indexes) andDashManifestTestcases forSegmentBasealone (one whole-file part, no index fetched), merged with audio (indexes needed, fragments interleaved by time, whole-file fallback without indexes), missing base URL or ranges, and WebM beside MP4../gradlew :library:dash:jvmTest :library:core:jvmTest --tests '*Media*' --tests '*Mp4*'passes.