如何使用DASH非按时间顺序显示直播视频?

时间:2016-07-05 14:57:13

标签: video video-streaming html5-video live-streaming mpeg-dash

我想将本地mp4文件流式传输到DASH.js html5播放器,但我想不想按时间顺序播放这个mp4文件。我的要求是我从一个mp4创建一个永无止境的视频流。我认为这是在创建MPD清单文件时最好的服务器端。我不知道怎么做到这一点。我相信this stream演示了包装行为。

如何生成类似于此流的清单,以及如何正确格式化我的mp4以实现此目的?

我尝试过制作故意发送错误段的服务器,但这会导致播放失败。我还尝试使用MP4Box创建实时流MPD清单,但这也会导致播放失败。

mp4box -dash 1000 -profile dashavc264:live -dynamic -out DASH.mpd -mpd-duration 0 -mpd-refresh 10 -time-shift 0 -min-buffer 5 vid.mp4#video vid.mp4#audio

这会产生:

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.6.2-DEV-rev636-g4bd31f8-ab-suite   at 2016-07-05T14:20:26.756Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT0.005S" type="dynamic" publishTime="2016-07-05T14:20:26Z" availabilityStartTime="2016-07-05T14:20:26.756Z" timeShiftBufferDepth="PT0H0M0.000S" minimumUpdatePeriod="PT0H0M10.000S" maxSegmentDuration="PT0H0M1.001S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash264">
 <ProgramInformation moreInformationURL="http://gpac.io">
  <Title>DASH.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period id="GENID_DEF" start="PT0H0M0.000S">
  <AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und">
    <Representation id="1" mimeType="video/mp4" codecs="avc3.64001f" width="1280" height="720" frameRate="24000/1001" sar="1:1" startWithSAP="1" bandwidth="1428068">
    <SegmentTemplate timescale="24000" media="vid_dash_track1_$Number$.m4s" startNumber="1" duration="24000" initialization="vid_dash_track1_init.mp4"/>
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" lang="eng">
   <Representation id="2" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="32000" startWithSAP="1" bandwidth="97557">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
    <SegmentTemplate timescale="32000" media="vid_dash_track2_$Number$.m4s" startNumber="1" duration="32000" initialization="vid_dash_track2_init.mp4"/>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

HTML5播放器不会播放任何内容,但是,它会尝试以正确的方式重新获取清单。我不确定出了什么问题,以及我需要做些什么来复制上面的流。

1 个答案:

答案 0 :(得分:1)

-time-shift需要设置为大于0的值。例如,将其设置为60.

表示流式传输后每个网段的可用时间。