How do I convert the frames of a GIF into PNGs using ffmpeg? [closed]
Asked Answered
T

1

6

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?

Trattoria answered 11/11, 2020 at 17:48 Comment(1)
Just a warning for future readers, turns out that this question "does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers." Given that ffmpeg is most certainly NOT a software tool primarily used by programmers, it is obviously off-topic. And where is my brother Abel? The Stack Overflow deities have scorned my offering.Trattoria
T
12

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!

Trattoria answered 11/11, 2020 at 17:48 Comment(1)
You may want to specify -vsync 0 option; otherwise you may get more PNGs than the number of frames.Danby

© 2022 - 2024 — McMap. All rights reserved.