[FFmpeg-user] Requesting colormatrix advice

Paul B Mahol onemda at gmail.com
Tue Nov 7 18:29:07 EET 2023


On Tue, Nov 7, 2023 at 5:03 PM <markfilipak.imdb at gmail.com> wrote:

> 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?
>
>
You are deeply confused. To tag input or output you need to use
"-colorspace bt601" and similar as input or output option,
here input option means option goes before input and output option means it
goes after encoder selection and before output file name.

setparams filter is only currently useful if you want to convert/transcode
it from bt601 to bt709 in which case you than tag it with that filter.
If you do not want to transcode than there are bitstream filters for
h264/hevc/prores/etc to set some metadata too including colour primaries.

colormatrix filter is not recommended for usage at all.


> Regards -- Mark.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list