Opened 12 years ago

Closed 11 years ago

#1611 closed defect (needs_more_info)

The colors change when converting bgr24 to yuv420p

Reported by: ff2012 Owned by:
Priority: normal Component: undetermined
Version: 0.11.1 Keywords: colors, bgr24, yuv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Similar to this ticket : http://ffmpeg.org/trac/ffmpeg/ticket/979

The colors change when converting bgr24 to yuv420p

TEST A - 1)) :

Input #0, flv, from 'source_flashsv_bgr24_720x480.flv':
Metadata:
encoder         : Lavf54.3.100
Duration: 00:00:15.03, start: 0.000000, bitrate: 80 kb/s
Stream #0:0: Video: flashsv, bgr24, 720x480, 200 kb/s, 1 tbr, 1k tbn, 1k tbc

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

TEST A - 2)) :
ffmpeg.exe -i source_flashsv_bgr24_720x480.flv -pix_fmt yuv420p -s 720x480 -vcodec libx264 -an output_x264_yuv420p_720x480.mp4

ffmpeg version N-43060-ga85b4a5 Copyright (c) 2000-2012 the FFmpeg developers  built on Jul 30 2012 13:14:08 with gcc 4.7.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --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      51. 66.100 / 51. 66.100
  libavcodec     54. 45.100 / 54. 45.100
  libavformat    54. 22.100 / 54. 22.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  5.101 /  3.  5.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, flv, from 'source_flashsv_bgr24_720x480.flv':
  Metadata:
    encoder         : Lavf54.3.100
  Duration: 00:00:15.03, start: 0.000000, bitrate: 80 kb/s
    Stream #0:0: Video: flashsv, bgr24, 720x480, 200 kb/s, 1 tbr, 1k tbn, 1k tbc

[libx264 @ 01d85e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE
4.2
[libx264 @ 01d85e00] profile High, level 2.2
[libx264 @ 01d85e00] 264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=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=6 lookahead_threads=1 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=1 
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 'output_x264_yuv420p_720x480.mp4':
  Metadata:
    encoder         : Lavf54.22.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x480, q=-1--1
, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (flashsv -> libx264)
Press [q] to stop, [?] for help
frame=   16 fps=0.0 q=17.0 Lsize=      44kB time=00:00:14.00 bitrate=  25.9kbits
/s dup=14 drop=0
video:43kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.228532%
[libx264 @ 01d85e00] frame I:1     Avg QP:12.63  size: 42981
[libx264 @ 01d85e00] frame P:4     Avg QP:15.77  size:    93
[libx264 @ 01d85e00] frame B:11    Avg QP:17.00  size:    27
[libx264 @ 01d85e00] consecutive B-frames:  6.3%  0.0% 18.8% 75.0%
[libx264 @ 01d85e00] mb I  I16..4: 56.2%  2.2% 41.6%
[libx264 @ 01d85e00] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  0.9%  0.0%  0.0%
 0.0%  0.0%    skip:99.0%
[libx264 @ 01d85e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.0%  0.0%
 direct: 0.0%  skip:99.7%  L0:45.1% L1:54.9% BI: 0.0%
[libx264 @ 01d85e00] 8x8 transform intra:2.2% inter:13.3%
[libx264 @ 01d85e00] coded y,uvDC,uvAC intra: 31.4% 43.3% 40.6% inter: 0.0% 0.2%
 0.0%
[libx264 @ 01d85e00] i16 v,h,dc,p: 83% 12%  4%  0%
[libx264 @ 01d85e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 49% 34% 14%  2%  0%  1%  0%
 0%  0%
[libx264 @ 01d85e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 33% 10%  3%  2%  3%  3%
 3%  4%
[libx264 @ 01d85e00] i8c dc,h,v,p: 54% 24% 22%  1%
[libx264 @ 01d85e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 01d85e00] ref P L0: 93.8%  0.0%  2.1%  4.2%
[libx264 @ 01d85e00] ref B L0: 73.9% 26.1%
[libx264 @ 01d85e00] ref B L1: 71.4% 28.6%
[libx264 @ 01d85e00] kb/s:21.83

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

TEST B - 1)) :

Input #0, flv, from 'source_flashsv_bgr24_720x480.flv':
Metadata:
encoder         : Lavf54.3.100
Duration: 00:00:15.03, start: 0.000000, bitrate: 80 kb/s
Stream #0:0: Video: flashsv, bgr24, 720x480, 200 kb/s, 1 tbr, 1k tbn, 1k tbc

TEST B - 2)) : [change the Size -s anyxany]
ffmpeg.exe -i source_flashsv_bgr24_720x480.flv -pix_fmt yuv420p -s 722x480 -vcodec libx264 -an output_x264_yuv420p_722x480.mp4

ffmpeg version N-43060-ga85b4a5 Copyright (c) 2000-2012 the FFmpeg developers  built on Jul 30 2012 13:14:08 with gcc 4.7.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --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      51. 66.100 / 51. 66.100
  libavcodec     54. 45.100 / 54. 45.100
  libavformat    54. 22.100 / 54. 22.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  5.101 /  3.  5.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, flv, from 'source_flashsv_bgr24_720x480.flv':
  Metadata:
    encoder         : Lavf54.3.100
  Duration: 00:00:15.03, start: 0.000000, bitrate: 80 kb/s
    Stream #0:0: Video: flashsv, bgr24, 720x480, 200 kb/s, 1 tbr, 1k tbn, 1k tbc

[libx264 @ 03d75e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE
4.2
[libx264 @ 03d75e00] profile High, level 2.2
[libx264 @ 03d75e00] 264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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=1 scenecu
t=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 'output_x264_yuv420p_722x480.mp4':
  Metadata:
    encoder         : Lavf54.22.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 722x480, q=-1--1
, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (flashsv -> libx264)
Press [q] to stop, [?] for help
frame=   16 fps=0.0 q=17.0 Lsize=      45kB time=00:00:14.00 bitrate=  26.6kbits
/s dup=14 drop=0
video:44kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.171479%
[libx264 @ 03d75e00] frame I:1     Avg QP:12.54  size: 44205
[libx264 @ 03d75e00] frame P:4     Avg QP:15.08  size:    83
[libx264 @ 03d75e00] frame B:11    Avg QP:17.00  size:    26
[libx264 @ 03d75e00] consecutive B-frames:  6.3%  0.0% 18.8% 75.0%
[libx264 @ 03d75e00] mb I  I16..4: 60.9%  2.0% 37.2%
[libx264 @ 03d75e00] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  0.7%  0.1%  0.1%
 0.0%  0.0%    skip:99.0%
[libx264 @ 03d75e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.0%  0.0%
 direct: 0.0%  skip:99.7%  L0:17.3% L1:82.7% BI: 0.0%
[libx264 @ 03d75e00] 8x8 transform intra:1.9% inter:76.5%
[libx264 @ 03d75e00] coded y,uvDC,uvAC intra: 33.2% 40.5% 37.7% inter: 0.0% 0.2%
 0.0%
[libx264 @ 03d75e00] i16 v,h,dc,p: 85% 11%  4%  0%
[libx264 @ 03d75e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 35% 24%  0%  0%  1%  1%
 0%  2%
[libx264 @ 03d75e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27%  9%  3%  3%  3%  3%
 3%  4%
[libx264 @ 03d75e00] i8c dc,h,v,p: 60% 20% 19%  1%
[libx264 @ 03d75e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 03d75e00] ref P L0: 94.7%  0.0%  3.2%  2.1%
[libx264 @ 03d75e00] ref B L0: 76.5% 11.8% 11.8%
[libx264 @ 03d75e00] ref B L1: 92.6%  7.4%
[libx264 @ 03d75e00] kb/s:22.41

Results)) :
source_flashsv_bgr24_orginalsize ==> output_x264_yuv420p_orginalsize (The colors change)

source_flashsv_bgr24_orginalsize ==> output_x264_yuv420p_anysize (The colors OK)

Attachments (4)

source_flashsv_bgr24_720x480.flv (17.5 KB ) - added by ff2012 12 years ago.
source_flashsv_bgr24_720x480
output_x264_yuv420p_720x480.mp4 (12.8 KB ) - added by ff2012 12 years ago.
output_x264_yuv420p_720x480
output_x264_yuv420p_722x480.mp4 (13.4 KB ) - added by ff2012 12 years ago.
output_x264_yuv420p_722x480
Compare_source_output.png (170.3 KB ) - added by ff2012 12 years ago.

Download all attachments as: .zip

Change History (6)

by ff2012, 12 years ago

source_flashsv_bgr24_720x480

by ff2012, 12 years ago

output_x264_yuv420p_720x480

by ff2012, 12 years ago

output_x264_yuv420p_722x480

by ff2012, 12 years ago

Attachment: Compare_source_output.png added

comment:1 by Carl Eugen Hoyos, 11 years ago

Is this also reproducible with the following commands?
$ ffmpeg -i source_flashsv_bgr24_720x480.flv -qscale 2 -an -vcodec mpeg4 out1.avi
$ ffmpeg -i source_flashsv_bgr24_720x480.flv -qscale 2 -an -vcodec mpeg4 -s 722x480 out2.avi

comment:2 by Elon Musk, 11 years ago

Resolution: needs_more_info
Status: newclosed

Conversion from rgb->yuv changes colors and can not be lossless.
Also 4 months passed and no feedback received.

Note: See TracTickets for help on using tickets.