[Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P

Chris Share cpsmusic at yahoo.com
Thu Feb 14 12:46:42 CET 2013


Chris Share <cpsmusic at ...> writes:


>> The scaling_video.c is close to what I need however the 
>> conversion is the opposite of what I want. What I'm
>> not clear about is how to change the "fill_yuv_image" 
>> function to something like "fill_rgb_image".

>The function is used to provide an artificial source image.
>You don't need it since you already have an input image.

>> How does the RGB data get written into the 
>> "uint8_t *data[4]"? Is it written consecutively (all R 
>> values get written to data[0], all G values to data[1], etc.)?

>That would be planar RGB, see PIX_FMT_GBR.
>RGB is a packed format, see libavutil/pixfmt.h

Does that mean I should use AV_PIX_FMT_GBRP as the input format? 

In pixfmt.h it mentions the following: "///< planar GBR 4:4:4 24bpp". Does this mean that each color value needs to be set to a 24-bit data type?

Also, I'm still not clear about how to get the RGB data into the "uint8_t *src_data[4]" - how do I actually do this?

>Note that all this has limited relevance for you if you 
>don't rescale yourself but use the scale filter (or 
>libswscale directly).

Sorry, but I'm not sure what you mean.



More information about the Libav-user mailing list