[FFmpeg-user] dpx to prores & h.264 - color shift

Andreas Hummel kazhadena at googlemail.com
Wed Oct 12 12:41:06 EEST 2016


Hi there,

i'm struggeling with the conversion from dpx files via ffmpeg to prores and
h.264 movie files on a windows machine. In the past days i read a lot about
the different flags and options but couldnt figure out what the 'best'
conversion technique is.
At the moment i'm getting a slight hue shift in the encoded videos and i
don't know where it's coming from. Probably i'm using too many options or
false flags but i thought, this list might give me a hint to solve the
problem at it's core.

Somehow i always get the color shift, regardless which options i try with
ffmpeg on the command line. The only way to obtain a 1:1 color
representation in a prores file was via Nuke from TheFoundry.

For h.264 i've got almost the same issue plus settle banding artefacts in
dark areas with a gradient. I tried to minimize the artefacts in the
gradient but couldn't find a suitable option yet.

Here you may find a comparison image:
http://www.directupload.net/file/d/4506/satnse88_jpg.htm

Full resolution can be found here:
http://uploaded.net/file/e02zd4ct

Zoom is at 100%. The left image shows a frame from the dpx sequence, 2nd is
the ffmpeg prores and 3rd picture shows a crop of my best attempt to encode
it with h264.

Or is that already the 'best' output i can get?

Thanks in advance for your help.

Cheers,
Andreas



My code looks like this:

###############################
PRORES:
ffmpeg.exe -y -f image2 -start_number 0 -r 25 -i INPUT_%8d.dpx -r 25
-vcodec prores_ks -profile:v 3 -pix_fmt yuv422p10le -filter_complex
"[0:v]lutrgb=r=gammaval(1/1.0):g=gammaval(1/1.0):b=gammaval(1/1.0),colormatrix=bt601:
bt709'" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -vendor
ap10 OUTPUT_prores3.mov


ffmpeg\x64\be1d324\bin\ffmpeg.exe -y -f image2 -start_number 0 -r 25 -i
INPUT_%8d.dpx -r 25 -vcodec prores_ks -profile:v 3 -pix_fmt yuv422p10le
-filter_complex
"[0:v]lutrgb=r=gammaval(1/1.0):g=gammaval(1/1.0):b=gammaval(1/1.0),colormatrix=bt601:
bt709'" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -vendor
ap10 OUTPUT_prores3.mov
ffmpeg version N-81872-gbe1d324 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 60.101 / 57. 60.101
  libavformat    57. 51.102 / 57. 51.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'INPUT_%8d.dpx':
  Duration: 00:01:04.48, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: dpx, gbrp10le, 1920x1080 [SAR 1:1 DAR 16:9], 25
tbr, 25 tbn, 25 tbc
Output #0, mov, to 'OUTPUT.mov':
  Metadata:
    encoder         : Lavf57.51.102
    Stream #0:0: Video: prores (prores_ks) (apch / 0x68637061),
yuv422p10le(bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps,
12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.60.101 prores_ks
Stream mapping:
  Stream #0:0 (dpx) -> lutrgb
  colormatrix -> Stream #0:0 (prores_ks)
Press [q] to stop, [?] for help
frame= 1612 fps=9.0 q=-0.0 Lsize= 1173941kB time=00:01:04.44
bitrate=149238.3kbits/s speed=0.358x
video:1173928kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.001109%

###############################
h.264:
ffmpeg.exe -y -probesize 5000000 -f image2 -start_number 0 -r 25 -i
INPUT_%8d.dpx -r 25 -vcodec libx264 -preset superfast -profile:v high
-level 4.2 -crf 9 -pix_fmt yuv420p -vf colormatrix=bt601:bt709
-color_primaries 1 -color_trc 1 -colorspace 1 -vendor ap10 OUTPUT.mov


ffmpeg\x64\be1d324\bin\ffmpeg.exe -y -probesize 5000000 -f image2
-start_number 0 -r 25 -i INPUT_%8d.dpx -r 25 -vcodec libx264 -preset
superfast -profile:v high -level 4.2 -crf 9 -pix_fmt yuv420p -vf
colormatrix=bt601:bt709 -color_primaries 1 -color_trc 1 -colorspace 1
-vendor ap10 OUTPUT.mov
ffmpeg version N-81872-gbe1d324 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 60.101 / 57. 60.101
  libavformat    57. 51.102 / 57. 51.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'INPUT_%8d.dpx':
  Duration: 00:01:04.48, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: dpx, gbrp10le, 1920x1080 [SAR 1:1 DAR 16:9], 25
tbr, 25 tbn, 25 tbc
Codec AVOption vendor (vendor ID) specified for output file #0 (OUTPUT.mov)
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.
[libx264 @ 0000000000e2c0a0] using SAR=1/1
[libx264 @ 0000000000e2c0a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000000e2c0a0] profile High, level 4.2
[libx264 @ 0000000000e2c0a0] 264 - core 148 r2721 72d53ab - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html -
options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=18
lookahead_threads=3 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=1 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=9.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00
Output #0, mov, to 'OUTPUT.mov':
  Metadata:
    encoder         : Lavf57.51.102
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(bt709),
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.60.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (dpx (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 1612 fps= 40 q=-1.0 Lsize=  475782kB time=00:01:04.36
bitrate=60559.4kbits/s speed=1.61x
video:475758kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.004930%
[libx264 @ 0000000000e2c0a0] frame I:26    Avg QP: 2.73  size:521104
[libx264 @ 0000000000e2c0a0] frame P:449   Avg QP: 4.18  size:394077
[libx264 @ 0000000000e2c0a0] frame B:1137  Avg QP: 5.93  size:260938
[libx264 @ 0000000000e2c0a0] consecutive B-frames:  5.0%  1.9%  2.8% 90.3%
[libx264 @ 0000000000e2c0a0] mb I  I16..4: 50.2% 19.8% 30.0%
[libx264 @ 0000000000e2c0a0] mb P  I16..4:  9.6%  9.2%  6.9%  P16..4:
46.1%  0.0%  0.0%  0.0%  0.0%    skip:28.3%
[libx264 @ 0000000000e2c0a0] mb B  I16..4:  3.7%  2.8%  0.8%  B16..8:
29.3%  0.0%  0.0%  direct:32.4%  skip:31.0%  L0:29.0% L1:26.2% BI:44.7%
[libx264 @ 0000000000e2c0a0] 8x8 transform intra:34.6% inter:50.2%
[libx264 @ 0000000000e2c0a0] coded y,uvDC,uvAC intra: 98.2% 98.9% 98.4%
inter: 59.8% 53.2% 46.9%
[libx264 @ 0000000000e2c0a0] i16 v,h,dc,p: 20%  8% 67%  4%
[libx264 @ 0000000000e2c0a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 13% 38%
7%  7%  5%  6%  5%  8%
[libx264 @ 0000000000e2c0a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 21% 14%
9%  8%  7%  8%  7% 11%
[libx264 @ 0000000000e2c0a0] i8c dc,h,v,p: 44% 16% 31%  9%
[libx264 @ 0000000000e2c0a0] Weighted P-Frames: Y:8.2% UV:4.0%
[libx264 @ 0000000000e2c0a0] kb/s:60443.67


More information about the ffmpeg-user mailing list