2014-02-07 50 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段)