gpt4 book ai didi

javascript - 使用ffmpeg生成dash list ,dash.js无法播放

转载 作者:行者123 更新时间:2023-11-28 03:50:17 26 4
gpt4 key购买 nike

我使用ffmpeg通过rtmp协议(protocol)对传入流进行编码,代码如下:

ffmpeg -re -i rtmp://localhost:1935${StreamPath} -use_timeline 1 /
-use_template 1 -window_size 10 -min_seg_duration 5000 -f dash out.mpd

list 如下所示:

<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:mpeg:dash:schema:mpd:2011"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011
http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-
DASH_schema_files/DASH-MPD.xsd"
profiles="urn:mpeg:dash:profile:isoff-live:2011"
type="static"
mediaPresentationDuration="PT1M36.4S"
minBufferTime="PT8.3S">
<ProgramInformation>
</ProgramInformation>
<Period start="PT0.0S">
<AdaptationSet contentType="video" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1">
<Representation id="0" mimeType="video/mp4" codecs="avc1.640028" width="1920" height="1080" frameRate="30/1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="4">
<SegmentTimeline>
<S t="384000" d="128000" />
<S d="71680" />
<S d="128000" r="4" />
<S d="56832" />
<S d="128000" />
<S d="72704" />
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
<AdaptationSet contentType="audio" segmentAlignment="true" bitstreamSwitching="true">
<Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="128000" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
<SegmentTemplate timescale="44100" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="4">
<SegmentTimeline>
<S t="1099755" d="367616" />
<S d="205824" />
<S d="367616" r="4" />
<S d="162816" />
<S d="367616" />
<S d="207872" />
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
</Period>

当我尝试在 dash.js 播放器上播放它时,发生错误:

[112] Parsing complete: ( xml2json: 3.50ms, objectiron: 1.76ms, total: 0.00526s) Debug.js:127 
[116] SegmentTimeline detected using calculated Live Edge Time Debug.js:127
[118] MediaSource attached to element. Waiting on open... Debug.js:127
[119] Manifest has been refreshed at Tue Jan 02 2018 01:57:35 GMT+0800 [1514829455.1] Debug.js:127
[155] MediaSource is open! Debug.js:127
[156] Duration successfully set to: 96.4 Debug.js:127
[157] Added 0 inline events Debug.js:127
[158] video codec: video/mp4;codecs="avc1.640028" Stream.js:225
Uncaught TypeError: Cannot read property 'type' of null
at z (Stream.js:225)
at C (Stream.js:285)
at D (Stream.js:373)
at E (Stream.js:398)
at Object.d [as activate] (Stream.js:107)
at y (StreamController.js:363)
at MediaSource.c (StreamController.js:342)

然后播放失败...

是因为我没有在 ffmpeg 上正确设置参数还是这是 dash.js 中的错误?

我真的被困在这里了!

最佳答案

我遇到了同样的问题并在 dash.js 中调试了实现.

添加bandwidth="<XYZ>"<Representation/> list 中的标签解决了这个问题,至少对我来说是这样。 (其中 <XYZ> 大于 0 并且理想情况下是正确的)

令人讨厌的ffmpeg没有自动将其添加到 .mpd 文件中,并且当 dash.js 初始化播放器时 selectInitialTrack(tracks)迭代轨道 getTracksWithHighestBitrate()选择比特率/带宽最高的一个,只有 1 个不带带宽属性会导致空列表,而不是

关于javascript - 使用ffmpeg生成dash list ,dash.js无法播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48052026/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com