如果未指定MPD文件中的段持续时间,但是给定视频持续时间和mp4视频的索引范围,如何确定?例如,mpd文件(http://dash.edgesuite.net/akamai/streamroot/050714/Spring_4Ktest.mpd)如下:
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5208 on 2014-05-08T15:14:47Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H2M45.76S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
<Title>Spring_3000k_dash.mpd generated by GPAC</Title>
</ProgramInformation>
<Period id="" duration="PT0H2M45.76S">
<AdaptationSet segmentAlignment="true" maxWidth="3840" maxHeight="2160" maxFrameRate="24000/1001" par="16:9" subsegmentStartsWithSAP="1">
<Representation id="1" mimeType="video/mp4" codecs="avc1.640033" width="1280" height="720" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="2859078">
<BaseURL>Spring_3000k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="896-1419"/>
</Representation>
<Representation id="2" mimeType="video/mp4" codecs="avc1.640033" width="1920" height="1080" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="4872811">
<BaseURL>Spring_5000k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="896-1419"/>
</Representation>
<Representation id="3" mimeType="video/mp4" codecs="avc1.640033" width="2880" height="1620" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="7322004">
<BaseURL>Spring_7500k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="897-1420"/>
</Representation>
<Representation id="4" mimeType="video/mp4" codecs="avc1.640033" width="3840" height="2160" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="9604428">
<BaseURL>Spring_10000k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="896-1419"/>
</Representation>
<Representation id="5" mimeType="video/mp4" codecs="avc1.640033" width="3840" height="2160" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="14658452">
<BaseURL>Spring_15000k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="896-1419"/>
</Representation>
<Representation id="6" mimeType="video/mp4" codecs="avc1.640033" width="3840" height="2160" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="19683583">
<BaseURL>Spring_20000k_track1_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="896-1419"/>
</Representation>
</AdaptationSet>
<AdaptationSet segmentAlignment="true" subsegmentStartsWithSAP="1">
<Representation id="7" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="193664">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>Spring_3000k_track2_dashinit.mp4</BaseURL>
<SegmentBase indexRangeExact="true" indexRange="823-1262"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
非常感谢你!
闪耀
在这种情况下,似乎没有机会从MPD文件中检索段信息。您只需要分析mp4文件。以下是“Spring_3000k_track1_dashinit.mp4”分析的片段。
0 24 ftyp
24 8 free
2c 3b free
67 319 moov
380 20c sidx
58c 354 moof
8e0 152f01 mdat
...
和“sidx”的数据(位于896-1914范围内,即“0x380” - “0x58b”):
Box type : sidx
Box version : 0
reference_ID : 1
timescale : 24000
earliest_presentation_time : 0
first_offset : 0
Entries : size = 41
- [0]
reference_type : 0
referenced_size : 1389141
subsegment_duration : 96096
starts_with_SAP : 1
SAP_type : 4
SAP_delta_time : 0
- [1]
reference_type : 0
referenced_size : 1422268
subsegment_duration : 96096
starts_with_SAP : 1
SAP_type : 4
SAP_delta_time : 0
...
因此视频中有41个段,段持续时间为4秒(subsegment_duration / timescale)。交叉检查:41 * 4 = 164~2M45.76S(视频持续时间)。