Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support byte range for dash mpd #30279

Closed
wants to merge 3 commits into from
Closed

support byte range for dash mpd #30279

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 27, 2021

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Add range and mediaRange attributes support of these types to dash mpd parser:

Also modified the existing code a bit at # Segment URLs with no SegmentTimeline in extractor/common.py for clarity, IMO.

Regarding the ftyp box

There seem to be some mpds that do not include ftyp box in the initialization segment because the range doesn't start from 0. As a result, the downloaded files do not have the box either. Such mpds are, for example, https://kinescope.io/200615537/master.mpd in #30235 and url_and_range.mpd made with Bento4 I added for test to this PR.
url_and_range.mpd has <Initialization sourceURL="video-frag.mp4" range="36-746"/>. If the source video file starts like

000000  0000 0024 6674 7970 6973 6f6d 0000 0200    ...$ftypisom....
000010  6973 6f6d 6973 6f32 6176 6331 6d70 3431    isomiso2avc1mp41
000020  6973 6f35 0000 02c7 6d6f 6f76 0000 006c    iso5....moov...l
000030  6d76 6864 0000 0000 ddc7 5e78 ddc7 5e78    mvhd......^x..^x

then the downloaded file will start like

000000  0000 02c7 6d6f 6f76 0000 006c 6d76 6864    ....moov...lmvhd
000010  0000 0000 ddc7 5e78 ddc7 5e78 0000 03e8    ......^x..^x....

This usually won't be a problem nor emerge because youtube-dl runs ffmpeg to merge video and audio, and the file will be adjusted. And for m4a_dash audio-only stream, fixup will be done.

While the video-only file seems to play fine with, say, VLC and QuickTime Player, I'm thinking of making another PR to run ffmpeg for fixup.

@ghost ghost marked this pull request as draft November 27, 2021 07:06
@ghost ghost changed the title support byte range for dash mpd (unfinished) support byte range for dash mpd Nov 29, 2021
@ghost ghost marked this pull request as ready for review November 29, 2021 06:53
@ghost ghost closed this Jan 20, 2022
@ghost ghost deleted the support-range-for-dash branch January 20, 2022 08:55
dirkf added a commit to dirkf/youtube-dl that referenced this pull request Jan 27, 2024
dirkf added a commit to dirkf/youtube-dl that referenced this pull request Jan 27, 2024
* adapted from ytdl-org#30279
* thx former GH user kikuyan
dirkf added a commit that referenced this pull request Feb 2, 2024
dirkf added a commit that referenced this pull request Feb 2, 2024
* adapted from #30279
* thx former GH user kikuyan
github-actions bot added a commit to hellopony/youtube-dl that referenced this pull request Feb 2, 2024
* https://github.com/ytdl-org/youtube-dl:
  [Vbox7IE] Sanitise ld+json containing unexpected characters * based on PR ytdl-org#29680 * added hack to force invoking `transform_source` * fixes ytdl-org#26218
  [Vbox7IE] Improve extraction * DASH extraction no longer fails with new range support * but always find combined formats if available * suppress ineffective XFF geo-bypass (causes time-outs) * adapted from ytdl-org#29680 * thx former GH user kikuyan
  [InfoExtractor] Correctly resolve BaseURL in DASH manifest Specs: * ISO/IEC 23009-1:2012 section 5.6 * RFC 3986 section 5.
  [InfoExtractor] Support byte range for DASH * adapted from ytdl-org#30279 * thx former GH user kikuyan
  [downloader/dash] Support `range` in fragment (format f'{start}-{end}')  * adapted from ytdl-org#30279  * thx former GH user kikuyan
  [InfoExtractor] Support DASH subtitle extraction (yt-dlp back-port)
dirkf added a commit to ytdl-org/ytdl-nightly that referenced this pull request Feb 3, 2024
dirkf added a commit to ytdl-org/ytdl-nightly that referenced this pull request Feb 3, 2024
* adapted from ytdl-org/youtube-dl#30279
* thx former GH user kikuyan
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Video from MPEG-DASH stream much larger than same video from HLS stream
1 participant