Optimizing high quality animated gifs

Опубликовано: 17 Февраль 2025
на канале: Dave's Space
584
11

Use python to find optimal FFMPEG commands to achieve small HQ gifs.

The best parameter to change is the max_colors of the palettegen filter.

----------------------------------------
Command used
(Place inside a batch file and run)
----------------------------------------

set fname="frames/frame%%04d.png"
set scale=w=320:-2:flags=lanczos
set fps=30
set crop=iw:ih:0:0

ffmpeg -y -r 30 -i %fname% -filter_complex "[0]fps=%fps%,crop=%crop%,scale=%scale%[a];[a]split[b][d];[b]palettegen=max_colors=48:stats_mode=full[c];[d][c]paletteuse" -c:v gif "small gif.gif"

Link to FFMPEG: https://ffmpeg.org/download.html

An excellent video on how to install and set it up:    • Install FFmpeg on Windows 10 - 2019  


Video where the gif frames were generated:    • Making an animated gif for Wikipedia ...