[Libav-user] Convert frame data from AV_PIX_FMT_BGR24 to AV_PIX_FMT_PAL8

Chris Garry cgarry at sweeneydesign.co.uk
Sun Apr 20 15:13:41 CEST 2014


My application needs to convert frame data from its internal format of BGR24
to palletized 8-bit data so that it can generate a colour animated GIF.  Is
there a function in the FFmpeg libraries to do this?

I tried creating an SwsContext and using sws_scale(), but an output format
of AV_PIX_FMT_PAL8 is not by sws_getCachedContext().

I understand that creating a suitable optimised palette for a frame is
non-trivial but would have thought that this must have been done many times
before.  Therefore I just wanted to check it if a function to do this
already exists before I bite the bullet and write my own version.

Thanks and regards,
Chris Garry



More information about the Libav-user mailing list