[FFmpeg-user] The internal ffmpeg rgb=>yuv pipeline and conversion matrices

Peter Rabbitson rabbit+list at rabbit.us
Mon May 9 15:01:16 CEST 2016

On 05/09/2016 01:33 PM, Thomas Worth wrote:
> Here's your cheat sheet if you want perfect decoding of YCbCr to RGB:
> 1. Encode RGB to YCbCr using the Poynton-approved RGB->709 matrix
> coefficients (don't mess with 601, trust me, unless you think apples should
> look like oranges)
> 2. Subsample the chroma channels to either 4:2:2 or 4:2:0
> 3. Scale (don't clip) luminance to 16-235
> 4. Scale (don't clip) chroma to 16-240

Thank you for this "to the point" list.

 From other responses in this thread I gather the following "practical 
steps" are in order:

1. Given that ffmpeg seems to interpret image2pipe fed RGB via 601, I 
need to add the following filter as early as possible in my pipelines:


2. I will skip this entirely, since subsampling of the source material 
(text, with many font-strokes being 1-pixel wide) can only result in 
guaranteed loss of color/legibility for all devices (even these that do 
understand 444p). My thinking is that if a playback mode can not 
directly handle 444p it will "downscale" correctly to 422p/420p.

3. It seems ffmpeg does not offer a way to do this? At least nothing in 
`man ffmpeg-filter` hints to addressing this...

4. This seems to be handled by ffmpeg for me automatically, but just to 
be sure, I will amend the "as early as possible" step from 1) as follows:


Please let me know if I grossly misunderstood something


More information about the ffmpeg-user mailing list