Converting linear colors to SRGB shows banding in FFmpeg

Posted by user1863947 on Super User See other posts from Super User or by user1863947
Published on 2012-12-03T16:22:12Z Indexed on 2012/12/03 17:08 UTC
Read the original article Hit count: 711

Filed under:
|
|

When I convert an EXR file sequence with x264 using FFmpeg and convert the colorspace from linear to SRGB (with gamma 0.45454545) I get some heavy banding issues (most visible on a dark gradient).

Here is the ffmpeg command I use:

C:/ffmpeg.exe -y -i C:/seq_v001.%04d.exr -vf lutrgb=r=gammaval(0.45454545):g=gammaval(0.45454545):b=gammaval(0.45454545) -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -r 25 C:/out.mov

Here is the output:

ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 25 2012 12:25:21 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  9.100 / 52.  9.100
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.102 /  3. 23.102
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
Input #0, image2, from 'C:/seq_v001.%04d.exr':
  Duration: 00:00:09.60, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: exr, rgb48le, 960x540 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0000000004d11540] using SAR=1/1
[libx264 @ 0000000004d11540] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 0000000004d11540] profile High, level 3.1
[libx264 @ 0000000004d11540] 264 - core 128 r2216 198a7ea - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=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=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=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'C:/out.mov':
  Metadata:
    encoder         : Lavf54.37.100
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 12800 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (exr -> libx264)
Press [q] to stop, [?] for help
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
frame=   16 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/s    
Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
frame=   34 fps= 33 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/s    
Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
frame=   52 fps= 34 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/s    
Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
frame=   68 fps= 34 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/s    
Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
frame=   85 fps= 33 q=23.0 size=      47kB time=00:00:00.44 bitrate= 867.5kbits/s    
Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
frame=  104 fps= 34 q=23.0 size=      94kB time=00:00:01.20 bitrate= 640.3kbits/s    
Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
frame=  121 fps= 34 q=23.0 size=     133kB time=00:00:01.88 bitrate= 577.8kbits/s    
Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
frame=  139 fps= 34 q=23.0 size=     172kB time=00:00:02.60 bitrate= 543.4kbits/s    
Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
frame=  157 fps= 34 q=23.0 size=     213kB time=00:00:03.32 bitrate= 525.6kbits/s    
Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
frame=  175 fps= 34 q=23.0 size=     254kB time=00:00:04.04 bitrate= 516.0kbits/s    
Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
frame=  193 fps= 35 q=23.0 size=     287kB time=00:00:04.76 bitrate= 494.6kbits/s    
Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
frame=  211 fps= 35 q=23.0 size=     332kB time=00:00:05.48 bitrate= 496.4kbits/s    
Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
[exr @ 000000000dffa660] Found more than one compression attribute
[exr @ 000000000dffaaa0] Found more than one compression attribute
[exr @ 000000000dffaf00] Found more than one compression attribute
[exr @ 000000000dffb340] Found more than one compression attribute
[exr @ 000000000dffb7a0] Found more than one compression attribute
[exr @ 000000000dffbbe0] Found more than one compression attribute
[exr @ 000000000dffc040] Found more than one compression attribute
[exr @ 000000000dff8c40] Found more than one compression attribute
[exr @ 000000000dff90c0] Found more than one compression attribute
[exr @ 000000000dff9520] Found more than one compression attribute
[exr @ 000000000dff9960] Found more than one compression attribute
[exr @ 000000000dff9dc0] Found more than one compression attribute
[exr @ 000000000dffa200] Found more than one compression attribute
frame=  228 fps= 34 q=23.0 size=     421kB time=00:00:06.16 bitrate= 559.8kbits/s    
frame=  240 fps= 32 q=-1.0 Lsize=     708kB time=00:00:09.52 bitrate= 609.3kbits/s    

video:705kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.505636%
[libx264 @ 0000000004d11540] frame I:2     Avg QP:15.07  size: 18186
[libx264 @ 0000000004d11540] frame P:73    Avg QP:16.51  size:  3719
[libx264 @ 0000000004d11540] frame B:165   Avg QP:18.38  size:  2502
[libx264 @ 0000000004d11540] consecutive B-frames:  2.5%  3.3% 42.5% 51.7%
[libx264 @ 0000000004d11540] mb I  I16..4: 46.2% 33.3% 20.4%
[libx264 @ 0000000004d11540] mb P  I16..4:  6.8%  2.0%  0.6%  P16..4: 29.4% 10.5%  4.6%  0.0%  0.0%    skip:46.1%
[libx264 @ 0000000004d11540] mb B  I16..4:  1.8%  0.7%  0.2%  B16..8: 40.9%  6.5%  0.3%  direct: 1.2%  skip:48.5%  L0:52.0% L1:47.5% BI: 0.5%
[libx264 @ 0000000004d11540] 8x8 transform intra:24.7% inter:81.3%
[libx264 @ 0000000004d11540] direct mvs  spatial:93.3% temporal:6.7%
[libx264 @ 0000000004d11540] coded y,uvDC,uvAC intra: 10.7% 31.4% 24.9% inter: 2.3% 9.0% 2.9%
[libx264 @ 0000000004d11540] i16 v,h,dc,p: 83% 11%  6%  1%
[libx264 @ 0000000004d11540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9%  9% 52%  6%  4%  4%  5%  5%  5%
[libx264 @ 0000000004d11540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 11% 44%  5%  4%  3%  3%  4%  3%
[libx264 @ 0000000004d11540] i8c dc,h,v,p: 69% 15% 15%  2%
[libx264 @ 0000000004d11540] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004d11540] ref P L0: 48.9%  0.1% 16.8% 17.0% 11.3%  5.8%
[libx264 @ 0000000004d11540] ref B L0: 57.7% 21.9% 13.9%  6.4%
[libx264 @ 0000000004d11540] ref B L1: 82.4% 17.6%
[libx264 @ 0000000004d11540] kb/s:600.61

For me it looks like it converts the video first and afterwards applies the gamma correction on 8-bit clipped video.

Does someone have an idea?

© Super User or respective owner

Related posts about ffmpeg

  • how to install ffmpeg in cpanel

    as seen on Super User - Search for 'Super User'
    i'm using dedicated server(linux) so i need to install ffmpeg in cpanel so here ffmpeg i found in Main Software Install a Perl Module but i writing script in php so how can i install ffmpeg phpperl when i'am trying to install ffmpeg in perl module i get this response Checking C compiler… >>> More

  • FFMpeg-PHP Installation Error

    as seen on Server Fault - Search for 'Server Fault'
    While installing FFmpeg-PHP, I got this interesting error: /usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function 'zim_ffmpeg_movie_getAudioStreamId': /usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1051: error: 'CODEC_TYPE_AUDIO' undeclared (first use in this function) /usr/downloads/ffmpeg-php-0… >>> More

  • git problems installing stuff [closed]

    as seen on Super User - Search for 'Super User'
    root@Frenzen:~# cd root@Frenzen:~# git clone --depth 1 git://source.ffmpeg.org/ffmpeg Initialized empty Git repository in /root/ffmpeg/.git/ root@Frenzen:~# cd root@Frenzen:~# git clone --depth 1 git://source.ffmpeg.org/ffmpeg Initialized empty Git repository in /root/ffmpeg/.git/ root@Frenzen:~#… >>> More

  • Unable to install ffmpeg-php

    as seen on Server Fault - Search for 'Server Fault'
    I followed the instructions on http://www.mysql-apache-php.com/ffmpeg-install.htm but ffmpeg-php does not show up in my phpinfo() The commands I ran (in order) #yum install ffmpeg ffmpeg-devel ... Public key for faac-1.26-1.el5.rf.x86_64.rpm is not installed #rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0… >>> More

  • Unable to install ffmpeg-php

    as seen on Server Fault - Search for 'Server Fault'
    Hi, I followed the instructions on http://www.mysql-apache-php.com/ffmpeg-install.htm but ffmpeg-php does not show up in my phpinfo() The commands I ran (in order) #yum install ffmpeg ffmpeg-devel ... Public key for faac-1.26-1.el5.rf.x86_64.rpm is not installed #rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0… >>> More

Related posts about video-conversion