[Libav-user] Handling Colorimetry (YCbCr 601, 709 and sRGB)

Gavin Smith gcs584 at yahoo.com
Wed Nov 7 16:48:48 EET 2018

#1. If I am to perform colorspace conversion between YCbCr 601, 709, and sRGB, would I be unable to use swscale? I’ve read the wiki document below, which seems to imply that I am better off using the colorspace filter:
* https://trac.ffmpeg.org/wiki/colorspace (I'm hoping it's okay to share a link to a FFmpeg page)
To quote, “Conversion between color types (matrix, primaries, transfer characteristics) can be done using the colorspace or colormatrix video filters.” Reading that, my understanding is that swscale does not possess the same capabilities? I am aware that swscale contains the function `sws_setColorspaceDetails`. Does swscale assume (for example) that if the colorspace is 709 that the transfer characteristcs, etc are 709 too?
Admittedly, I’m hesitant to use the filters/graphs because they are very rigid – they don’t handle video properties changing on the fly which is why swscale is (potentially) more suitable for my requirements. Yes, I could recreate the filters/graph each time, but that could become costly.
#2. Following on from my original question, I have a situation where I have loaded a decoded PNG image into an AVFrame (with AVPixelFormat variant of the RGBA pix_fmt). What is the correct values to set for AVFrame’s color characteristics when passing the AVFrame along:  - AVFrame::color_primaries =>AVCOL_PRI_BT709 ? AVCOL_PRI_UNSPECIFIED  ?  - AVFrame::color_trc => AVCOL_TRC_IEC61966_2_1   ?  - AVFrame::colorspace => AVCOL_SPC_RGB  ?
I’m fairly confident that ‘color_trc’ and ‘colorspace’ are correct but uncertain of ‘color_primaries’
Any assistance would be much appreciated…

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181107/336ce5f3/attachment.html>

More information about the Libav-user mailing list