home ~ projects ~ socials

Extract Images From A GIF With ffmpeg

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.

-- end of line --

References