[Libav-user] Questions about ColorSpace conversion in swscale

Markus Pfundstein markuspfundstein86 at gmail.com
Mon Aug 18 11:31:49 CEST 2014


I am currently developing a program that uses the libavcodec library 
for decoding (not encoding) various movie formats. I have some 
questions about color space conversion and how ffmpeg handles it.

Assume I have RGB input where I don't know if its FullRange or ITU-R 
BT.709 and I want to have my output ITU-R BT.709. How can I configure 
SwSContext properly?

Assume I have YUV422 BT 601 input and I want my output to be YUV444 
FullRange. Is this possible without telling SwsContext that my input 
source is BT 601?

I would also appreciate if someone could explain to me how swscale 
works in terms of color space conversion. I did read through the source 
and I think I understand a bit but I don't get the whole picture. Does 
color space conversion work on 10bit and 12bit as well or does it 
always downscale first to 8bit? (would be a big bummer). Also, does 
swscale first transform the input color space to XYZ and then transform 
it further into the target color space? And why is there no yuv2rgb 
function but only a rgb2yuv function? If I want my output color space 
to be rgb, such a function would be needed or not? 

Thanks a lot already for your answers. I hope my english is 
understandable (not native)

With best regards, 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140818/29fff573/attachment.html>

More information about the Libav-user mailing list