[FFmpeg-user] Requesting colormatrix advice

markfilipak.imdb at gmail.com markfilipak.imdb at gmail.com
Tue Nov 7 18:03:35 EET 2023


On 11/7/23 10:27, Paul B Mahol wrote:
> On Tue, Nov 7, 2023 at 3:09 PM <markfilipak.imdb at gmail.com> wrote:
> 
>> On 11/7/23 08:39, Paul B Mahol wrote:
>>> On Tue, Nov 7, 2023 at 2:22 PM <markfilipak.imdb at gmail.com> wrote:
>>>
>>>> On 11/7/23 06:55, Phil Rhodes via ffmpeg-user wrote:
>>>>>     On Tuesday, 7 November 2023 at 11:48:24 GMT, <
>>>> markfilipak.imdb at gmail.com> wrote:
>>>>>
>>>>>>     I think it sets the color tags on the _input_
>>>>> I'm not so sure ...
>>>>
>>>> I tried it. The saturation was still there.
>>>>
>>>> What exactly you tried?
>>
>> set ARGS=-map 0:v -map 0:a:1 -map 0:a:0 -vf
>> setparams=range=tv:color_primaries=smpte170m:color_trc=smpte170m:colorspace=smpte170m,separatefields,setdar=16/9
>>
>> -c:v libx265 -x265-params crf=18 -c:a copy
>> ffmpeg -ss 10:37.846 -to 11:09.335 -i "%SOURCE%" %ARGS% "%TARGET%"
>>
>> It seems to me that if 'setparams' is marking tags in the SOURCE instead
>> of the encoder, it would
>> not be in '-vf' and would not require transcoding. It would be a '-bsf:v'.
>> So, I don't know what
>> 'setparams' does. Apparently nothing.
>>
> 
> That is a bug.

What is a bug, Paul? Is it a bug that '-vf setparams=<colormatrix_tag>=smpte170m' doesn't affect the 
encoder? Or, on the other hand, is it a bug that '-vf setparams=<colormatrix_tag>=smpte170m' doesn't 
affect the decoded stream as though it was in the source's colormatrix? As Phil pointed out, the 
documentation is ambiguous regarding whether it applies to the source or to the encoding, so the bug 
is also ambiguous, eh?

> Workaround is to use: -colorspace -color_range etc output options directly.

As I pointed out, libx265 can't do anything with colormatrix values of 'unknown'. In the face of 
'unknown', it can only encode to bt709 without changing the chroma because it can't convert from 
'unknown', eh? In other words, I need a way of tricking libx265 into thinking that the source is 
'smpte170m' so it will convert it to bt709. Is '-vf setparams=<colormatrix_tag>=smpte170m' supposed 
to do that? Who knows? For sure, -colorspace -color_range etc. don't do that. They affect only the 
encoder. They are not workarounds. libx265 can't convert 'unknown' to anything. It can only follow 
the rules of Blu-ray. So I can't do an is-this-source-actually-smpte170m test. Do you get it my friend?

Regards -- Mark.


More information about the ffmpeg-user mailing list