Estou tentando codificar um arquivo com mpeg4 usando ffmpeg
no Windows e isso funciona bem:
ffmpeg.exe -y -i input.avi -c:v mpeg4 -q:v 3 -s 640x448 output.avi
A menos que eu tente codificar usando duas passagens:
ffmpeg.exe -y -i input.avi -c:v mpeg4 -q:v 3 -s 640x448 -pass 1 -an -f avi NUL
ffmpeg.exe -y -i input.avi -c:v mpeg4 -q:v 3 -s 640x448 -pass 2 output.avi
A primeira passagem está bem, mas a segunda passagem gera um erro:
Input #0, matroska,webm, from 'input.avi':
Metadata:
encoder : libebml-0.7.5 & libmatroska-0.7.7
creation_time : 2012-05-28T14:59:33.000000Z
Duration: 00:01:11.40, start: 0.000000, bitrate: 2101 kb/s
Stream #0:0(eng): Video: vp8 (VP80 / 0x30385056), yuv420p(progressive), 1280x896, SAR 1:1 DAR 10:7, 15 fps, 15 tbr, 1k
tbn, 1k tbc (default)
Stream #0:1(eng): Audio: vorbis, 22050 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (vp8 (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (vorbis (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[mpeg4 @ 000001d795b8f5c0] requested bitrate is too low
Por que isso só é um problema quando tento codificar com duas passagens?
Log Completo da primeira passagem:
ffmpeg version 2021-03-21-git-75fd3e1519-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontc
onfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enab
le-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enabl
e-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enabl
e-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable
-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm -
-enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-
libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --en
able-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwb
enc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --
enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chr
omaprint
libavutil 56. 71.100 / 56. 71.100
libavcodec 58.135.100 / 58.135.100
libavformat 58. 77.100 / 58. 77.100
libavdevice 58. 14.100 / 58. 14.100
libavfilter 7.111.100 / 7.111.100
libswscale 5. 10.100 / 5. 10.100
libswresample 3. 10.100 / 3. 10.100
libpostproc 55. 10.100 / 55. 10.100
Input #0, matroska,webm, from 'input.avi':
Metadata:
encoder : libebml-0.7.5 & libmatroska-0.7.7
creation_time : 2012-05-28T14:59:33.000000Z
Duration: 00:01:11.40, start: 0.000000, bitrate: 2101 kb/s
Stream #0:0(eng): Video: vp8 (VP80 / 0x30385056), yuv420p(progressive), 1280x896, SAR 1:1 DAR 10:7, 15 fps, 15 tbr, 1k
tbn, 1k tbc (default)
Stream #0:1(eng): Audio: vorbis, 22050 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (vp8 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'NUL':
Metadata:
ISFT : Lavf58.77.100
Stream #0:0(eng): Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(tv, bt470bg/unknown/unknown, progressive), 640x448 [SAR 1:
1 DAR 10:7], q=2-31, 200 kb/s, 15 fps, 15 tbn (default)
Metadata:
encoder : Lavc58.135.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame= 1071 fps=719 q=3.0 Lsize= 13267kB time=00:01:11.40 bitrate=1522.1kbits/s speed=47.9x
video:13236kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.236026%
Log completo da segunda passagem:
ffmpeg version 2021-03-21-git-75fd3e1519-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontc
onfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enab
le-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enabl
e-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enabl
e-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable
-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm -
-enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-
libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --en
able-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwb
enc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --
enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chr
omaprint
libavutil 56. 71.100 / 56. 71.100
libavcodec 58.135.100 / 58.135.100
libavformat 58. 77.100 / 58. 77.100
libavdevice 58. 14.100 / 58. 14.100
libavfilter 7.111.100 / 7.111.100
libswscale 5. 10.100 / 5. 10.100
libswresample 3. 10.100 / 3. 10.100
libpostproc 55. 10.100 / 55. 10.100
Input #0, matroska,webm, from 'input.avi':
Metadata:
encoder : libebml-0.7.5 & libmatroska-0.7.7
creation_time : 2012-05-28T14:59:33.000000Z
Duration: 00:01:11.40, start: 0.000000, bitrate: 2101 kb/s
Stream #0:0(eng): Video: vp8 (VP80 / 0x30385056), yuv420p(progressive), 1280x896, SAR 1:1 DAR 10:7, 15 fps, 15 tbr, 1k
tbn, 1k tbc (default)
Stream #0:1(eng): Audio: vorbis, 22050 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (vp8 (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (vorbis (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[mpeg4 @ 000001d795b8f5c0] requested bitrate is too low
Use
-b:v
, não-q:v
/-qscale:v
se você quiser realizar várias passagens.De um dos desenvolvedores do FFmpeg:
A taxa de bits solicitada é muito baixa, ao usar o qscale VBR