diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-28 19:02:43 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 19:02:43 +0530 |
commit | be6202f12b97858b9d716e608394b51065d0419f (patch) | |
tree | 71f920777c24d9d81c990f0bf57d66e9d5bbaff7 /test/test_InfoExtractor.py | |
parent | db9a564b6a5c31472f8298969584eead0b59fa1c (diff) | |
parent | e8f834cd8dfc07011d1080321e42bc130e7201bb (diff) | |
download | hypervideo-pre-be6202f12b97858b9d716e608394b51065d0419f.tar.lz hypervideo-pre-be6202f12b97858b9d716e608394b51065d0419f.tar.xz hypervideo-pre-be6202f12b97858b9d716e608394b51065d0419f.zip |
Subtitle extraction from streaming media manifests #247
Authored by fstirlitz
Modified from: https://github.com/ytdl-org/youtube-dl/pull/6144
Closes: #73
Fixes:
https://github.com/ytdl-org/youtube-dl/issues/6106
https://github.com/ytdl-org/youtube-dl/issues/14977
https://github.com/ytdl-org/youtube-dl/issues/21438
https://github.com/ytdl-org/youtube-dl/issues/23609
https://github.com/ytdl-org/youtube-dl/issues/28132
Might also fix (untested):
https://github.com/ytdl-org/youtube-dl/issues/15424
https://github.com/ytdl-org/youtube-dl/issues/18267
https://github.com/ytdl-org/youtube-dl/issues/23899
https://github.com/ytdl-org/youtube-dl/issues/24375
https://github.com/ytdl-org/youtube-dl/issues/24595
https://github.com/ytdl-org/youtube-dl/issues/27899
Related:
https://github.com/ytdl-org/youtube-dl/issues/22379
https://github.com/ytdl-org/youtube-dl/pull/24517
https://github.com/ytdl-org/youtube-dl/pull/24886
https://github.com/ytdl-org/youtube-dl/pull/27215
Notes:
* The functions `extractor.common._extract_..._formats` are still kept for compatibility
* Only some extractors have currently been moved to using `_extract_..._formats_and_subtitles`
* Direct subtitle manifests (without a master) are not supported and are wrongly identified as containing video formats
* AES support is untested
* The fragmented TTML subtitles extracted from DASH/ISM are valid, but are unsupported by `ffmpeg` and most video players
* Their XML fragments can be dumped using `ffmpeg -i in.mp4 -f data -map 0 -c copy out.ttml`.
Once the unnecessary headers are stripped out of this, it becomes a valid self-contained ttml file
* The ttml subs downloaded from DASH manifests can also be directly opened with <https://github.com/SubtitleEdit>
* Fragmented WebVTT files extracted from DASH/ISM are also unsupported by most tools
* Unlike the ttml files, the XML fragments of these cannot be dumped using `ffmpeg`
* The webtt subs extracted from DASH can be parsed by <https://github.com/gpac/gpac>
* But validity of the those extracted from ISM are untested
Diffstat (limited to 'test/test_InfoExtractor.py')
-rw-r--r-- | test/test_InfoExtractor.py | 497 |
1 files changed, 489 insertions, 8 deletions
diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index a08616694..f3578efe1 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -684,17 +684,186 @@ jwplayer("mediaplayer").setup({"abouttext":"Visit Indie DB","aboutlink":"http:\/ 'width': 1920, 'height': 1080, 'vcodec': 'avc1.64002a', - }] + }], + {} + ), + ( + 'bipbop_16x9', + 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8', + [{ + "format_id": "bipbop_audio-BipBop Audio 2", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/alternate_audio_aac/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "language": "eng", + "ext": "mp4", + "protocol": "m3u8", + "preference": None, + "quality": None, + "vcodec": "none", + "audio_ext": "mp4", + "video_ext": "none", + }, { + "format_id": "41", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear0/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 41.457, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "vcodec": "none", + "acodec": "mp4a.40.2", + "audio_ext": "mp4", + "video_ext": "none", + "abr": 41.457, + }, { + "format_id": "263", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear1/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 263.851, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "width": 416, + "height": 234, + "vcodec": "avc1.4d400d", + "acodec": "mp4a.40.2", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 263.851, + "abr": 0, + }, { + "format_id": "577", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear2/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 577.61, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "width": 640, + "height": 360, + "vcodec": "avc1.4d401e", + "acodec": "mp4a.40.2", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 577.61, + "abr": 0, + }, { + "format_id": "915", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear3/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 915.905, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "width": 960, + "height": 540, + "vcodec": "avc1.4d401f", + "acodec": "mp4a.40.2", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 915.905, + "abr": 0, + }, { + "format_id": "1030", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear4/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 1030.138, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "width": 1280, + "height": 720, + "vcodec": "avc1.4d401f", + "acodec": "mp4a.40.2", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 1030.138, + "abr": 0, + }, { + "format_id": "1924", + "format_index": None, + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8", + "manifest_url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8", + "tbr": 1924.009, + "ext": "mp4", + "fps": None, + "protocol": "m3u8", + "preference": None, + "quality": None, + "width": 1920, + "height": 1080, + "vcodec": "avc1.4d401f", + "acodec": "mp4a.40.2", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 1924.009, + "abr": 0, + }], + { + "en": [{ + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/eng/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }, { + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/eng_forced/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }], + "fr": [{ + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/fra/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }, { + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/fra_forced/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }], + "es": [{ + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/spa/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }, { + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/spa_forced/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }], + "ja": [{ + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/jpn/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }, { + "url": "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/subtitles/jpn_forced/prog_index.m3u8", + "ext": "vtt", + "protocol": "m3u8_native" + }], + } ), ] - for m3u8_file, m3u8_url, expected_formats in _TEST_CASES: + for m3u8_file, m3u8_url, expected_formats, expected_subs in _TEST_CASES: with io.open('./test/testdata/m3u8/%s.m3u8' % m3u8_file, mode='r', encoding='utf-8') as f: - formats = self.ie._parse_m3u8_formats( + formats, subs = self.ie._parse_m3u8_formats_and_subtitles( f.read(), m3u8_url, ext='mp4') self.ie._sort_formats(formats) expect_value(self, formats, expected_formats, None) + expect_value(self, subs, expected_subs, None) def test_parse_mpd_formats(self): _TEST_CASES = [ @@ -780,7 +949,8 @@ jwplayer("mediaplayer").setup({"abouttext":"Visit Indie DB","aboutlink":"http:\/ 'tbr': 5997.485, 'width': 1920, 'height': 1080, - }] + }], + {}, ), ( # https://github.com/ytdl-org/youtube-dl/pull/14844 'urls_only', @@ -863,7 +1033,8 @@ jwplayer("mediaplayer").setup({"abouttext":"Visit Indie DB","aboutlink":"http:\/ 'tbr': 4400, 'width': 1920, 'height': 1080, - }] + }], + {}, ), ( # https://github.com/ytdl-org/youtube-dl/issues/20346 # Media considered unfragmented even though it contains @@ -909,18 +1080,328 @@ jwplayer("mediaplayer").setup({"abouttext":"Visit Indie DB","aboutlink":"http:\/ 'width': 360, 'height': 360, 'fps': 30, - }] + }], + {}, + ), ( + 'subtitles', + 'https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd', + 'https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/', + [{ + "format_id": "audio=128001", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "m4a", + "tbr": 128.001, + "asr": 48000, + "format_note": "DASH audio", + "container": "m4a_dash", + "vcodec": "none", + "acodec": "mp4a.40.2", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "audio_ext": "m4a", + "video_ext": "none", + "abr": 128.001, + }, { + "format_id": "video=100000", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "mp4", + "width": 336, + "height": 144, + "tbr": 100, + "format_note": "DASH video", + "container": "mp4_dash", + "vcodec": "avc1.4D401F", + "acodec": "none", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 100, + }, { + "format_id": "video=326000", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "mp4", + "width": 562, + "height": 240, + "tbr": 326, + "format_note": "DASH video", + "container": "mp4_dash", + "vcodec": "avc1.4D401F", + "acodec": "none", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 326, + }, { + "format_id": "video=698000", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "mp4", + "width": 844, + "height": 360, + "tbr": 698, + "format_note": "DASH video", + "container": "mp4_dash", + "vcodec": "avc1.4D401F", + "acodec": "none", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 698, + }, { + "format_id": "video=1493000", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "mp4", + "width": 1126, + "height": 480, + "tbr": 1493, + "format_note": "DASH video", + "container": "mp4_dash", + "vcodec": "avc1.4D401F", + "acodec": "none", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 1493, + }, { + "format_id": "video=4482000", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "ext": "mp4", + "width": 1688, + "height": 720, + "tbr": 4482, + "format_note": "DASH video", + "container": "mp4_dash", + "vcodec": "avc1.4D401F", + "acodec": "none", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + "video_ext": "mp4", + "audio_ext": "none", + "vbr": 4482, + }], + { + "en": [ + { + "ext": "mp4", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd", + "fragment_base_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/dash/", + "protocol": "http_dash_segments", + } + ] + }, ) ] - for mpd_file, mpd_url, mpd_base_url, expected_formats in _TEST_CASES: + for mpd_file, mpd_url, mpd_base_url, expected_formats, expected_subtitles in _TEST_CASES: with io.open('./test/testdata/mpd/%s.mpd' % mpd_file, mode='r', encoding='utf-8') as f: - formats = self.ie._parse_mpd_formats( + formats, subtitles = self.ie._parse_mpd_formats_and_subtitles( compat_etree_fromstring(f.read().encode('utf-8')), mpd_base_url=mpd_base_url, mpd_url=mpd_url) self.ie._sort_formats(formats) expect_value(self, formats, expected_formats, None) + expect_value(self, subtitles, expected_subtitles, None) + + def test_parse_ism_formats(self): + _TEST_CASES = [ + ( + 'sintel', + 'https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest', + [{ + "format_id": "audio-128", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "isma", + "tbr": 128, + "asr": 48000, + "vcodec": "none", + "acodec": "AACL", + "protocol": "ism", + "_download_params": { + "stream_type": "audio", + "duration": 8880746666, + "timescale": 10000000, + "width": 0, + "height": 0, + "fourcc": "AACL", + "codec_private_data": "1190", + "sampling_rate": 48000, + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "audio_ext": "isma", + "video_ext": "none", + "abr": 128, + }, { + "format_id": "video-100", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "ismv", + "width": 336, + "height": 144, + "tbr": 100, + "vcodec": "AVC1", + "acodec": "none", + "protocol": "ism", + "_download_params": { + "stream_type": "video", + "duration": 8880746666, + "timescale": 10000000, + "width": 336, + "height": 144, + "fourcc": "AVC1", + "codec_private_data": "00000001674D401FDA0544EFFC2D002CBC40000003004000000C03C60CA80000000168EF32C8", + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "video_ext": "ismv", + "audio_ext": "none", + "vbr": 100, + }, { + "format_id": "video-326", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "ismv", + "width": 562, + "height": 240, + "tbr": 326, + "vcodec": "AVC1", + "acodec": "none", + "protocol": "ism", + "_download_params": { + "stream_type": "video", + "duration": 8880746666, + "timescale": 10000000, + "width": 562, + "height": 240, + "fourcc": "AVC1", + "codec_private_data": "00000001674D401FDA0241FE23FFC3BC83BA44000003000400000300C03C60CA800000000168EF32C8", + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "video_ext": "ismv", + "audio_ext": "none", + "vbr": 326, + }, { + "format_id": "video-698", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "ismv", + "width": 844, + "height": 360, + "tbr": 698, + "vcodec": "AVC1", + "acodec": "none", + "protocol": "ism", + "_download_params": { + "stream_type": "video", + "duration": 8880746666, + "timescale": 10000000, + "width": 844, + "height": 360, + "fourcc": "AVC1", + "codec_private_data": "00000001674D401FDA0350BFB97FF06AF06AD1000003000100000300300F1832A00000000168EF32C8", + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "video_ext": "ismv", + "audio_ext": "none", + "vbr": 698, + }, { + "format_id": "video-1493", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "ismv", + "width": 1126, + "height": 480, + "tbr": 1493, + "vcodec": "AVC1", + "acodec": "none", + "protocol": "ism", + "_download_params": { + "stream_type": "video", + "duration": 8880746666, + "timescale": 10000000, + "width": 1126, + "height": 480, + "fourcc": "AVC1", + "codec_private_data": "00000001674D401FDA011C3DE6FFF0D890D871000003000100000300300F1832A00000000168EF32C8", + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "video_ext": "ismv", + "audio_ext": "none", + "vbr": 1493, + }, { + "format_id": "video-4482", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "ext": "ismv", + "width": 1688, + "height": 720, + "tbr": 4482, + "vcodec": "AVC1", + "acodec": "none", + "protocol": "ism", + "_download_params": { + "stream_type": "video", + "duration": 8880746666, + "timescale": 10000000, + "width": 1688, + "height": 720, + "fourcc": "AVC1", + "codec_private_data": "00000001674D401FDA01A816F97FFC1ABC1AB440000003004000000C03C60CA80000000168EF32C8", + "channels": 2, + "bits_per_sample": 16, + "nal_unit_length_field": 4 + }, + "video_ext": "ismv", + "audio_ext": "none", + "vbr": 4482, + }], + { + "eng": [ + { + "ext": "ismt", + "protocol": "ism", + "url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "manifest_url": "https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/Manifest", + "_download_params": { + "stream_type": "text", + "duration": 8880746666, + "timescale": 10000000, + "fourcc": "TTML", + "codec_private_data": "" + } + } + ] + }, + ), + ] + + for ism_file, ism_url, expected_formats, expected_subtitles in _TEST_CASES: + with io.open('./test/testdata/ism/%s.Manifest' % ism_file, + mode='r', encoding='utf-8') as f: + formats, subtitles = self.ie._parse_ism_formats_and_subtitles( + compat_etree_fromstring(f.read().encode('utf-8')), ism_url=ism_url) + self.ie._sort_formats(formats) + expect_value(self, formats, expected_formats, None) + expect_value(self, subtitles, expected_subtitles, None) def test_parse_f4m_formats(self): _TEST_CASES = [ |