[FFmpeg-user] YUV->RGB conversion. What is the default matrix used?

Mike Scheutzow mike.scheutzow at alcatel-lucent.com
Wed Jul 4 16:31:48 CEST 2012


Tim Nicholson wrote:
> Although we now have the "colormatrix" filter to convert between
> different YUV  colorspace standards it occurs to me that it is not clear
> what matrixing is used by default when converting between YUV and RGB.
> 
> A quick test using:-
> 
> ffmpeg -i bars-601.mov -t 1 -an -r 1 %04d-601.png
> 
> and an inspection of the resultant png shows RGB values of the bars to
> differ from the values expected if using the 601 matrix values, and even
> a grey scale has significant colour casting at certain levels.
> 
> So it begs the question, what coefficients are being used by default?

As near as I can tell from the code, and from the command:

   ./ffmpeg -i test.mov -vframes 1 out%d.png

the default colorspace for yuv->rgb conversion is:

   /* ITU-R Rec. 624-4 System B, G */

This is chosen in sws_getContext() in libswscale/utils.c.

I found no way to select a different colorspace from the ./ffmpeg 
command line.


Mike Scheutzow


More information about the ffmpeg-user mailing list