logoalt Hacker News

dllutoday at 9:34 AM4 repliesview on HN

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


Replies

dspilletttoday at 1:23 PM

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).

CrossVRtoday at 9:57 AM

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.

crazysimtoday at 1:09 PM

Gifski (https://gif.ski/) might be a good alternative to look to that's gif-pallete aware.

xattttoday at 11:13 AM

Those command flags just roll off the tongue like two old friends catching up!

/s

show 1 reply