[Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Feb 14 10:52:46 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

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

Carl Eugen



More information about the Libav-user mailing list