A feature-rich command-line audio/video downloader
[downloader/ism] Support muxing TTML subtitles
Felix S66a1b8643ad3
diff --git a/yt_dlp/downloader/ism.py b/yt_dlp/downloader/ism.pyindex 103064df1c..07d74aef0b 100644--- a/yt_dlp/downloader/ism.py+++ b/yt_dlp/downloader/ism.py@@ -118,8 +118,7 @@ def write_piff_header(stream, params):vmhd_payload += u16.pack(0) * 3 # opcolormedia_header_box = full_box(b'vmhd', 0, 1, vmhd_payload) # Video Media Headerelif stream_type == 'text':- sthd_payload = u16.pack(0) * 2- media_header_box = full_box(b'sthd', 0, 1, sthd_payload) # Subtitle Media Header+ media_header_box = full_box(b'sthd', 0, 0, b'') # Subtitle Media Headerelse:assert Falseminf_payload = media_header_box@@ -173,6 +172,14 @@ def write_piff_header(stream, params):sample_entry_box = box(b'avc1', sample_entry_payload) # AVC Simple Entryelse:assert False+ elif stream_type == 'text':+ if fourcc == 'TTML':+ sample_entry_payload += b'http://www.w3.org/ns/ttml\0' # namespace+ sample_entry_payload += b'\0' # schema location+ sample_entry_payload += b'\0' # auxilary mime types(??)+ sample_entry_box = box(b'stpp', sample_entry_payload)+ else:+ assert Falseelse:assert Falsestsd_payload += sample_entry_boxdiff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.pyindex 803c7fa066..2ca25951b2 100644--- a/yt_dlp/extractor/common.py+++ b/yt_dlp/extractor/common.py@@ -2816,7 +2816,7 @@ class InfoExtractor(object):for track in stream.findall('QualityLevel'):fourcc = track.get('FourCC', 'AACL' if track.get('AudioTag') == '255' else None)# TODO: add support for WVC1 and WMAP- if fourcc not in ('H264', 'AVC1', 'AACL'):+ if fourcc not in ('H264', 'AVC1', 'AACL', 'TTML'):self.report_warning('%s is not a supported codec' % fourcc)continuetbr = int(track.attrib['Bitrate']) // 1000