Gavin Smith
2018-11-07 14:48:48 UTC
#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âŠ
Gavin.
* 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âŠ
Gavin.