Search code examples
imageffmpegpnggif

How do I convert the frames of a GIF into PNGs using ffmpeg?


I have a .gif file on my file system and I want all of its frames to be saved as .png files. How can I do this with ffmpeg?


Solution

  • ffmpeg -i target.gif frame_%d.png

    This little command extracts frames from a GIF and saves them as PNGs named like this: frame_0.png.

    • -i identifies the input (in this case, it's: target.gif).
    • %d is a placeholder that'll be replaced by a numbers.

    Turns out that ffmpeg does this frame extraction business for free. Thanks, ffmpeg!