[FFmpeg-user] bgra to yuv

Josh long funkyirish at gmail.com
Thu Mar 29 23:55:07 CEST 2012


On Thu, Mar 29, 2012 at 1:21 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Josh long <funkyirish <at> gmail.com> writes:
>
> > When converting bgra to rgb24 ffmpeg messes up the colors.
>
> This sounds like a very important bug, please provide a
> command line and complete, uncut console output so I can
> reproduce the issue.
>
> Thank you, Carl Eugen
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>

For my 1920x1080 30fps file the following produces an rgb24 file with
messed up colors:

 ffmpeg -i 0_10_sec.avi -vcodec rawvideo -pix_fmt rgb24 0_10_secrgb..avi
ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar 16 2012 02:44:10 with gcc 4.6.1
  configuration: --enable-libschroedinger
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 4 / 53. 42. 4
  libavformat  53. 24. 2 / 53. 24. 2
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
Input #0, avi, from '0_10_sec.avi':
  Duration: 00:00:10.00, start: 0.000000, bitrate: 1990665 kb/s
    Stream #0:0: Video: rawvideo, bgra, 1920x1080, 30 tbr, 30 tbn, 30 tbc
[buffer @ 0x1e08c80] w:1920 h:1080 pixfmt:bgra tb:1/1000000 sar:0/1
sws_param:
[buffersink @ 0x1e01420] auto-inserting filter 'auto-inserted scale 0'
between the filter 'src' and the filter 'out'
[scale @ 0x1e01c20] w:1920 h:1080 fmt:bgra -> w:1920 h:1080 fmt:rgb24
flags:0x4
Output #0, avi, to '0_10_secrgb..avi':
  Metadata:
    ISFT            : Lavf53.24.2
    Stream #0:0: Video: rawvideo, rgb24, 1920x1080, q=2-31, 200 kb/s, 30
tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Press [q] to stop, [?] for help
frame=    9 fps=  0 q=0.0 size=   54681kB time=00:00:00.30
bitrate=1493145.2kbitframe=   17 fps= 16 q=0.0 size=  103281kB
time=00:00:00.56 bitrate=1493073.1kbitframe=   22 fps= 14 q=0.0 size=
 133656kB time=00:00:00.73 bitrate=1493056.5kbitframe=   27 fps= 13 q=0.0
size=  164031kB time=00:00:00.90 bitrate=1493044.3kbitframe=   31 fps= 12
q=0.0 size=  188331kB time=00:00:01.03 bitrate=1493038.3kbitframe=   34
fps= 10 q=0.0 size=  206556kB time=00:00:01.13 bitrate=1493034.4kbitframe=
  38 fps= 10 q=0.0 size=  230856kB time=00:00:01.26
bitrate=1493029.4kbitframe=   40 fps=  9 q=0.0 size=  243006kB
time=00:00:01.33 bitrate=1493028.3kbitframe=   43 fps=  8 q=0.0 size=
 261231kB time=00:00:01.43 bitrate=1493025.9kbitframe=   46 fps=  8 q=0.0
size=  279456kB time=00:00:01.53 bitrate=1493023.8kbitframe=   49 fps=  8
q=0.0 size=  297681kB time=00:00:01.63 bitrate=1493022.0kbitframe=   53
fps=  8 q=0.0 size=  321981kB time=00:00:01.76 bitrate=1493019.3kbitframe=
  56 fps=  8 q=0.0 size=  340206kB time=00:00:01.86
bitrate=1493018.0kbitframe=   59 fps=  7 q=0.0 size=  358431kB
time=00:00:01.96 bitrate=1493016.7kbitframe=   63 fps=  7 q=0.0 size=
 382731kB time=00:00:02.10 bitrate=1493015.5kbitframe=   66 fps=  7 q=0.0
size=  400956kB time=00:00:02.20 bitrate=1493014.5kbitframe=   69 fps=  7
q=0.0 size=  419181kB time=00:00:02.30 bitrate=1493013.6kbitframe=   72
fps=  7 q=0.0 size=  437406kB time=00:00:02.40 bitrate=1493012.8kbitframe=
  75 fps=  7 q=0.0 size=  455631kB time=00:00:02.50
bitrate=1493012.1kbitframe=   78 fps=  7 q=0.0 size=  473856kB
time=00:00:02.60 bitrate=1493011.4kbitframe=   81 fps=  7 q=0.0 size=
 492081kB time=00:00:02.70 bitrate=1493010.7kbitframe=   85 fps=  7 q=0.0
size=  516381kB time=00:00:02.83 bitrate=1493010.1kbitframe=   88 fps=  7
q=0.0 size=  534606kB time=00:00:02.93 bitrate=1493009.6kbitframe=   91
fps=  6 q=0.0 size=  552831kB time=00:00:03.03 bitrate=1493009.0kbitframe=
  94 fps=  6 q=0.0 size=  571056kB time=00:00:03.13
bitrate=1493008.6kbitframe=   96 fps=  6 q=0.0 size=  583206kB
time=00:00:03.20 bitrate=1493008.1kbitframe=  100 fps=  6 q=0.0 size=
 607506kB time=00:00:03.33 bitrate=1493007.7kbitframe=  103 fps=  6 q=0.0
size=  625731kB time=00:00:03.43 bitrate=1493007.3kbitframe=  106 fps=  6
q=0.0 size=  643956kB time=00:00:03.53 bitrate=1493006.9kbitframe=  108
fps=  6 q=0.0 size=  656106kB time=00:00:03.60 bitrate=1493006.5kbitframe=
 112 fps=  6 q=0.0 size=  680406kB time=00:00:03.73
bitrate=1493006.2kbitframe=  115 fps=  6 q=0.0 size=  698631kB
time=00:00:03.83 bitrate=1493005.9kbitframe=  118 fps=  6 q=0.0 size=
 716856kB time=00:00:03.93 bitrate=1493005.6kbitframe=  121 fps=  6 q=0.0
size=  735081kB time=00:00:04.03 bitrate=1493005.3kbitframe=  124 fps=  6
q=0.0 size=  753307kB time=00:00:04.13 bitrate=1493005.0kbitframe=  127
fps=  6 q=0.0 size=  771532kB time=00:00:04.23 bitrate=1493004.8kbitframe=
 130 fps=  6 q=0.0 size=  789757kB time=00:00:04.33
bitrate=1493004.5kbitframe=  133 fps=  6 q=0.0 size=  807982kB
time=00:00:04.43 bitrate=1493004.3kbitframe=  136 fps=  6 q=0.0 size=
 826207kB time=00:00:04.53 bitrate=1493004.0kbitframe=  139 fps=  6 q=0.0
size=  844432kB time=00:00:04.63 bitrate=1493003.8kbitframe=  142 fps=  6
q=0.0 size=  862657kB time=00:00:04.73 bitrate=1493003.6kbitframe=  144
fps=  6 q=0.0 size=  874807kB time=00:00:04.80 bitrate=1493003.4kbitframe=
 147 fps=  6 q=0.0 size=  893032kB time=00:00:04.90
bitrate=1493003.2kbitframe=  149 fps=  6 q=0.0 size=  905182kB
time=00:00:04.96 bitrate=1493003.0kbitframe=  151 fps=  6 q=0.0 size=
 917332kB time=00:00:05.03 bitrate=1493003.0kbitframe=  155 fps=  6 q=0.0
size=  941632kB time=00:00:05.16 bitrate=1493002.6kbitframe=  158 fps=  6
q=0.0 size=  959857kB time=00:00:05.26 bitrate=1493002.4kbitframe=  160
fps=  6 q=0.0 size=  972007kB time=00:00:05.33 bitrate=1493002.5kbitframe=
 164 fps=  6 q=0.0 size=  996307kB time=00:00:05.46
bitrate=1493002.1kbitframe=  168 fps=  6 q=0.0 size= 1020607kB
time=00:00:05.60 bitrate=1493002.0kbitframe=  171 fps=  6 q=0.0 size=
1038832kB time=00:00:05.70 bitrate=1493001.9kbitframe=  174 fps=  6 q=0.0
size= 1057061kB time=00:00:05.80 bitrate=1493007.6kbitframe=  177 fps=  6
q=0.0 size= 1075286kB time=00:00:05.90 bitrate=1493007.3kbitframe=  180
fps=  6 q=0.0 size= 1093511kB time=00:00:06.00 bitrate=1493007.1kbitframe=
 184 fps=  6 q=0.0 size= 1117811kB time=00:00:06.13
bitrate=1493006.9kbitframe=  188 fps=  6 q=0.0 size= 1142111kB
time=00:00:06.26 bitrate=1493006.5kbitframe=  191 fps=  6 q=0.0 size=
1160336kB time=00:00:06.36 bitrate=1493006.3kbitframe=  193 fps=  6 q=0.0
size= 1172486kB time=00:00:06.43 bitrate=1493006.3kbitframe=  196 fps=  6
q=0.0 size= 1190711kB time=00:00:06.53 bitrate=1493006.1kbitframe=  199
fps=  6 q=0.0 size= 1208936kB time=00:00:06.63 bitrate=1493005.9kbitframe=
 202 fps=  6 q=0.0 size= 1227161kB time=00:00:06.73
bitrate=1493005.7kbitframe=  205 fps=  6 q=0.0 size= 1245386kB
time=00:00:06.83 bitrate=1493005.6kbitframe=  208 fps=  5 q=0.0 size=
1263611kB time=00:00:06.93 bitrate=1493005.4kbitframe=  211 fps=  5 q=0.0
size= 1281836kB time=00:00:07.03 bitrate=1493005.2kbitframe=  214 fps=  5
q=0.0 size= 1300061kB time=00:00:07.13 bitrate=1493005.1kbitframe=  217
fps=  5 q=0.0 size= 1318286kB time=00:00:07.23 bitrate=1493004.9kbitframe=
 220 fps=  5 q=0.0 size= 1336511kB time=00:00:07.33
bitrate=1493004.8kbitframe=  223 fps=  5 q=0.0 size= 1354736kB
time=00:00:07.43 bitrate=1493004.6kbitframe=  226 fps=  5 q=0.0 size=
1372961kB time=00:00:07.53 bitrate=1493004.5kbitframe=  228 fps=  5 q=0.0
size= 1385111kB time=00:00:07.60 bitrate=1493004.3kbitframe=  232 fps=  5
q=0.0 size= 1409411kB time=00:00:07.73 bitrate=1493004.2kbitframe=  235
fps=  5 q=0.0 size= 1427636kB time=00:00:07.83 bitrate=1493004.1kbitframe=
 238 fps=  5 q=0.0 size= 1445862kB time=00:00:07.93
bitrate=1493004.0kbitframe=  241 fps=  5 q=0.0 size= 1464087kB
time=00:00:08.03 bitrate=1493003.8kbitframe=  244 fps=  5 q=0.0 size=
1482312kB time=00:00:08.13 bitrate=1493003.7kbitframe=  246 fps=  5 q=0.0
size= 1494462kB time=00:00:08.20 bitrate=1493003.6kbitframe=  249 fps=  5
q=0.0 size= 1512687kB time=00:00:08.30 bitrate=1493003.5kbitframe=  252
fps=  5 q=0.0 size= 1530912kB time=00:00:08.40 bitrate=1493003.3kbitframe=
 255 fps=  5 q=0.0 size= 1549137kB time=00:00:08.50
bitrate=1493003.2kbitframe=  258 fps=  5 q=0.0 size= 1567362kB
time=00:00:08.60 bitrate=1493003.1kbitframe=  261 fps=  5 q=0.0 size=
1585587kB time=00:00:08.70 bitrate=1493003.0kbitframe=  264 fps=  5 q=0.0
size= 1603812kB time=00:00:08.80 bitrate=1493002.9kbitframe=  267 fps=  5
q=0.0 size= 1622037kB time=00:00:08.90 bitrate=1493002.8kbitframe=  270
fps=  5 q=0.0 size= 1640262kB time=00:00:09.00 bitrate=1493002.7kbitframe=
 273 fps=  5 q=0.0 size= 1658487kB time=00:00:09.10
bitrate=1493002.6kbitframe=  275 fps=  5 q=0.0 size= 1670637kB
time=00:00:09.16 bitrate=1493002.5kbitframe=  278 fps=  5 q=0.0 size=
1688862kB time=00:00:09.26 bitrate=1493002.4kbitframe=  281 fps=  5 q=0.0
size= 1707087kB time=00:00:09.36 bitrate=1493002.3kbitframe=  284 fps=  5
q=0.0 size= 1725312kB time=00:00:09.46 bitrate=1493002.2kbitframe=  287
fps=  5 q=0.0 size= 1743537kB time=00:00:09.56 bitrate=1493002.1kbitframe=
 289 fps=  5 q=0.0 size= 1755687kB time=00:00:09.63
bitrate=1493002.2kbitframe=  293 fps=  5 q=0.0 size= 1779987kB
time=00:00:09.76 bitrate=1493002.0kbitframe=  296 fps=  5 q=0.0 size=
1798212kB time=00:00:09.86 bitrate=1493001.9kbitframe=  299 fps=  5 q=0.0
size= 1816437kB time=00:00:09.96 bitrate=1493001.8kbitframe=  300 fps=  5
q=0.0 Lsize= 1822513kB time=00:00:10.00 bitrate=1493002.7kbits/s
video:1822500kB audio:0kB global headers:0kB muxing overhead 0.000715%

these commands in order produce an rgb24 file with the correct colors:

ffmpeg -i 0bgra0.avi -vcodec rawvideo -pix_fmt rgba -q 0 0rgba0.avi
ffmpeg -i 0rgba0.avi -vcodec rawvideo -pix_fmt rgb24 -q 0 0240.avi

also this command morphs the video into a nine segment copy of the
original, with some wierd color changes in each one.

ffmpeg -i 0240.avi -vcodec rawvideo -pix_fmt yuv444p -q 0 04440.avi


More information about the ffmpeg-user mailing list