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...
Martijn van Beurden
2021-Jul-07 13:05 UTC
[flac-dev] METADATA_BLOCK_PICTURE indexed-color field
Op ma 5 jul. 2021 om 15:07 schreef leo60228 <leo at 60228.dev>:> I'm not clear on the utility of this. Do any programs made use of it? > What do they use it for?It's hard to tell whether any program uses this. The manual says Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. It says should, where it says color depth must be specified. I cannot find out how FLAC actually sets this by itself. Maybe you can decipher this bit of code to find out: https://github.com/xiph/flac/blob/master/src/share/grabbag/picture.c#L259