[Libav-user] Converting image/video pix format to RGB24?

Michael Bradshaw mbradshaw at sorensonmedia.com
Thu Jun 14 17:12:22 CEST 2012


On Thu, Jun 14, 2012 at 8:58 AM, Fabio J. Gonzalez <gonzalfj at ymail.com> wrote:
> I am developing a free software project. I wonder how to convert any video format supported to RGB24. I want to import the most different formats of video/images, but I want to work only with RGB24. I think for some reason img_convert deprecated(the compiler can not find this function). Know any other function (or way) that does exactly that?

You can use libswscale. Look at sws_getContext(), sws_scale(). You can
pass the decoded frame to sws_scale(), and the frame you want to copy
and convert it into. For this new frame, you'll probably want to
allocate memory for the frame's data using avpicture_fill().

--Michael


More information about the Libav-user mailing list