好吧,它实际上比我想象的要简单得多!
你首先需要改变 type="dynamic" 至 static 。这应该允许文件播放就好像它是一个实时广播,没有擦洗栏...
type="dynamic"
static
要让磨砂棒回来,我们需要设置 mediaPresentationDuration 。为了设置这个,我们需要计算段的数量,然后将其乘以我的情况下的段持续时间 4000 毫秒。然后把这是格式 PT1H22M12.000S 。
mediaPresentationDuration
4000
PT1H22M12.000S
所以在这个清单中我们可以使用以下调整后的清单回放文件(注意我的BaseURL也错了......):
<?xml version="1.0"?> <!-- MPD file Generated with GPAC version 0.6.2-DEV-rev135-g2dd7b95-master at 2016-04-07T11:49:25.297Z--> <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT4.000S" type="static" publishTime="2016-04-07T11:49:25Z" availabilityStartTime="2016-04-07T11:49:05.259Z" minimumUpdatePeriod="PT0H0M2.000S" maxSegmentDuration="PT0H0M4.011S" profiles="urn:mpeg:dash:profile:isoff-live:2011" mediaPresentationDuration="PT1H22M12.000S"> <ProgramInformation moreInformationURL="http://192.168.1.103:8080/recording_29/"> <Title>1</Title> </ProgramInformation> <Period id="GENID_DEF" start="PT0H0M0.000S"> <AdaptationSet segmentAlignment="true" lang="und"> <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/> <Representation id="audio" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="6868"> <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/> </Representation> </AdaptationSet> <AdaptationSet segmentAlignment="true" maxWidth="3840" maxHeight="2160" maxFrameRate="25" par="16:9" lang="und"> <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/> <Representation id="video_2160p" mimeType="video/mp4" codecs="avc1.42c01f" width="3840" height="2160" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="31726550"> </Representation> <Representation id="video_720p" mimeType="video/mp4" codecs="avc1.42c01f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="3175420"> </Representation> </AdaptationSet> </Period> </MPD>
我创建了一个小脚本来完成所有这些 GitHub上 。