You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a description that is worded well enough to be understood
If an MPEG-DASH file has a period with multiple "functionally identical"[1] tracks where each of those tracks consists of multiple fragments, then yt-dlp will concatenate these identical tracks into a single track.
For example, see Puyodead1/udemy-downloader#215. I have an .mpd file with a single period. It contains 6 identical audio tracks consisting of many fragments. It contains 6 differing resolution video tracks consisting of many fragments.
ffmpeg -i input.mpd shows 6 audio tracks and 6 video tracks. I'm able to download a specific audio track using ffmpeg -i index.mpd -map 0:p:0:6 -c output.m4a. The file is 1.05M.
Running yt-dlp --allow-unplayable-formats --enable-file-urls -F file://$(pwd)/index.mpd shows 6 video tracks and 1 audio track. There being only 1 audio track seems reasonable, but when I download the track with yt-dlp --allow-unplayable-formats --enable-file-urls -f 7 file://$(pwd)/index.mpd, it downloads a 6.78 MB file. It's concatenating the fragments from all 6 audio tracks. It would expect it to only download a single copy, not all 6 copies.
This was introduced in 4ce57d3. Using a commit before that, yt-dlp shows 6 video tracks and 6 audio tracks. After that commit, if two formats have the same format_key, then yt-dlp concatenates the fragments from those formats. This makes sense for formats from separate periods, but doesn't make sense for formats from the same period.
A possible fix is preprocessing each period so that it only loops over formats mod format_key in that period. This preserves the current functionality while making sure that duplicate formats from the same period are not redownloaded.
formats, subtitles = {}, {}
for period in periods:
+ unique_formats: dict = {}
for f in period['formats']:
+ format_key = tuple(v for k, v in f.items() if k not in+ ('format_id', 'fragments', 'manifest_stream_number'))+ if format_key not in unique_formats:+ unique_formats[format_key] = f+ for format_key, f in unique_formats.items():
assert 'is_dash_periods' not in f, 'format already processed'
f['is_dash_periods'] = True
- format_key = tuple(v for k, v in f.items() if k not in (- ('format_id', 'fragments', 'manifest_stream_number')))
if format_key not in formats:
formats[format_key] = f
elif 'fragments' in f:
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
Checklist
Provide a description that is worded well enough to be understood
If an MPEG-DASH file has a period with multiple "functionally identical"[1] tracks where each of those tracks consists of multiple fragments, then
yt-dlp
will concatenate these identical tracks into a single track.For example, see Puyodead1/udemy-downloader#215. I have an
.mpd
file with a single period. It contains 6 identical audio tracks consisting of many fragments. It contains 6 differing resolution video tracks consisting of many fragments.ffmpeg -i input.mpd
shows 6 audio tracks and 6 video tracks. I'm able to download a specific audio track usingffmpeg -i index.mpd -map 0:p:0:6 -c output.m4a
. The file is 1.05M.yt-dlp --allow-unplayable-formats --enable-file-urls -F file://$(pwd)/index.mpd
shows 6 video tracks and 1 audio track. There being only 1 audio track seems reasonable, but when I download the track withyt-dlp --allow-unplayable-formats --enable-file-urls -f 7 file://$(pwd)/index.mpd
, it downloads a 6.78 MB file. It's concatenating the fragments from all 6 audio tracks. It would expect it to only download a single copy, not all 6 copies.This was introduced in 4ce57d3. Using a commit before that,
yt-dlp
shows 6 video tracks and 6 audio tracks. After that commit, if two formats have the sameformat_key
, thenyt-dlp
concatenates the fragments from those formats. This makes sense for formats from separate periods, but doesn't make sense for formats from the same period.A possible fix is preprocessing each period so that it only loops over formats mod
format_key
in that period. This preserves the current functionality while making sure that duplicate formats from the same period are not redownloaded.Provide verbose output that clearly demonstrates the problem
yt-dlp -vU <your command line>
)'verbose': True
toYoutubeDL
params instead[debug] Command-line config
) and insert it belowComplete Verbose Output
The text was updated successfully, but these errors were encountered: