I'm having a hard time converting my images from AV_PIX_FMT_BGRA
to PIX_FMT_PAL8
. Unfortunately sws_getCachedContext
doesn't support the conversion to PIX_FMT_PAL8
.
What I'm trying to do is convert my images into a GIF video with higher quality output. It seems that PIX_FMT_PAL8
could potentially provide the higher quality output I'm looking for.
According to this documentation I need to palettize the pixel data, but I have no clue how to do that.
When the pixel format is palettized RGB (
PIX_FMT_PAL8
), the palettized image data is stored inAVFrame.data[0]
. The palette is transported inAVFrame.data[1]
, is 1024 bytes long (256 4-byte entries) and is formatted the same as inPIX_FMT_RGB32
described above (i.e., it is also endian-specific). Note also that the individual RGB palette components stored inAVFrame.data[1]
should be in the range 0..255. This is important as many custom PAL8 video codecs that were designed to run on the IBM VGA graphics adapter use 6-bit palette components.
Any help or direction would be appreciated.