我想将本地mp4文件流到DASH.js html5播放器,但我不想按时间顺序播放这个mp4文件。我的要求是从一个mp4创建一个永无止境的视频流。我认为,在MPD清单文件的创建中,这是最好的服务器端。不过,我不知道如何做到这一点。我相信这条小溪展示了包装的行为。
如何生成类似于此流的清单,以及如何正确格式化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播放器不会播放任何内容,但是它将尝试以正确的方式重新获取清单。我不太清楚到底出了什么问题,我需要做些什么来复制上面的流。
发布于 2017-03-08 17:45:17
-时移需要设置为大于0的值。例如,把它设为60。
这意味着每个片段在流后的可用时间。
https://stackoverflow.com/questions/38206674
复制相似问题