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

Peter Rabbitson rabbit+list at rabbit.us
Mon May 9 11:21:21 CEST 2016


Thank you very much for confirming at least a part of my mental model ;) 
Followup questions inlined below:

On 05/09/2016 10:29 AM, Paul B Mahol wrote:
> On 5/6/16, Peter Rabbitson <rabbit+list at rabbit.us> wrote:
>>
>>  ...
>> == Questions
>>
>> - What is the "default" conversion matrix used within ffmpeg when
>> nothing else is specified. Is it (apparently) bt.601, or does it default
>> to different things depending on input?
>
> You are using color source filter which is using fixed coeff (bt.601) when
> converting color from rgb to yuv. There is nothing much you can do about
> this.
>

Is this documented somewhere?

My actual use case btw is 24bit rgb via image2pipe as in:

 > ... -f image2pipe -c:v ppm -i /dev/stdin ...

which behaves the same way as the internal color source I used in the 
example.

>>
>> - If it is bt.601 is it bt470bg or is it smpte170m or in the matrix case
>> it doesn't matter?

I think this question got skipped in the answer.

>>
>> - Is it "ok" to produce 720p video explicitly tagged at bt.601? I ran
>> across multiple writeups on the net suggesting 720p not encoded (is this
>> the right term?) in bt.709 is a big no-no.
>
> It is "ok" to produce it, but not all encoders support proper tagging right
> colorspace in their bitstream... so better be safe than sorry and not
> produce such files.
>
>>
>> - Regardless of what the answer to the previous question is: If I wanted
>> to produce the same example video in bt.709 and have it play correctly
>> in both cases - what would the ffmpeg incantation be?
>
> FFmpeg doesn't play videos, it decodes them. FFplay is more a tool
> for testing than proper playback.
>

I phrased this last question incorrectly. Given my source *is* rgb, and 
I want to produce a final 1280x720 yuv444p h264 bitsream, to be consumed 
by whatever player (both hardware and softwre):

What is the correct ffmpeg *encoding* incantation?


>>
>> - Am I correct that the inconsistency #00AA00 => #00AB01 is simply "cost
>> of doing YUV business", or is the reason more nuanced/involved?

This question also got skipped, and I am really keen on understanding 
whether colors can in fact roundtrip, or there is a limit due to the 
very physics the different colorspaces model. I see there is a large 
array of knobs to twiddle in `man ffmpeg-scaler` related to chroma but 
there is sadly no layman-friendly entry-point.



More information about the ffmpeg-user mailing list