After some further thought and discussion on the FFmpeg and Xiph.org IRC
channels, the current behavior seems reasonable. To my knowledge, PAL8 is
guaranteed to have exactly 256 colors. This is why, somewhat surprisingly,
GIFs aren't decoded as PAL8, they're decoded as BGRA. This means that they
That's true, but as far as I can tell FFmpeg assumes that all paletted
images have 256 colors, and thus there isn't a way to get the exact number
of colors in a GIF.
I also doubt that this will cause problems in practice, it's somewhat
strange that this field is even there.
If I'm wrong on any of
On 29/01/2021 16:12, leo60228 wrote:
> +if (st->codecpar->format == AV_PIX_FMT_PAL8)
> +avio_wb32(pb, AVPALETTE_COUNT);
> +else
> +avio_wb32(pb, 0);
Is this correct, though?
GIFs encoded by things that are not libavcodec may have less than
AVPALETTE_COUNT entries/colors.
The FLAC specification requires GIF images to contain their number of
colors. While I can't find a specific reference to that effect, I'm
assuming that's why GIF images were previously unsupported. This was
implemented by just writing AVPALETTE_COUNT for paletted images.
---
This version no longer