user12129980
user12129980

Reputation: 103

CRF/CQP is incompatible with 2pass. FFmpeg error

This is my command:

..\ffmpeg -y -i "D:\FFMPEG\ffmpeg-20200129-de1b2aa-win64-static\bin\test\aa_start_with_BAGAN.mp4" -c:v libx264 -preset ultrafast -maxrate 3000k -bufsize 6000k -g 50 -c:a aac -b:a 128k -ac 2 -ar 44100 -an -pass 1 -f mp4 NUL   && ..\ffmpeg -i "D:\FFMPEG\ffmpeg-20200129-de1b2aa-win64-static\bin\test\aa_start_with_BAGAN.mp4" -c:v libx264 -s 1280x720 -preset ultrafast -maxrate 500k -bufsize 1000k -vf "scale=1280:-1,format=yuv420p" -g 50 -c:a aac -b:a 128k -ac 2 -ar 44100 -an -pass 2 aa_start_with_BAGAN.mp4_ultrafast_500.mp4

in the output I get CRF/CQP is incompatible with 2pass, but I didnt use the cfr/-q option in the command at all, why do I get this error? Add the full metadata of FFMpeg maybe someone can help me with this? (-g 50 because the default fps is 25 base on the documentation)

`ffmpeg version git-2020-01-29-de1b2aa Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 38.100 / 56. 38.100
  libavcodec     58. 67.100 / 58. 67.100
  libavformat    58. 36.100 / 58. 36.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 71.100 /  7. 71.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\FFMPEG\ffmpeg-20200129-de1b2aa-win64-static\bin\test\aa_start_with_BAGAN.mp4':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V mp42isom
    creation_time   : 2018-04-24T18:21:09.000000Z
  Duration: 00:35:54.00, start: 0.000000, bitrate: 1057 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 929 kb/s, 25 fps, 25 tbr, 50k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2018-04-24T18:21:09.000000Z
      handler_name    : Mainconcept MP4 Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2018-04-24T18:21:09.000000Z
      handler_name    : Mainconcept MP4 Sound Media Handler
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (NUL) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000024ec2de0f80] using SAR=1/1
[libx264 @ 0000024ec2de0f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000024ec2de0f80] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
[libx264 @ 0000024ec2de0f80] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=50 keyint_min=5 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3000 vbv_bufsize=6000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, mp4, to 'NUL':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V mp42isom
    encoder         : Lavf58.36.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-04-24T18:21:09.000000Z
      handler_name    : Mainconcept MP4 Video Media Handler
      encoder         : Lavc58.67.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 3000000/0/0 buffer size: 6000000 vbv_delay: N/A
frame=53849 fps=999 q=-1.0 Lsize=  496489kB time=00:35:53.92 bitrate=1888.3kbits/s speed=39.9x
video:496266kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.044919%
[libx264 @ 0000024ec2de0f80] frame I:1077  Avg QP:20.39  size: 38800
[libx264 @ 0000024ec2de0f80] frame P:52772 Avg QP:23.39  size:  8838
[libx264 @ 0000024ec2de0f80] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0000024ec2de0f80] mb P  I16..4:  8.4%  0.0%  0.0%  P16..4: 51.8%  0.0%  0.0%  0.0%  0.0%    skip:39.8%
[libx264 @ 0000024ec2de0f80] coded y,uvDC,uvAC intra: 44.8% 54.5% 18.3% inter: 30.2% 22.0% 2.0%
[libx264 @ 0000024ec2de0f80] i16 v,h,dc,p: 39% 25% 16% 19%
[libx264 @ 0000024ec2de0f80] i8c dc,h,v,p: 35% 23% 24% 17%
[libx264 @ 0000024ec2de0f80] kb/s:1887.41
ffmpeg version git-2020-01-29-de1b2aa Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 38.100 / 56. 38.100
  libavcodec     58. 67.100 / 58. 67.100
  libavformat    58. 36.100 / 58. 36.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 71.100 /  7. 71.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\FFMPEG\ffmpeg-20200129-de1b2aa-win64-static\bin\test\aa_start_with_BAGAN.mp4':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V mp42isom
    creation_time   : 2018-04-24T18:21:09.000000Z
  Duration: 00:35:54.00, start: 0.000000, bitrate: 1057 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 929 kb/s, 25 fps, 25 tbr, 50k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2018-04-24T18:21:09.000000Z
      handler_name    : Mainconcept MP4 Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2018-04-24T18:21:09.000000Z
      handler_name    : Mainconcept MP4 Sound Media Handler
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (aa_start_with_BAGAN.mp4_ultrafast_500.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000013691fbda00] using SAR=3/4
[libx264 @ 0000013691fbda00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000013691fbda00] CRF/CQP is incompatible with 2pass.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!`

Upvotes: 3

Views: 2384

Answers (2)

Benjamin McGuire
Benjamin McGuire

Reputation: 11

You need to make sure that your bitrate shortening is in CAPS..

If it is lowercase, it will do that..

IE 4M instead of 4m, or 4000K instead of 4000k

Upvotes: 1

Gyan
Gyan

Reputation: 93291

If you don't set target bitrate -b:v, ffmpeg will default to CRF mode. maxrate and bufsize set VBV constraints and can be used with both bitrate and CRF modes.

For proper 2-pass encoding, all filters and encoding parameters should be same across both passes.

Upvotes: 5

Related Questions