[FFmpeg-devel] [PATCH v3 2/2] avfilter/vf_colorspace: Use colorspace negotiation API

Nicolas Gaullier nicolas.gaullier at cji.paris
Thu Apr 4 15:16:47 EEST 2024


>De : Nicolas Gaullier 
>Envoyé : jeudi 4 avril 2024 14:02
>
>>The logic that is used in the other YUV negotiation aware filters is to just set `out->colorspace = outlink->colorspace` and `out->color_range = outlink->color_range`, since the link properties are authoritative.
>This is the kind of easy logic I tried at the beginning. Some water has flowed under the bridge, notably b89ee26539, but I just tried at the moment (with current code) an easy patch with just these two lines, and it still does not work >as "I" expected.
>More specifically:
>When running: ./ffprobe -f lavfi -i yuvtestsrc,setparams=color_primaries=bt470bg:color_trc=smpte170m:colorspace=bt470bg,colorspace=bt709:range=tv,scale,showinfo
>At the entry of filter_frame(), the outlink values are incorrect:
>colorspace = AVCOL_SPC_BT470BG
>And color_range = AVCOL_RANGE_UNSPECIFIED So, this is why I introduced the negotiation for the colorspace to early set and persist this outlink property.
>But for the range, I am bit confused with the documentation, it is not clear to me, but possibly it is expected to pass through? so it cannot be negotiated, so I am sticked if the outlink range cannot be changed dynamically...

I was too hasty, sorry, let me precise what is running wrong:
the "out" frame colorspace/range is fine
And when running:
/ffprobe -f lavfi -i yuvtestsrc,setparams=color_primaries=bt470bg:color_trc=smpte170m:colorspace=bt470bg,colorspace=bt709:range=tv,showinfo 2>&1|grep color_space
you actually get, as expected:
color_range:tv color_space:bt709

The issue is the link, and it is raised when chaining with the scale filter for example here:
./ffprobe -f lavfi -i yuvtestsrc,setparams=color_primaries=bt470bg:color_trc=smpte170m:colorspace=bt470bg,colorspace=bt709:range=tv,scale,showinfo 2>&1|grep color_space
color_range:unknown color_space:bt470bg

So, I don't know, maybe my approach (fixing vf_colorspace) is wrong ?
Anyway, the "out->color_range = outlink->color_range" logic does not seem to be the kind of things to do here.

Thank you again
Nicolas


More information about the ffmpeg-devel mailing list