2017-05-08 211 views
1

如何确定MPD文件中的分段持续时间(如果未指定),但给定视频持续时间和mp4视频的索引范围?例如,一个mpd文件(http://dash.edgesuite.net/akamai/streamroot/050714/Spring_4Ktest.mpd)如下:DASH 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> 

非常感谢!

服务

回答

2

看来,有没有机会检索在这种情况下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秒(子段_时间/时间段)。 交叉检查:41 * 4 = 164〜2M45.76S(视频持续时间)。