[FFmpeg-user] BT.709 -color_primaries -color_trc -colorspace ?

Ted Park kumowoon1025 at gmail.com
Tue Mar 31 02:41:14 EEST 2020


> I did search for answers, but this subject is apparently too esoteric.
> 1, Do I need to explicitly specify BT.709 for an encoder or does ffmpeg default to it?

It would depend on your target format, and I don’t think ffmpeg makes any assumptions as for defaults. the encoder might do that, or not.

I am pretty sure most encoders just indicate the colorspace of the content in the video parameters, they don’t do any conversions or anything, so it’s inferred by the consumer from the context and/or content. 

> 2, Should I specify '-color_primaries' or '-color_trc' or '-colorspace'?
> Codec documentation (https://ffmpeg.org/ffmpeg-codecs.html) references to 'bt709' [1]
> -color_primaries 0
> -color_trc 0
> -colorspace 1
> [1] The integers I use assume that the documentation lists are ascending from zero.

You shouldn’t make that assumption… In this case apparently they mirror ISO 23001-8, and it looks like bt709 is 1 for all three.
If you are going to specify BT.709 I think specifying colorspace would suffice, otherwise if the encoder took some random combination and went with it, you’d have a pretty unusual color model .

> Aside from the integer assigned, what's the difference between the '-color_primaries' & '-color_trc' & '-colorspace' directives?

-color_primaries is for indicating the color primaries of the source. They used to be called phosphors, basically what is considered to be the primary colors in the colorspace.

The trc in -color_trc stands for transfer characteristics. It chooses the characteristic response, i guess kind of like how much of an increase in brightness a certain increase in signal voltage corresponds to. They were represented by gamma functions since CRTs, there are ones that are very different and not just a simple gamma function now (e.g. 2084, HLG, etc) 

Colorspace I would say specifies the other two, or at least limits them to a few alternatives based on ntsc or pal. I think -colorspace 709 precludes the need to set primaries and trc but I could be wrong.

> As you can see below, the transcode 'Output' status doesn't say what it defaults to.

Yeah, from that I’m thinking neither libx265 nor ffmpeg has any defaults. Left to be inferred by the decoder.

Ted Park

More information about the ffmpeg-user mailing list