2014-02-07 48 views
4

如果MPD文件没有任何段URL列表,我如何确定DASH介质的段数?它只有一个片段模板,所以我不知道与MPD相关的媒体有多少个片段。这是我正在谈论的MPD:DASH MPD中的段数

<MPD type="static" xmlns="urn:mpeg:DASH:schema:MPD:2011" profiles="urn:mpeg:dash:profile:full:2011" minBufferTime="PT1.5S" mediaPresentationDuration="PT0H1M59.89S"> 
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net"> 
    <Title>Media Presentation Description for file hdworld_0696kbps_ffmpeg_track1.mp4 generated with GPAC </Title> 
</ProgramInformation> 
<Period start="PT0S" duration="PT0H1M59.89S"> 
    <AdaptationSet> 
    <ContentComponent id="1" contentType="video"/> 
    <SegmentTemplate initialization="/$Bandwidth$/hdworld_ffmpeg_track1_dash.mp4" timescale="1000" duration="4920" media="/$Bandwidth$/hdworld_ffmpeg_track1_$Number$.m4s" startNumber="1"/> 
    <Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="534343"/> 
    <Representation id="2" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="812553"/> 
    <Representation id="3" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="1607692"/> 
    </AdaptationSet> 
    <AdaptationSet> 
    <ContentComponent id="2" contentType="audio" lang="und"/> 
    <SegmentTemplate initialization="/audio/HDWorld_audio_init.mp4"/> 
    <Representation id="6" mimeType="audio/mp4" codecs="mp4a.40.02" sampleRate="44100" numChannels="2" lang="und" startWithSAP="1" bandwidth="257141"> 
    <SegmentTemplate timescale="1000" duration="9980" media="/audio/hdworld_seg_audio$Number$.m4s" startNumber="1"/> 
    </Representation> 
    </AdaptationSet> 
</Period> 
</MPD> 

我的目标是检索所有现有段的URI。

回答

13

在这个例子中,你可以看到音频段的长度分别为9.98秒(duration = 9980,timescale = 1000)。由于演示的持续时间为1分59.89秒,(持续时间=“PT0H1M59.89S”),即大约13个分段(最后一个较短)。 使用网址模板(/audio/hdworld_seg_audio$Number$.m4s)检索每个片段(用您想要的片段编号替换$ Number $(第一个为1)。 同样适用于视频片段(除了它们每个4.92秒,所以你会有25段)