Comment by dllu
7 hours ago
When converting video to gif, I always use palettegen, e.g.
ffmpeg -i input.mp4 -filter_complex "fps=15,scale=640:-2:flags=lanczos,split[a][b];[a]palettegen=reserve_transparent=off[p];[b][p]paletteuse=dither=sierra2_4a" -loop 0 output.gif
See also: this blog post from 10 years ago [1]
[1] https://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
I've been thinking of integrating pngquant as an ffmpeg filter, it would make it possible to generate even better pallettes. That would get ffmpeg on par with gifski.
It’s a shame this isn’t the default.
Does ffmpeg's gif processing support palette-per-frame yet? Last time I compared them (years ago, maybe not long after that blog post), this was a key benefit of gifski allowing it to get better results for the same filesize in many cases (not all, particularly small images, as the total size of the palette information can be significant).
Gifski (https://gif.ski/) might be a good alternative to look to that's gif-pallete aware.
Those command flags just roll off the tongue like two old friends catching up!
/s