gpt4 book ai didi

ffmpeg - 通过 DASH 进行 WebM 直播

转载 作者:行者123 更新时间:2023-12-04 22:59:58 25 4
gpt4 key购买 nike

我按照指示here尝试通过 DASH 使 WebM 直播。我的输入来自 Axis 相机,它以 h264 编码流式传输。我正在使用节点来启动 ffmpeg 进程。我能够创建 .hdr 文件和 .chk 文件。 .mpd 文件甚至已创建,但它是空的,我收到一条错误消息:

Could not write header for output file #0 (incorrect codec parameters ?): Operation not permittedStream mapping: Stream #0:0 -> #0:0 (copy)

这是我的所有代码:
var express = require('express');
spawn = require('child_process').spawn;

var app = express();

app.use(express.static(__dirname + '/public'));

app.listen(8080);
console.log("Running on Port 8080");

var ffmpeg1 = spawn('ffmpeg', [
'-y',
//video
'-i', 'rtsp://admin:password@192.168.1.54:554/axis-media/media.amp?videocodec=h264&resolution=1280x720',

'-map', '0:0',
'-pix_fmt', 'yuv420p',
'-color_range', '2',
'-c:v', 'libvpx-vp9',

'-s', '1280x720',
'-keyint_min', '25',
'-g', '25',

// //VP9_LIVE_PARAMS
'-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',

'-f', 'webm_chunk',
'-header', 'public/glass_360.hdr',
'-chunk_start_index', '1',
'public/glass_360_%d.chk',
]);


setTimeout(()=> {
var ffmpeg2 = spawn('ffmpeg', [
'-y',
'-f', 'webm_dash_manifest',
'-live', '1',
'-i', 'public/glass_360.hdr',
'-c', 'copy',
'-map', '0',
'-r', '25',
'-framerate', '25',

'-f', 'webm_dash_manifest',
'-live', '1',

'-adaptation_sets', '"id=0,streams=0"',
'-chunk_start_index', '1',
'-chunk_duration_ms', '2000',
'-time_shift_buffer_depth', '7200',
'-minimum_update_period', '7200',

'public/glass_live_manifest.mpd'
]);
ffmpeg2.stdout.on('data',
function (data) {
console.log('ff2std: ' + data);
}
);

ffmpeg2.stderr.on('data',
function (data) {
console.log('ff2err: ' + data);
}
);
}, 5000);

ffmpeg1.stdout.on('data',
function (data) {
console.log('ff1std: ' + data);
}
);

ffmpeg1.stderr.on('data',
function (data) {
console.log('ff1err: ' + data);
}
);

这是我的所有输出:
Running on Port 8080
ff1err: ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-nonfree --enable-vda

ff1err: libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100

ff1err: Input #0, rtsp, from 'rtsp://admin:password@192.168.1.54:554/axis-media/media.amp?videocodec=h264&resolution=1280x720':
Metadata:
title : Session streamed with GStreamer
comment : rtsp-server
Duration: N/A, start: 0.033344
ff1err: , bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 180k tbc

ff1err: [swscaler @ 0x7f8df281bc00] deprecated pixel format used, make sure you did set range correctly

ff1err: [libvpx-vp9 @ 0x7f8df2800600] v1.6.1

ff1err: Output #0, webm_chunk, to 'public/glass_360_%d.chk':
Metadata:
title : Session streamed with GStreamer
comment : rtsp-server
encoder : Lavf57.56.101

ff1err: Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.64.101 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help

ff1err: frame= 10 fps=0.0 q=0.0 size=N/A time=00:00:00.36 bitrate=N/A speed=0.71x
ff1err: frame= 25 fps= 25 q=0.0 size=N/A time=00:00:00.96 bitrate=N/A speed=0.946x
ff1err: frame= 40 fps= 26 q=0.0 size=N/A time=00:00:01.56 bitrate=N/A speed=1.03x
ff1err: frame= 55 fps= 27 q=0.0 size=N/A time=00:00:02.16 bitrate=N/A speed=1.07x
ff1err: frame= 70 fps= 28 q=0.0 size=N/A time=00:00:02.76 bitrate=N/A speed=1.09x
ff1err: frame= 85 fps= 28 q=0.0 size=N/A time=00:00:03.36 bitrate=N/A speed=1.11x
ff2err: ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-nonfree --enable-vda

ff2err: libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100

ff2err: [webm_dash_manifest @ 0x7fbc5b80b400] Could not find codec parameters for stream 0 (Video: vp9, none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options

ff2err: Input #0, webm_dash_manifest, from 'public/glass_360.hdr':
Metadata:
title : Session streamed with GStreamer
encoder : Lavf57.56.101
Duration: N/A, bitrate: N/A
Stream #0:0: Video: vp9, none, 1280x720
ff2err: , SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
webm_dash_manifest_file_name: glass_360.hdr
webm_dash_manifest_track_number: 1

ff2err: Could not write header for output file #0 (incorrect codec parameters ?): Operation not permittedStream mapping:
Stream #0:0 -> #0:0 (copy)

ff2err: Last message repeated 1 times

ff1err: frame= 101 fps= 29 q=0.0 size=N/A time=00:00:04.00 bitrate=N/A speed=1.13x
ff1err: frame= 116 fps= 29 q=0.0 size=N/A time=00:00:04.60 bitrate=N/A speed=1.14x
ff1err: frame= 131 fps= 29 q=0.0 size=N/A time=00:00:05.20 bitrate=N/A speed=1.15x
ff1err: frame= 146 fps= 29 q=0.0 size=N/A time=00:00:05.80 bitrate=N/A speed=1.15x
ff1err: frame= 161 fps= 29 q=0.0 size=N/A time=00:00:06.40 bitrate=N/A speed=1.15x
ff1err: frame= 177 fps= 29 q=0.0 size=N/A time=00:00:07.04 bitrate=N/A speed=1.16x
ff1err: frame= 192 fps= 29 q=0.0 size=N/A time=00:00:07.64 bitrate=N/A speed=1.16x
ff1err: frame= 207 fps= 29 q=0.0 size=N/A time=00:00:08.24 bitrate=N/A speed=1.16x
ff1err: frame= 222 fps= 29 q=0.0 size=N/A time=00:00:08.84 bitrate=N/A speed=1.17x
ff1err: frame= 237 fps= 29 q=0.0 size=N/A time=00:00:09.44 bitrate=N/A speed=1.17x
ff1err: frame= 252 fps= 29 q=0.0 size=N/A time=00:00:10.04 bitrate=N/A speed=1.17x

为什么 ffmpeg 创建一个空的 .mpd 文件?

最佳答案

我认为来自 ffmpeg 的错误与您传递的输出参数有关,或者您正在写入访问 protected 目录,例如/var/www/

检查您的输出参数并使用 sudo 进行尝试。

/home/tilak/bin/ffmpeg -f webm_dash_manifest -live 1 -i/var/www/webm_live/glass_360.hdr -vcodec libvpx -map 0 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0"- chunk_start_index 1 -chunk_duration_ms 2000/var/www/html/glass_live_manifest.mpd

上面的命令在我的例子中创建 MPD 文件。

关于ffmpeg - 通过 DASH 进行 WebM 直播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42427582/

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