Opened 5 years ago

Closed 5 years ago

#585 closed defect (invalid)

libx264 enc doesn't autoselect compatible pix fmt so returns error

Reported by: MattE Owned by: michael
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi,

When I tried to compress an uncompressed avi file with ffmpeg using the latest zeranoe exe it failed with this error: Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height. However, the same command works with a two month old exe (also from zeranoe).

The problem is obvious that in the older version this line appears: Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yuv420p'. While in the new version it doesn't consequently, the newer version tries to open libx264 with bgr24 which is incompatible with libx264. I'm not sure what other checks it misses in the new version.

Full output below.

Command:

C:\FFmpeg Video Converter - x64\data\ffmpeg.exe -i "D:\Logs\R43\CondD1\Trial1\DcondR43C1T1CamB.avi"  -profile high -vcodec libx264  -noy  -an -threads 0 "C:\Logs\DcondR43C1T1CamB.mp4"

Older exe output (working):

ffmpeg version N-32138-g312645e, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 28 2011 21:15:09 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil    51. 14. 0 / 51. 14. 0
  libavcodec   53. 12. 0 / 53. 12. 0
  libavformat  53. 10. 0 / 53. 10. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 35. 0 /  2. 35. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[avi @ 000000000039F5A0] parser not found for codec rawvideo, packets or times may be invalid.
Input #0, avi, from 'D:\Logs\R43\CondD1\Trial1\DcondR43C1T1CamB.avi':
  Metadata:
    encoder         : Lavf53.10.0
  Duration: 00:00:31.49, start: 0.000000, bitrate: 220970 kb/s
    Stream #0.0: Video: rawvideo, bgr24, 640x480, 29.97 tbr, 29.97 tbn, 29.97 tbc
Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 00000000019BE940] w:640 h:480 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 00000000019D2B80] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 00000000019C9540] w:640 h:480 fmt:bgr24 -> w:640 h:480 fmt:yuv420p flags:0x4
[libx264 @ 000000000039DE20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 000000000039DE20] profile High, level 3.0
[libx264 @ 000000000039DE20] 264 - core 116 r2044 392e762 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'C:\Logs\DcondR43C1T1CamB.mp4':
  Metadata:
    encoder         : Lavf53.10.0
    Stream #0.0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 640x480, q=2-31, 2997 tbn, 29.97 tbc
Stream mapping:
  Stream #0.0 -> #0.0: rawvideo -> libx264
Press [q] to stop, [?] for help
frame=   82 fps=  7 q=29.0 size=      99kB time=00:00:00.80 bitrate=1017.3kbits/s    
frame=  172 fps= 15 q=29.0 size=     293kB time=00:00:03.80 bitrate= 631.8kbits/s    
frame=  277 fps= 23 q=29.0 size=     512kB time=00:00:07.30 bitrate= 573.6kbits/s    
frame=  368 fps= 29 q=29.0 size=     787kB time=00:00:10.34 bitrate= 623.5kbits/s    
frame=  471 fps= 36 q=29.0 size=    1018kB time=00:00:13.78 bitrate= 605.4kbits/s    
frame=  535 fps= 28 q=29.0 size=    1165kB time=00:00:15.91 bitrate= 599.4kbits/s    
frame=  625 fps= 32 q=29.0 size=    1415kB time=00:00:18.91 bitrate= 612.7kbits/s    
frame=  719 fps= 36 q=29.0 size=    1616kB time=00:00:22.05 bitrate= 600.2kbits/s    
frame=  795 fps= 29 q=29.0 size=    1783kB time=00:00:24.59 bitrate= 594.0kbits/s    
frame=  885 fps= 32 q=29.0 size=    2050kB time=00:00:27.59 bitrate= 608.6kbits/s    
frame=  944 fps= 34 q=-1.0 Lsize=    2322kB time=00:00:31.43 bitrate= 605.2kbits/s    

video:2307kB audio:0kB global headers:0kB muxing overhead 0.672759%
frame I:4     Avg QP:22.87  size: 38653
[libx264 @ 000000000039DE20] frame P:323   Avg QP:25.00  size:  5818
[libx264 @ 000000000039DE20] frame B:617   Avg QP:28.52  size:   531
[libx264 @ 000000000039DE20] consecutive B-frames:  0.7%  4.9% 94.4%  0.0%
[libx264 @ 000000000039DE20] mb I  I16..4:  5.5% 70.6% 23.8%
[libx264 @ 000000000039DE20] mb P  I16..4:  0.0%  0.1%  0.0%  P16..4: 56.0%  9.8%  9.8%  0.0%  0.0%    skip:24.2%
[libx264 @ 000000000039DE20] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 36.5%  0.3%  0.0%  direct: 0.2%  skip:63.0%  L0:68.8% L1:29.7% BI: 1.5%
[libx264 @ 000000000039DE20] 8x8 transform intra:72.0% inter:67.0%
[libx264 @ 000000000039DE20] coded y,uvDC,uvAC intra: 90.4% 87.2% 59.8% inter: 8.8% 20.1% 1.2%
[libx264 @ 000000000039DE20] i16 v,h,dc,p: 34% 12%  7% 47%
[libx264 @ 000000000039DE20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 16% 16%  5%  8%  9%  6%  7%  9%
[libx264 @ 000000000039DE20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 13% 10%  7% 10% 11%  9%  8%  9%
[libx264 @ 000000000039DE20] i8c dc,h,v,p: 56% 23% 17%  4%
[libx264 @ 000000000039DE20] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000039DE20] ref P L0: 35.2%  6.3% 42.2% 16.3%
[libx264 @ 000000000039DE20] ref B L0: 33.4% 46.3% 20.4%
[libx264 @ 000000000039DE20] ref B L1: 58.8% 41.2%
[libx264 @ 000000000039DE20] kb/s:599.74

Latest ffmpeg output:

ffmpeg version N-33818-gd049257, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 19 2011 23:06:04 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil    51. 22. 0 / 51. 22. 0
  libavcodec   53. 22. 0 / 53. 22. 0
  libavformat  53. 17. 0 / 53. 17. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 44. 1 /  2. 44. 1
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[avi @ 0000000001EDD840] parser not found for codec rawvideo, packets or times may be invalid.
Input #0, avi, from 'D:\Logs\R43\CondD1\Trial1\DcondR43C1T1CamB.avi':
  Metadata:
    encoder         : Lavf53.10.0
  Duration: 00:00:31.49, start: 0.000000, bitrate: 220970 kb/s
    Stream #0:0: Video: rawvideo, bgr24, 640x480, 29.97 tbr, 29.97 tbn, 29.97 tbc
[buffer @ 0000000000347810] w:640 h:480 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
x264 [error]: high profile doesn't support 4:4:4
[libx264 @ 00000000042019D0] Error setting profile high.
Output #0, mp4, to 'C:\Logs\DcondR43C1T1CamB.mp4':
  Metadata:
    encoder         : Lavf53.10.0
    Stream #0:0: Video: h264, bgr24, 640x480, q=-1--1, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (rawvideo -> libx264)
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

M

Change History (1)

comment:1 Changed 5 years ago by llogan

  • Component changed from FFmpeg to avcodec
  • Resolution set to invalid
  • Status changed from new to closed

Remove -profile high or change it to -profile high444 if you want bgr24, or add -pix_fmt yuv420 if you want yuv420.

This is the default behavior of x264 if you attempt to use 4:4:4 input with high profile:

$ x264 --output-csp rgb --profile high -o output.mkv input.mkv
x264 [error]: high profile doesn't support 4:4:4

Please reopen this ticket if you believe the default behavior of FFmpeg should be changed.

Version 0, edited 5 years ago by llogan (next)
Note: See TracTickets for help on using tickets.