我正在使用ffmpeg创建一个webm文件的块和清单,我想用Dash实时流媒体。js。不幸的是,达什。js不会播放mpd文件,无论我以何种方式创建块和清单。然而,Dash中的示例mpd URL。js正在工作。
ffmpeg -re -r 25 -i Dash/strm.webm
-map 0:v:0
-pix_fmt yuv420p
-c:v libvpx
-s 640x480 -keyint_min 60 -g 60 -speed 6 -tile-columns 4 -frame-parallel 1 -threads 8 -static-thresh 0 -max-intra-rate 300 -deadline realtime -lag-in-frames 0 -error-resilient 1
-b:v 3000k
-f webm_chunk
-header "Dash/glass_360.hdr"
-chunk_start_index 1 Dash/glass_360_%d.chk
-map 0:a:0
-c:a libvorbis
-b:a 128k -ar 44100
-f webm_chunk
-audio_chunk_duration 2000
-header Dash/glass_171.hdr
-chunk_start_index 1 Dash/glass_171_%d.chk
//Manifest
ffmpeg
-f webm_dash_manifest -live 1
-i Dash/glass_360.hdr
-f webm_dash_manifest -live 1
-i Dash/glass_171.hdr
-c copy
-map 0 -map 1
-f webm_dash_manifest -live 1
-adaptation_sets "id=0,streams=0 id=1,streams=1"
-chunk_start_index 1
-chunk_duration_ms 2000
-time_shift_buffer_depth 7200
-minimum_update_period 7200 Dash/glass_video_manifest.mpd
ffmpeg version git-2020-05-27-8b5ffae Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 49.100 / 56. 49.100
libavcodec 58. 87.101 / 58. 87.101
libavformat 58. 43.100 / 58. 43.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 83.100 / 7. 83.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, webm_dash_manifest, from 'Dash/glass_360.hdr':
Metadata:
ENCODER : Lavf58.43.100
Duration: N/A, bitrate: N/A
Stream #0:0(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 1k tbc (default)
Metadata:
ALPHA_MODE : 1
ENCODER : Lavc58.87.101 libvpx
webm_dash_manifest_file_name: glass_360.hdr
webm_dash_manifest_track_number: 1
Input #1, webm_dash_manifest, from 'Dash/glass_171.hdr':
Metadata:
ENCODER : Lavf58.43.100
Duration: N/A, bitrate: N/A
Stream #1:0(eng): Audio: vorbis, 44100 Hz, mono, fltp (default)
Metadata:
ENCODER : Lavc58.87.101 libvorbis
webm_dash_manifest_file_name: glass_171.hdr
webm_dash_manifest_track_number: 1
Output #0, webm_dash_manifest, to 'Dash/glass_video_manifest.mpd':
Metadata:
encoder : Lavf58.43.100
Stream #0:0(eng): Video: vp8, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1k tbr, 1k tbn, 1k tbc (default)
Metadata:
ALPHA_MODE : 1
ENCODER : Lavc58.87.101 libvpx
webm_dash_manifest_file_name: glass_360.hdr
webm_dash_manifest_track_number: 1
Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp (default)
Metadata:
ENCODER : Lavc58.87.101 libvorbis
webm_dash_manifest_file_name: glass_171.hdr
webm_dash_manifest_track_number: 1
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: unknown
清单文件
(glass_video_Manifest.mpd)
我试图删除其他问题中建议的contentcomponent
,但没有成功。
<?xml version="1.0" encoding="UTF-8"?>
<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"
type="dynamic"
minBufferTime="PT1S"
profiles="urn:mpeg:dash:profile:isoff-live:2011"
availabilityStartTime="2021-04-01T18:20:08Z"
timeShiftBufferDepth="PT7200S"
minimumUpdatePeriod="PT7200S">
<Period id="0" start="PT0S" >
<AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" bitstreamSwitching="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
<ContentComponent id="1" type="video"/>
<SegmentTemplate timescale="1000" duration="2000" media="glass_$RepresentationID$_$Number$.chk" startNumber="1" initialization="glass_$RepresentationID$.hdr"/>
<Representation id="360" bandwidth="1000000" width="640" height="480" codecs="vp8" mimeType="video/webm" startsWithSAP="1"></Representation>
</AdaptationSet>
<AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" bitstreamSwitching="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
<ContentComponent id="1" type="audio"/>
<SegmentTemplate timescale="1000" duration="2000" media="glass_$RepresentationID$_$Number$.chk" startNumber="1" initialization="glass_$RepresentationID$.hdr"/>
<Representation id="171" bandwidth="128000" audioSamplingRate="44100" codecs="vorbis" mimeType="audio/webm" startsWithSAP="1"></Representation>
</AdaptationSet>
</Period>
</MPD>
<script>
(function(){
// var url = "https://dash.akamaized.net/envivio/EnvivioDash3/manifest.mpd";
var url = "http://localhost:8081/videos/Dash/glass_live_manifest.mpd";
var player = dashjs.MediaPlayer().create();
// config
targetLatency = 2.0; // Lowering this value will lower latency but may decrease the player's ability to build a stable buffer.
minDrift = 0.05; // Minimum latency deviation allowed before activating catch-up mechanism.
catchupPlaybackRate = 0.5; // Maximum catch-up rate, as a percentage, for low latency live streams.
stableBuffer = 2; // The time that the internal buffer target will be set to post startup/seeks (NOT top quality).
bufferAtTopQuality = 2; // The time that the internal buffer target will be set to once playing the top quality.
player.updateSettings({
'streaming': {
'liveDelay': 2,
'liveCatchUpMinDrift': 0.05,
'liveCatchUpPlaybackRate': 0.5,
'stableBufferTime': 2,
'bufferTimeAtTopQuality': 2,
'bufferTimeAtTopQualityLongForm': 2,
'bufferToKeep': 2,
'bufferAheadToKeep': 2,
'lowLatencyEnabled': true,
'fastSwitchEnabled': true,
'abr': {
'limitBitrateByPortal': true
},
}
});
console.log(player.getSettings());
setInterval(() => {
console.log('Live latency= ', player.getCurrentLiveLatency());
console.log('Buffer length= ', player.getBufferLength('video'));
}, 3000);
player.initialize(document.querySelector("#videoPlayer"), url, true);
})();
</script>
{debug: {…}, streaming: {…}}
dash.all.min.js:2 XHR finished loading: GET "http://localhost:8081/videos/Dash/glass_live_manifest.mpd".
load @ dash.all.min.js:2
C @ dash.all.min.js:2
load @ dash.all.min.js:2
load @ dash.all.min.js:2
load @ dash.all.min.js:2
load @ dash.all.min.js:2
se @ dash.all.min.js:2
te @ dash.all.min.js:2
initialize @ dash.all.min.js:2
(anonymous) @ Dash:92
(anonymous) @ Dash:94
DevTools failed to load SourceMap: Could not parse content for http://localhost:8081/js/dash.all.min.js.map: Cannot read property 'length' of undefined
Dash:88 Live latency= NaN
Dash:89 Buffer length= NaN
Dash:88 Live latency= NaN
Dash:89 Buffer length= NaN
Dash:88 Live latency= NaN
Dash:89 Buffer length= NaN
Dash:88 Live latency= NaN
Dash:89 Buffer length= NaN
Dash:88 Live latency= NaN
Dash:89 Buffer length= NaN
好吧,一般来说,问题是mpd不能从/dash文件夹播放。所以我查看了一下代码,发现了一个错误的路由。无论如何,mpd不会从我使用的给定命令开始,可能是因为它创建了一个动态
清单,就像马库斯·舒曼所说的那样。所以我要用一个新的,现在看起来很有效,但不是很好。
ffmpeg -y -re -i strm.webm
-c:v libx264 -x264opts "keyint=24:min-keyint=24:no-scenecut"
-r 24 -c:a aac -b:a 128k -bf 1 -b_strategy 0 -sc_threshold 0 -pix_fmt yuv420p
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -b:v:0 250k
-filter:v:0 "scale=-2:240" -profile:v:0 baseline -b:v:1 750k
-filter:v:1 "scale=-2:480" -profile:v:1 main -b:v:2 1500k
-filter:v:2 "scale=-2:720" -profile:v:2 high
-use_timeline 1 -use_template 1 -window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a"
-f dash glass_video_manifest.mpd
您正在从一个文件创建一个实时短跑包,然后尝试从磁盘流式传输短跑包。所以你最终会得到一份显示“live”的破折号清单
<mpd
type="dynamic"
availabilityStartTime="2021-04-01T18:20:08Z"
虽然它不是活的。那就快跑吧。js在试图找到“流”的活动边缘时感到困惑。
如果您将属性从type=“dynamic”更改为type=“static”,并删除availabilityStartTime,您应该能够播放您的软件包。
一般来说:只有当你真的在直播时,才创建一个直播包。
我已经转码并剥离了mp4文件的音频,如下所示: $ffmpeg-编解码器:a libvo_aacenc-ar 44100-ac 1-编解码器:v libx264-配置文件:v基线-级别13-b:v 2000k直接/输出。mp4-我是导演/原著。mp4 $ffmpeg-i dir/out。mp4-一个目录/输出。mp4 我使用了以下MP4Box命令来生成mpd: $MP4Box-dash 30000
我想玩。iPhone应用程序中的mpd文件,为此我尝试了VLC播放器,但它没有按照预期工作,播放视频花费了太多时间。我还有其他选择吗。像Android中的exoplayer这样的mpd文件。 我已经为此目的实现了VLC媒体播放器,但现在我正在寻找另一种选择。如果有人对此有任何想法,请帮助。
所以我正在为我的MPEG-DASH视频生成一个非常简单的MPD清单文件,但我无法找出问题所在。这是我当前的清单文件 这个MPD文件使用我能找到的每个验证器进行验证。出于安全原因,这些段的URL被隐藏,但它们都是开放的、公开的,并且可以单独查看。但当我试图运行清单文件时,这取决于我得到的玩家。“在清单中找不到支持的源”,或者干脆什么都没发生。 你知道这怎么可能是错的吗?我目前正在使用媒体url作为绝
我已经使用ffmpeg为我的视频创建了一个MPD文件,我可以在我的电脑上播放和观看它,使用:http://dashplayer.azurewebsites.net/ 现在我想确保它在andoid和IOS上正常工作和播放,有人能告诉我如何在android和IOS上测试这个文件吗?
我是一名大学生,现在正在学习FFmpeg。 当我使用这个公式时,我发现一个现象。 1.帧率越高,视频播放速度越快。 2.帧率越慢,视频播放速度越快。 我希望无论帧率是多少,视频播放速度都是合适的。不要太快或太慢。
本文向大家介绍JS+html5制作简单音乐播放器,包括了JS+html5制作简单音乐播放器的使用技巧和注意事项,需要的朋友参考一下 本教程为大家分享了JS音乐播放器的具体代码,供大家参考,具体内容如下 1.HTML <audio> 标签定义声音,比如音乐或其他音频流。其主要属性有src:要播放的音频的 URL,controls:如果出现该属性,则向用户显示控件,比如播放按钮。 几个主要的标签如下: