[FFmpeg-trac] #3409(undetermined:reopened): Impossible to transcode full range RGB videos with libx264, and keep full range + proper colors

FFmpeg trac at avcodec.org
Fri Feb 28 22:00:36 CET 2014


#3409: Impossible to transcode full range RGB videos with libx264, and keep full
range + proper colors
-------------------------------------+-------------------------------------
             Reporter:  mzso         |                    Owner:
                 Type:  defect       |                   Status:  reopened
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by mzso):

 Replying to [comment:15 cehoyos]:
 > Do you test the final output file visually (with a media player) or with
 another method?


 I tested visually by alternating between images. As it turns out there was
 an issue with the renderer too which is now fixed. So I re-did the
 comparisons. The difference is more subtle. But the ffmpeg output is
 definitely wrong.
 Source and encode with x264 and avisynth(indistinguishable):
 http://screenshotcomparison.com/comparison/64762

 Source and encode with ffmpeg(color abnormalities):
 http://screenshotcomparison.com/comparison/64764

 Encode with ffmpeg using avisynth (way too dark):
 http://abload.de/img/yuv-ffmpeg-crf0-avisyijra0.png
 (No matter what I tried the output stayed like this)

 == Avisynth script: ==
 FFVideoSource("e:\Videó Felvételek\motor2.avi")
 ConvertToYV24(matrix="PC.709")

 == Command line 1: ==
 E:\Videó Felvételek>x264 --input-range PC --fps 30 -force-cfr --preset
 slower --crf 0 --output-csp i444 --range PC --demuxer y4m -o
 x264_lossless.mkv "E:\Videó Felvételek\pc709.avs"
 x264 [error]: invalid argument: deblock = orce-cfr

 E:\Videó Felvételek>x264 --input-range PC --fps 30 --force-cfr --preset
 slower --crf 0 --output-csp i444 --range PC --colormatrix bt709
 --colorprim bt709 -o x264_lossless.mkv "E:\Videó Felvételek\pc709.avs"
 avs [info]: 1600x1200p 0:0 @ 3998/143 fps (cfr)
 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
 SlowShuffle
 x264 [info]: profile High 4:4:4 Predictive, level 5.0, 4:4:4 8-bit
 x264 [info]: frame I:7     Avg QP: 0.00  size:695602
 x264 [info]: frame P:213   Avg QP: 0.00  size:395907
 x264 [info]: mb I  I16..4: 56.2% 23.3% 20.5%
 x264 [info]: mb P  I16..4:  6.9%  1.8%  1.6%  P16..4: 29.5%  6.9% 13.5%
 0.0%  0.2%    skip:39.5%
 x264 [info]: 8x8 transform intra:19.1% inter:36.7%
 x264 [info]: coded y,u,v intra: 82.6% 66.4% 56.4% inter: 53.0% 52.7% 46.1%
 x264 [info]: i16 v,h,dc,p: 36% 62%  2%  0%
 x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 40% 29%  1%  2%  2%  1%
 0%  0%
 x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 34%  6%  4% 11%  7%  4%
 3%  2%
 x264 [info]: Weighted P-Frames: Y:23.5% UV:16.4%
 x264 [info]: ref P L0: 69.7%  2.3% 13.4%  5.2%  3.7%  2.3%  1.6%  0.9%
 0.9%  0.0%
 x264 [info]: kb/s:97306.31

 encoded 220 frames, 1.58 fps, 97306.93 kb/s


 == Command line 2: ==
 E:\Videó Felvételek>ffmpeg -i "E:\Videó Felvételek\motor2.avi" -an -vcodec
 libx264 -preset slower -crf 0 -pix_fmt yuvj444p -x264opts
 "colorprim=bt709:transfer=bt709:colormatrix=bt709" yuv-ffmpeg.mkv
 ffmpeg version N-60813-g44b22bb Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Feb 22 2014 03:11:45 with gcc 4.8.2 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libcaca --enable-libfreetype --enable-l
 ibgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-
 libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
 --enable-libopus --enable-librtmp --enable-libschroedinger --enable-
 libsoxr --enable-libspeex --enable-libtheora -
 -enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-
 libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack
 --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
 --enable-zlib
   libavutil      52. 65.100 / 52. 65.100
   libavcodec     55. 52.102 / 55. 52.102
   libavformat    55. 33.100 / 55. 33.100
   libavdevice    55. 10.100 / 55. 10.100
   libavfilter     4.  1.103 /  4.  1.103
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 17.104 /  0. 17.104
   libpostproc    52.  3.100 / 52.  3.100
 Guessed Channel Layout for  Input Stream #0.1 : stereo
 Input #0, avi, from 'E:\Vide+- Felv+ętelek\motor2.avi':
   Duration: 00:00:07.87, start: 0.000000, bitrate: 291034 kb/s
     Stream #0:0: Video: utvideo (ULRG / 0x47524C55), rgb24, 1600x1200, 30
 fps, 30 tbr, 30 tbn, 30 tbc
     Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz,
 stereo, s16, 1411 kb/s
 [swscaler @ 03ff88a0] deprecated pixel format used, make sure you did set
 range correctly
 [libx264 @ 040d06c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
 SlowShuffle
 [libx264 @ 040d06c0] profile High 4:4:4 Predictive, level 5.0, 4:4:4 8-bit
 [libx264 @ 040d06c0] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
 - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options:
 cabac=1 ref=8 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=0
 mixed_ref=1 me_range=16 chroma_me=1 trelli
 s=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0
 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2
 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 r
 c=cqp mbtree=0 qp=0
 Output #0, matroska, to 'yuv-ffmpeg.mkv':
   Metadata:
     encoder         : Lavf55.33.100
     Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj444p,
 1600x1200, q=-1--1, 1k tbn, 30 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (utvideo -> libx264)
 Press [q] to stop, [?] for help
 frame=  220 fps=1.6 q=-1.0 Lsize=   88422kB time=00:00:07.86
 bitrate=92086.6kbits/s
 video:88420kB audio:0kB subtitle:0 data:0 global headers:0kB muxing
 overhead 0.002805%
 [libx264 @ 040d06c0] frame I:7     Avg QP: 0.00  size:705491
 [libx264 @ 040d06c0] frame P:213   Avg QP: 0.00  size:401890
 [libx264 @ 040d06c0] mb I  I16..4: 54.2% 24.7% 21.1%
 [libx264 @ 040d06c0] mb P  I16..4:  6.8%  1.9%  1.6%  P16..4: 29.3%  7.0%
 13.5%  0.0%  0.2%    skip:39.6%
 [libx264 @ 040d06c0] 8x8 transform intra:20.1% inter:39.4%
 [libx264 @ 040d06c0] coded y,u,v intra: 83.9% 67.4% 58.1% inter: 52.9%
 52.6% 47.0%
 [libx264 @ 040d06c0] i16 v,h,dc,p: 35% 63%  2%  0%
 [libx264 @ 040d06c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 43% 27%  1%  2%
 2%  1%  0%  0%
 [libx264 @ 040d06c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 35%  6%  4% 11%
 6%  4%  3%  2%
 [libx264 @ 040d06c0] Weighted P-Frames: Y:23.5% UV:16.9%
 [libx264 @ 040d06c0] ref P L0: 68.1%  2.6% 14.4%  5.3%  3.7%  2.4%  1.6%
 0.9%  0.9%  0.0%
 [libx264 @ 040d06c0] kb/s:92075.64


 == Command line 3: ==
 E:\Videó Felvételek>ffmpeg -i "E:\Videó Felvételek\pc709.avs" -an -vcodec
 libx264 -preset slower -crf 0 -pix_fmt yuvj444p -x264opts
 "colorprim=bt709:transfer=bt709:colormatrix=bt709" yuv-ffmpeg-avs.mkv
 ffmpeg version N-60813-g44b22bb Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Feb 22 2014 03:11:45 with gcc 4.8.2 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libcaca --enable-libfreetype --enable-l
 ibgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-
 libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
 --enable-libopus --enable-librtmp --enable-libschroedinger --enable-
 libsoxr --enable-libspeex --enable-libtheora -
 -enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-
 libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack
 --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
 --enable-zlib
   libavutil      52. 65.100 / 52. 65.100
   libavcodec     55. 52.102 / 55. 52.102
   libavformat    55. 33.100 / 55. 33.100
   libavdevice    55. 10.100 / 55. 10.100
   libavfilter     4.  1.103 /  4.  1.103
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 17.104 /  0. 17.104
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, avisynth, from 'E:\Vide+- Felv+ętelek\pc709.avs':
   Duration: 00:00:07.87, start: 0.000000, bitrate: 0 kb/s
     Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p, 1600x1200,
 27.96 fps, 27.96 tbr, 27.96 tbn, 27.96 tbc
 [swscaler @ 040288a0] deprecated pixel format used, make sure you did set
 range correctly
 [libx264 @ 02a8c480] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
 SlowShuffle
 [libx264 @ 02a8c480] profile High 4:4:4 Predictive, level 5.0, 4:4:4 8-bit
 [libx264 @ 02a8c480] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
 - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options:
 cabac=1 ref=8 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=0
 mixed_ref=1 me_range=16 chroma_me=1 trelli
 s=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0
 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2
 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 r
 c=cqp mbtree=0 qp=0
 Output #0, matroska, to 'yuv-ffmpeg-avs.mkv':
   Metadata:
     encoder         : Lavf55.33.100
     Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj444p,
 1600x1200, q=-1--1, 1k tbn, 27.96 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> libx264)
 Press [q] to stop, [?] for help
 frame=  220 fps=1.6 q=-1.0 Lsize=   81741kB time=00:00:07.86
 bitrate=85096.7kbits/s
 video:81739kB audio:0kB subtitle:0 data:0 global headers:0kB muxing
 overhead 0.003007%
 [libx264 @ 02a8c480] frame I:6     Avg QP: 0.00  size:759384
 [libx264 @ 02a8c480] frame P:214   Avg QP: 0.00  size:369831
 [libx264 @ 02a8c480] mb I  I16..4: 49.7% 31.6% 18.7%
 [libx264 @ 02a8c480] mb P  I16..4:  9.9%  2.3%  1.2%  P16..4: 28.4%  5.3%
 10.7%  0.0%  0.2%    skip:41.9%
 [libx264 @ 02a8c480] 8x8 transform intra:19.8% inter:38.6%
 [libx264 @ 02a8c480] coded y,u,v intra: 35.7% 84.0% 67.9% inter: 31.8%
 48.7% 43.5%
 [libx264 @ 02a8c480] i16 v,h,dc,p: 76% 23%  1%  0%
 [libx264 @ 02a8c480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 22% 66%  0%  1%
 1%  0%  0%  0%
 [libx264 @ 02a8c480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 36%  7%  3% 10%
 7%  4%  2%  2%
 [libx264 @ 02a8c480] Weighted P-Frames: Y:20.6% UV:15.4%
 [libx264 @ 02a8c480] ref P L0: 68.4%  7.3%  9.9%  5.0%  3.3%  2.3%  1.6%
 0.8%  1.3%  0.2%
 [libx264 @ 02a8c480] kb/s:85094.27

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3409#comment:16>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list