Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3028 closed defect (fixed)

broken conversion yuv444p to bgr24/rgb24

Reported by: mike Owned by:
Priority: normal Component: swscale
Version: git-master Keywords: yuv444p
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I found that capturing game and recording with OBS lossless x264 yuv444p then converting it with ffmpeg to rgb24 huffyuv or other codec i losing color information, with some test i found that problem lies in ffmpeg converse yuv444p to rgb24/bgr24 (trying do the same with avisynth script gives me colours the same as in game, doing with ffmpeg gives not)

for reproduce that problem i'll bring something simpler , yuv444p should cover all rgb24 colors so doing convert to yuv444p and back to rgb24/bgr24 should be visual the same, but it is not, i attached 2 samples sc1.bmp and sc2.bmp

ffmpeg -loglevel verbose -i sc1.bmp -vf [in]format=yuv444p,format=bgr24[out] out.bmp
ffmpeg version N-56793-g01e3340 Copyright (c) 2000-2013 the FFmpeg developers

built on Sep 30 2013 18:07:49 with gcc 4.8.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab

le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 52. 46.100 / 52. 46.100
libavcodec 55. 33.101 / 55. 33.101
libavformat 55. 18.104 / 55. 18.104
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 88.100 / 3. 88.100
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100

Input #0, image2, from 'sc1.bmp':

Duration: 00:00:00.04, start: 0.000000, bitrate: N/A

Stream #0:0: Video: bmp, bgr24, 182x188, 25 tbr, 25 tbn, 25 tbc

File 'out.bmp' already exists. Overwrite ? [y/N] y
[graph 0 input from stream 0:0 @ 00000000027978a0] w:182 h:188 pixfmt:bgr24 tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto-inserted scaler 0 @ 0000000004614400] w:iw h:ih flags:'0x4' interl:0
[Parsed_format_0 @ 0000000004628d60] auto-inserting filter 'auto-inserted scaler 0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_fo
rmat_0'
[auto-inserted scaler 1 @ 00000000046146a0] w:iw h:ih flags:'0x4' interl:0
[Parsed_format_1 @ 0000000002796c60] auto-inserting filter 'auto-inserted scaler 1' between the filter 'Parsed_format_0' and the filter 'Parsed_format_1'
[auto-inserted scaler 0 @ 0000000004614400] w:182 h:188 fmt:bgr24 sar:0/1 -> w:182 h:188 fmt:yuv444p sar:0/1 flags:0x4
[auto-inserted scaler 1 @ 00000000046146a0] w:182 h:188 fmt:yuv444p sar:0/1 -> w:182 h:188 fmt:bgr24 sar:0/1 flags:0x4
Output #0, image2, to 'out.bmp':

Metadata:

encoder : Lavf55.18.104
Stream #0:0: Video: bmp, bgr24, 182x188, q=2-31, 200 kb/s, 90k tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (bmp -> bmp)

Press [q] to stop, ? for help
No more output streams to write to, finishing.
frame= 1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:101kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.021343%

Attachments (4)

sc1.bmp (100.7 KB ) - added by mike 11 years ago.
sc2.bmp (29.3 KB ) - added by mike 11 years ago.
compare.png (26.1 KB ) - added by mike 11 years ago.
zoomed compare input/output
compare2.png (55.9 KB ) - added by mike 11 years ago.
zoomed input output second sample

Download all attachments as: .zip

Change History (7)

by mike, 11 years ago

Attachment: sc1.bmp added

by mike, 11 years ago

Attachment: sc2.bmp added

by mike, 11 years ago

Attachment: compare.png added

zoomed compare input/output

by mike, 11 years ago

Attachment: compare2.png added

zoomed input output second sample

comment:1 by Michael Niedermayer, 11 years ago

Component: avformatswscale
Reproduced by developer: set
Resolution: invalid
Status: newclosed

you need "-sws_flags full_chroma_int"
and yes it probably should use that by default in the yuv444->rgb case ..

comment:2 by mike, 11 years ago

i didn't know that flag , thank , with that flag i got correct results , i hope they will do it default for that case

comment:3 by Carl Eugen Hoyos, 11 years ago

Resolution: invalidfixed

Michael fixed this in a830915b

Note: See TracTickets for help on using tickets.