[flac-dev] METADATA_BLOCK_PICTURE indexed-color field

leo60228 leo at 60228.dev
Mon Jul 5 13:07:02 UTC 2021

METADATA_BLOCK_PICTURE contains this field:

> <32> For indexed-color pictures (e.g. GIF), the number of colors used, or 0 for non-indexed pictures. 

I'm not clear on the utility of this. Do any programs made use of it? 
What do they use it for?

While I'm not very experienced in FFmpeg development, from what I can 
tell fully implementing this would be pretty difficult, though I could 
easily hardcode 256 (since FFmpeg technically only supports 256-color 
palettes, though I'd expect encoders to remove unused colors).

Additionally, for the specific case of animated GIFs, it seems unclear 
how to handle this since the palette can be changed each frame. Should 
it be the number of unique colors across all palettes in the animation? 
This would mean that for a non-animated GIF the FLAC field might not 
match up with the actual GIF, though, if there are duplicate colors...

More information about the flac-dev mailing list