mirror of https://github.com/yt-dlp/yt-dlp.git
[extractor/common] Fix duration per dash segment (closes #11868)
This commit is contained in:
parent
76aaf1faae
commit
d04621daf4
|
@ -1751,14 +1751,16 @@ class InfoExtractor(object):
|
||||||
# Example: https://www.youtube.com/watch?v=iXZV5uAYMJI
|
# Example: https://www.youtube.com/watch?v=iXZV5uAYMJI
|
||||||
# or any YouTube dashsegments video
|
# or any YouTube dashsegments video
|
||||||
fragments = []
|
fragments = []
|
||||||
s_num = 0
|
segment_index = 0
|
||||||
for segment_url in representation_ms_info['segment_urls']:
|
timescale = representation_ms_info['timescale']
|
||||||
s = representation_ms_info['s'][s_num]
|
for s in representation_ms_info['s']:
|
||||||
|
duration = float_or_none(s['d'], timescale)
|
||||||
for r in range(s.get('r', 0) + 1):
|
for r in range(s.get('r', 0) + 1):
|
||||||
fragments.append({
|
fragments.append({
|
||||||
'url': segment_url,
|
'url': representation_ms_info['segment_urls'][segment_index],
|
||||||
'duration': float_or_none(s['d'], representation_ms_info['timescale']),
|
'duration': duration,
|
||||||
})
|
})
|
||||||
|
segment_index += 1
|
||||||
representation_ms_info['fragments'] = fragments
|
representation_ms_info['fragments'] = fragments
|
||||||
# NB: MPD manifest may contain direct URLs to unfragmented media.
|
# NB: MPD manifest may contain direct URLs to unfragmented media.
|
||||||
# No fragments key is present in this case.
|
# No fragments key is present in this case.
|
||||||
|
|
Loading…
Reference in New Issue