我正在使用 ffmpeg -segment 分割桌面的视频捕获并通过网络发送它们,以便提供给客户端并使用 dash.js 播放。问题是播放器正在搜索初始化段,我似乎无法弄清楚如何创建它。
我使用这个 ffmpeg 命令创建段:
ffmpeg -rtbufsize 1500M -f dshow -r 15 -i video="UScreenCapture"
-flags +global_header -vcodec libvpx -crf 10 -quality good -keyint_min 15 -g 15
-cpu-used 3 -b:v 1000k -qmin 10 -qmax 42 -threads 2 -vf scale=-1:480 -bufsize 1
500 -map 0 -f stream_segment -segment_time 2 -segment_format webm http://localho
st:3000/stream/22/%03d
我为流创建的清单如下所示:
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" type="dynamic" availabilityStartTime="2014-06-19T07:47:40.079Z" minBufferTime="PT0S" profiles="urn:mpeg:dash:profile:isoff-live:2011" suggestedPresentationDelay="PT40S" maxSegmentDuration="PT2.000S" minimumUpdatePeriod="PT1000M">
<Period id="1" bitstreamSwitching="true" start="PT0S">
<AdaptationSet mimeType="video/webm" segmentAlignment="true" startWithSAP="1" maxWidth="1280" maxHeight="720" maxFrameRate="15">
<ContentComponent id="1" contentType="video"/>
<SegmentTemplate presentationTimeOffset="0" timescale="90000" media="$Number$/" duration="180000" startNumber="0"/>
<Representation id="1" width="853" height="480" frameRate="15" bandwidth="1000000" codecs="vp8"/>
</AdaptationSet>
</Period>
</MPD>
播放器调试模式打印以下内容:
Getting the request for time: 0 dash.all.js:2073
Index for time 0 is 0 dash.all.js:2073
Waiting for more video buffer before starting playback. dash.all.js:2073
BufferController video seek: 0 dash.all.js:2073
Marking a special seek for initial video playback. dash.all.js:2073
Start searching for initialization. dash.all.js:2073
Perform init search: stream/22/ dash.all.js:2073
Getting the request for time: 0 dash.all.js:2073
Index for time 0 is 0 dash.all.js:2073
Data changed - loading the video fragment for time: 0 dash.all.js:2073
Getting the request for time: 0
如何为生成的段创建初始化段?我似乎无法让它工作。