Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Extract Images From A GIF With ffmpeg

Code

ffmpeg -i input.gif -vsync 0 -y frames/frame-%d.png

This pulls the individual frames from a GIF out into individual files. The `-y`` allows it to overwrite files if you start over. The `%d`` numbers each image starting with 1 and going up.

Using `%00d`` adds leading zeros to the filenames which can be nice for sorting in some situations. That example adds two leading zeros (e.g. _frame-%00d.png__ outputs _frame-001.png__, _frame-002.png__, etc..) A single zero can be used or more zeros added to adjust the number.

References