1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 09:12:40 +01:00

[downloader/ffmpeg] Fix for direct videos inside mpd manifests

Closes #1751
This commit is contained in:
pukkandan 2021-11-22 23:32:14 +05:30
parent c98d4df23b
commit 234416e4bf
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
2 changed files with 6 additions and 6 deletions

View File

@ -443,8 +443,7 @@ def _call_downloader(self, tmpfilename, info_dict):
if info_dict.get('requested_formats') or protocol == 'http_dash_segments':
for (i, fmt) in enumerate(info_dict.get('requested_formats') or [info_dict]):
stream_number = fmt.get('manifest_stream_number', 0)
a_or_v = 'a' if fmt.get('acodec') != 'none' else 'v'
args.extend(['-map', f'{i}:{a_or_v}:{stream_number}'])
args.extend(['-map', f'{i}:{stream_number}'])
if self.params.get('test', False):
args += ['-fs', compat_str(self._TEST_FILE_SIZE)]

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals
import base64
import collections
import datetime
import hashlib
import itertools
@ -2649,7 +2650,7 @@ def extract_Initialization(source):
mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration'))
formats, subtitles = [], {}
stream_numbers = {'audio': 0, 'video': 0}
stream_numbers = collections.defaultdict(int)
for period in mpd_doc.findall(_add_ns('Period')):
period_duration = parse_duration(period.get('duration')) or mpd_duration
period_ms_info = extract_multisegment_info(period, {
@ -2715,10 +2716,8 @@ def extract_Initialization(source):
'format_note': 'DASH %s' % content_type,
'filesize': filesize,
'container': mimetype2ext(mime_type) + '_dash',
'manifest_stream_number': stream_numbers[content_type]
}
f.update(parse_codecs(codecs))
stream_numbers[content_type] += 1
elif content_type == 'text':
f = {
'ext': mimetype2ext(mime_type),
@ -2885,7 +2884,9 @@ def add_segment_url():
else:
# Assuming direct URL to unfragmented media.
f['url'] = base_url
if content_type in ('video', 'audio') or mime_type == 'image/jpeg':
if content_type in ('video', 'audio', 'image/jpeg'):
f['manifest_stream_number'] = stream_numbers[f['url']]
stream_numbers[f['url']] += 1
formats.append(f)
elif content_type == 'text':
subtitles.setdefault(lang or 'und', []).append(f)