[FFmpeg-user] 422 to 420 H264 : the chroma is not good

Alexandre Fressenon alexandre at fressenon.com
Fri Sep 11 15:37:31 CEST 2015


Hi all,
I have a chroma problem with a conversion.

As input I have 2 files : 422 Uncompressed (yuv) or AppleProRes 422 (yuv), and I want to create a new file with H264 420 (yuv).

But when I try to convert the sources from 422 to 420 I still have a problem with the chroma, and this elements is very important for me.
The problem is not the H264 because if I already have a 420 uncompressed, the conversion is perfect, but my input is a 422, and QuickTime can't read a H264 422, so the final file has to be a H264 420…

I know some software can create a H264 / 420 with the same chroma, and I would like do this part with ffmpeg.

Here is my code : 
ffmpeg  -i input.mov  -c:a copy   -vcodec libx264  -preset slow  -b:v 16000k  -pix_fmt yuv420p  output.mov

Log : 

ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.2 : mono
Guessed Channel Layout for  Input Stream #0.3 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-09-08 16:17:26
  Duration: 00:00:59.84, start: 0.000000, bitrate: 1107459 kb/s
    Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le(bt709), 1920x1080, 1105920 kb/s, SAR 10001:10000 DAR 10001:5625, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Linux Alias Data Handler
      encoder         : 10 bit packed YUV 4:2:2 (v210)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      rotate          : 0
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Libquicktime Time Code Media Handler
      reel_name       : untitled
      timecode        : 00:00:00:00
    Stream #0:2(eng): Audio: pcm_s16be (lpcm / 0x6D63706C), 48000 Hz, 1 channels, s16, 768 kb/s (default)
    Metadata:
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Linux Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s16be (lpcm / 0x6D63706C), 48000 Hz, 1 channels, s16, 768 kb/s (default)
    Metadata:
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Linux Alias Data Handler
File 'output.mov' already exists. Overwrite ? [y/N] y
[libx264 @ 0x7fe2ca054e00] using SAR=1/1
[libx264 @ 0x7fe2ca054e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x7fe2ca054e00] profile High, level 5.0
[libx264 @ 0x7fe2ca054e00] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=16000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mov @ 0x7fe2ca054200] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mov, to 'output.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf56.36.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 10001:10000 DAR 10001:5625], q=-1--1, 16000 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Linux Alias Data Handler
      timecode        : 00:00:00:00
      encoder         : Lavc56.41.100 libx264
    Stream #0:1(eng): Audio: pcm_s16be (lpcm / 0x6D63706C), 48000 Hz, mono, 768 kb/s (default)
    Metadata:
      creation_time   : 2015-09-08 16:17:26
      handler_name    : Linux Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (v210 (native) -> h264 (libx264))
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1496 fps= 11 q=-1.0 Lsize=  104317kB time=00:00:59.84 bitrate=14280.9kbits/s    
video:98670kB audio:5610kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.035188%
[libx264 @ 0x7fe2ca054e00] frame I:22    Avg QP: 9.67  size:407475
[libx264 @ 0x7fe2ca054e00] frame P:382   Avg QP:11.72  size:117933
[libx264 @ 0x7fe2ca054e00] frame B:1092  Avg QP:13.27  size: 43061
[libx264 @ 0x7fe2ca054e00] consecutive B-frames:  1.7%  0.9%  6.2% 91.2%
[libx264 @ 0x7fe2ca054e00] mb I  I16..4: 12.9% 74.5% 12.6%
[libx264 @ 0x7fe2ca054e00] mb P  I16..4:  1.0%  6.9%  0.7%  P16..4: 30.9% 23.2% 17.3%  0.0%  0.0%    skip:20.0%
[libx264 @ 0x7fe2ca054e00] mb B  I16..4:  0.2%  2.1%  0.1%  B16..8: 38.6% 10.3%  3.4%  direct: 4.4%  skip:40.9%  L0:45.9% L1:44.0% BI:10.1%
[libx264 @ 0x7fe2ca054e00] final ratefactor: 12.06
[libx264 @ 0x7fe2ca054e00] 8x8 transform intra:81.1% inter:63.1%
[libx264 @ 0x7fe2ca054e00] direct mvs  spatial:96.9% temporal:3.1%
[libx264 @ 0x7fe2ca054e00] coded y,uvDC,uvAC intra: 95.3% 98.0% 95.1% inter: 30.1% 20.6% 7.5%
[libx264 @ 0x7fe2ca054e00] i16 v,h,dc,p: 32%  1% 15% 52%
[libx264 @ 0x7fe2ca054e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13%  8% 21%  8% 10%  9% 11%  9% 10%
[libx264 @ 0x7fe2ca054e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  7%  8% 10% 14% 12% 14% 12% 13%
[libx264 @ 0x7fe2ca054e00] i8c dc,h,v,p: 66%  9% 12% 14%
[libx264 @ 0x7fe2ca054e00] Weighted P-Frames: Y:1.6% UV:0.5%
[libx264 @ 0x7fe2ca054e00] ref P L0: 46.5%  8.2% 27.5%  9.0%  8.3%  0.5%  0.0%
[libx264 @ 0x7fe2ca054e00] ref B L0: 65.2% 25.6%  7.2%  2.0%
[libx264 @ 0x7fe2ca054e00] ref B L1: 91.8%  8.2%
[libx264 @ 0x7fe2ca054e00] kb/s:13507.74 


More information about the ffmpeg-user mailing list