[extractor] Detect sttp as subtitles in MPD

Closes #656
Solution by: fstirlitz
This commit is contained in:
pukkandan 2021-08-10 04:42:03 +05:30
parent 7be9ccff0b
commit be2fc5b212
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -2596,7 +2596,16 @@ def extract_Initialization(source):
mime_type = representation_attrib['mimeType']
content_type = representation_attrib.get('contentType', mime_type.split('/')[0])
if content_type in ('video', 'audio', 'text') or mime_type == 'image/jpeg':
codecs = representation_attrib.get('codecs', '')
if content_type not in ('video', 'audio', 'text'):
if mime_type == 'image/jpeg':
content_type = 'image/jpeg'
if codecs.split('.')[0] == 'stpp':
content_type = 'text'
else:
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
continue
base_url = ''
for element in (representation, adaptation_set, period, mpd_doc):
base_url_e = element.find(_add_ns('BaseURL'))
@ -2634,14 +2643,14 @@ def extract_Initialization(source):
'filesize': filesize,
'container': mimetype2ext(mime_type) + '_dash',
}
f.update(parse_codecs(representation_attrib.get('codecs')))
f.update(parse_codecs(codecs))
elif content_type == 'text':
f = {
'ext': mimetype2ext(mime_type),
'manifest_url': mpd_url,
'filesize': filesize,
}
elif mime_type == 'image/jpeg':
elif content_type == 'image/jpeg':
# See test case in VikiIE
# https://www.viki.com/videos/1175236v-choosing-spouse-by-lottery-episode-1
f = {
@ -2803,8 +2812,7 @@ def add_segment_url():
formats.append(f)
elif content_type == 'text':
subtitles.setdefault(lang or 'und', []).append(f)
else:
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
return formats, subtitles
def _extract_ism_formats(self, *args, **kwargs):