[FFmpeg-user] RGB-YUV color shift

Tim Nicholson nichot20 at yahoo.com
Thu Oct 18 13:09:15 CEST 2012


On 18/10/12 00:03, George L.P. Fitz wrote:
> Hello,
> 
> I am seeing a slight color shift when using ffmpeg to encode to yuv based codecs like prores and v210 from an rgb source.  The resulting file has slightly more saturation and gamma than the original- it doesn't look way different, but there is enough of a difference to be noticed.  I'm assuming this has to do with the rgb->yuv colorspace conversion, since encoding from a yuv source to a yuv codec shows no perceivable color difference.  Has anyone run across this and if so, found a way to keep the color shift negligible?
> 

Although ffmpeg supports a number of colourspace definitions. Third
party applications that use the libs make use of these choices but not
currently ffmpeg*, it only ever uses its SWS_CS_DEFAULT which is set to
BT601/BT470BG/SMPTE170m etc etc. IF you are working with HD pictures you
really want BT709/SMPTE240.

So either you have to convert RGB->yuv the use the
"colormatrix" filter, which may lead to some concatenation/rounding
errors, or change the ffmpeg default to your required colourspace and
recompile.

> Here's a sample command:
> 
> ffmpeg -f rawvideo -pix_fmt rgb24 -s 1920x1080 -r 23.976 -i c3yoz4vuuy.video.raw -vcodec prores -profile 3 test.mov
> 
> Thanks for any help you can provide
> 
> -George
> [..]

* There is an advanced AVCodec option of "-colorspace" which ought to
allow setting of the required values (1 for 709 & 5 for 601) but the
last time I played with it it made no difference to the output....

-- 
Tim




More information about the ffmpeg-user mailing list