参考文章:
1、自适应流媒体传输(四)——深入理解MPD - 腾讯云开发者社区-腾讯云 (tencent.com)
文件内容:
mpd文件内容如下:
<?xml version='1.0' encoding='UTF-8'?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:kvs="urn:aws:kinesisvideo:mpd:2019" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" availabilityStartTime="2023-02-01T07:44:20.154Z" mediaPresentationDuration="PT11.993S" minBufferTime="PT1S">
<Period id="0" start="PT0S" duration="PT11.993S">
<AdaptationSet segmentAlignment="true" mimeType="video/mp4" startWithSAP="1">
<SegmentTemplate media="getMP4MediaFragment.mp4?SessionToken=CiB0UbmpykTj_qUwRMS_oGSQ2cyoUBCtnlITK3bHETOU6xIQvOdn7ro-egjNRn-QOQCo_xoZ7NOSN8jPeOsYWYg0l0L9TO4MGMdfBRPmYCIgv1T-5BwX2wyVgnlhOSjhYJ2Z7_861U6ZnMZI5Mp2uhc~&SequenceNumber=$Number$&TrackNumber=1" initialization="getMP4InitFragment.mp4?SessionToken=CiB0UbmpykTj_qUwRMS_oGSQ2cyoUBCtnlITK3bHETOU6xIQvOdn7ro-egjNRn-QOQCo_xoZ7NOSN8jPeOsYWYg0l0L9TO4MGMdfBRPmYCIgv1T-5BwX2wyVgnlhOSjhYJ2Z7_861U6ZnMZI5Mp2uhc~&TrackNumber=1" timescale="1000" startNumber="1">
<SegmentTimeline>
<S t="0" d="1997" kvs:ts="2023-02-01T07:44:20.154Z" kvs:fn="91343852333184329172373990441445609830137530749"/>
<S d="2000" kvs:ts="2023-02-01T07:44:22.152Z" kvs:fn="91343852333184329177325750598587131274875633039"/>
<S d="2000" kvs:ts="2023-02-01T07:44:24.151Z" kvs:fn="91343852333184329182277510755728652540162752768"/>
<S d="1998" kvs:ts="2023-02-01T07:44:26.151Z" kvs:fn="91343852333184334134037667897249753785296460711"/>
<S d="2000" kvs:ts="2023-02-01T07:44:28.150Z" kvs:fn="91343852333184334138989428054391275151635768608"/>
<S d="1998" kvs:ts="2023-02-01T07:44:30.150Z" kvs:fn="91343852333184334143941188211532796378004551986"/>
</SegmentTimeline>
</SegmentTemplate>
<Representation id="video" bandwidth="1209810" width="1920" height="1080" frameRate="20.03" codecs="avc1.4d0029" scanType="progressive"/>
</AdaptationSet>
<AdaptationSet segmentAlignment="true" mimeType="audio/mp4" startWithSAP="1">
<SegmentTemplate media="getMP4MediaFragment.mp4?SessionToken=CiB0UbmpykTj_qUwRMS_oGSQ2cyoUBCtnlITK3bHETOU6xIQvOdn7ro-egjNRn-QOQCo_xoZ7NOSN8jPeOsYWYg0l0L9TO4MGMdfBRPmYCIgv1T-5BwX2wyVgnlhOSjhYJ2Z7_861U6ZnMZI5Mp2uhc~&SequenceNumber=$Number$&TrackNumber=2" initialization="getMP4InitFragment.mp4?SessionToken=CiB0UbmpykTj_qUwRMS_oGSQ2cyoUBCtnlITK3bHETOU6xIQvOdn7ro-egjNRn-QOQCo_xoZ7NOSN8jPeOsYWYg0l0L9TO4MGMdfBRPmYCIgv1T-5BwX2wyVgnlhOSjhYJ2Z7_861U6ZnMZI5Mp2uhc~&TrackNumber=2" timescale="1000" startNumber="1">
<SegmentTimeline>
<S t="0" d="1997" kvs:ts="2023-02-01T07:44:20.154Z" kvs:fn="91343852333184329172373990441445609830137530749"/>
<S d="2000" kvs:ts="2023-02-01T07:44:22.152Z" kvs:fn="91343852333184329177325750598587131274875633039"/>
<S d="2000" kvs:ts="2023-02-01T07:44:24.151Z" kvs:fn="91343852333184329182277510755728652540162752768"/>
<S d="1998" kvs:ts="2023-02-01T07:44:26.151Z" kvs:fn="91343852333184334134037667897249753785296460711"/>
<S d="2000" kvs:ts="2023-02-01T07:44:28.150Z" kvs:fn="91343852333184334138989428054391275151635768608"/>
<S d="1998" kvs:ts="2023-02-01T07:44:30.150Z" kvs:fn="91343852333184334143941188211532796378004551986"/>
</SegmentTimeline>
</SegmentTemplate>
<Representation id="audio" bandwidth="66457" audioSamplingRate="8000" codecs="alaw">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
2、m3u8文件内容如下:
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/stereo/en/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/surround/en/320kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Deutsch",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="de",URI="subtitles_de.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",URI="subtitles_en.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Espanol",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="es",URI="subtitles_es.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Français",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="fr",URI="subtitles_fr.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=258157,CODECS="avc1.4d400d,mp4a.40.2",AUDIO="stereo",RESOLUTION=422x180,SUBTITLES="subs"
video/250kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=520929,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="stereo",RESOLUTION=638x272,SUBTITLES="subs"
video/500kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=831270,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="stereo",RESOLUTION=638x272,SUBTITLES="subs"
video/800kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1144430,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="surround",RESOLUTION=958x408,SUBTITLES="subs"
video/1100kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1558322,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="surround",RESOLUTION=1277x554,SUBTITLES="subs"
video/1500kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4149264,CODECS="avc1.4d4028,mp4a.40.2",AUDIO="surround",RESOLUTION=1921x818,SUBTITLES="subs"
video/4000kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=6214307,CODECS="avc1.4d4028,mp4a.40.2",AUDIO="surround",RESOLUTION=1921x818,SUBTITLES="subs"
video/6000kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=10285391,CODECS="avc1.4d4033,mp4a.40.2",AUDIO="surround",RESOLUTION=4096x1744,SUBTITLES="subs"
video/10000kbit.m3u8
ts解析