![将帧合并到视频中时出现 ffmpeg 错误消息](https://linux22.com/image/1516405/%E5%B0%86%E5%B8%A7%E5%90%88%E5%B9%B6%E5%88%B0%E8%A7%86%E9%A2%91%E4%B8%AD%E6%97%B6%E5%87%BA%E7%8E%B0%20ffmpeg%20%E9%94%99%E8%AF%AF%E6%B6%88%E6%81%AF.png)
我正在使用 ffmpeg 将帧列表收集到视频中。我以前在这方面取得了很大的成功,但现在执行命令时遇到错误ffmpeg -i %d.jpg -c:v huffyuv test.avi
:
ffmpeg version 3.2-2~bpo8+2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr --extra-version='2~bpo8+2' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-libtesseract --disable-stripping --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-opengl --enable-sdl2 --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-openal --enable-frei0r --enable-libopencv --enable-libx264 --enable-chromaprint --enable-shared
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
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
Input #0, image2, from '%d.jpg':
Duration: 00:00:00.84, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1537x673 [SAR 1:1 DAR 1537:673], 25 fps, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x7f627174a2c0] deprecated pixel format used, make sure you did set range correctly
[huffyuv @ 0x7f62717821c0] Width must be even for this colorspace.
[huffyuv @ 0x7f627173b5e0] ff_frame_thread_encoder_init failed
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> huffyuv (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
我注意到错误消息包含Width must be even for this colorspace.
我不确定这实际上意味着什么,所有框架都有相同的尺寸
答案1
但我不确定这到底意味着什么
上面写的1537
是奇数。你可以裁剪掉一列像素。
ffmpeg -i %d.jpg -vf crop=1536:673:0:0 -c:v huffyuv test.avi
这里删除了最右边的像素列。将裁剪中的第三个值更改为1
删除最左边的列。为了避免裁剪,您必须将视频保存为 RGB。
ffmpeg -i %d.jpg -pix_fmt rgb24 -c:v huffyuv test.avi
但这无助于提高你的压缩效率。