![ffmpeg 使用片段时不会开始录制](https://linux22.com/image/1488145/ffmpeg%20%E4%BD%BF%E7%94%A8%E7%89%87%E6%AE%B5%E6%97%B6%E4%B8%8D%E4%BC%9A%E5%BC%80%E5%A7%8B%E5%BD%95%E5%88%B6.png)
我在 Debian Wheezy 下安装了 ffmpeg,并尝试在 24 小时内以每小时为一个时间段记录办公室周围的几个摄像机。
当我输入以下命令时,它可以毫无问题地记录下来;
ffmpeg -f mjpeg -i http://<user>:<pass>@192.168.200.220/video/mjpg.cgi -acodec copy -vcodec copy ~/data/temp.mp4
当我尝试以下命令(其中包含片段)时,它不会开始录制。
ffmpeg -f mjpeg -i http://<user>:<pass>@192.168.200.220/video/mjpg.cgi -acodec copy -vcodec copy -y -f segment -segment_time 3600 -segment_wrap 24 ~/data/temp%03d.mp4
这是完整的错误;
ffmpeg version 1.0.10 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 25 2014 07:50:40 with gcc 4.7 (Debian 4.7.2-5)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libfdk-aac --enable-libdc1394 --disable-altivec --dis libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
max_analyze_duration 5000000 reached at 5000000
[mjpeg @ 0x1750e60] Estimating duration from bitrate, this may be inaccurate
Input #0, mjpeg, from 'http://<user>:<password>@192.168.200.220/video/mjpg.cgi':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 25 tbc
Output #0, segment, to '/home/map7/data/temp3.mp4':
Output file #0 does not contain any stream
Received signal 2: terminating.
我尝试了不同的 max_analyze_duration 设置,但没有成功
更新
尝试使用 ffmpeg 3.0
这有效
docker run jrottenberg/ffmpeg -i http://<user>:<pass>@192.168.200.220/video/mjpg.cgi -f mjpeg - > /media/data/temp%03d.mp4
我也使各个部分的工作变得更好一些,但是又遇到了另一个问题;
docker run -v /media/data:/data jrottenberg/ffmpeg -i http://:@192.168.200.220/video/mjpg.cgi -f fragment -segment_time 5 -segment_wrap 24 /data/temp%03d.mpeg
我现在遇到以下问题;
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=39 size=343ate=N/A speed=0.153x
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=229 size=332te=N/A speed=0.152x
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=1323 size=13091N/A speed=0.151x
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=3352 size=13091
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=5393 size=13091
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=7434 size=13091
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=9475 size=13091
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=11516 size=13091
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=457 size=536te=N/A speed=0.151x
[mpeg @ 0x2fea340] buffer underflow st=0 bufi=81 size=270ate=N/A speed=0.15x
^C[mpeg @ 0x2fea340] VBV buffer size not set, using default size of 130KB15x
If you want the mpeg file to be compliant to some specification
但它现在确实输出了一些东西。