How to make gifs from screen recordings using ffmpeg

Published: ffmpeg

Gifs can be a helpful way of supplementing documentation with visual examples. Here’s a workflow for doing so using MacOS and ffmpeg.


brew install ffmpeg
ffmpeg -i input.mov -filter_complex "[0:v] palettegen" palette.png
ffmpeg -i input.mov -i palette.png -filter_complex "[0:v] fps=10,scale=1600:-1 [new];[new][1:v] paletteuse" input_1600W10FPS.gif

So far I find 10FPS and 1600width to be decent for everyday use, e.g. technical documentation in Confluence. Note that the scale parameter 1600:-1 sets the height at -1 in order to preserve aspect ratio.