3

Possible Duplicate:
How do I convert an animated GIF to a YouTube friendly video format?

The question is pretty straight-forward: How to convert animated gif file to mp4 video?

It might seem totally useless but it can come handy when trying to insert animations to a PDF presentation (https://tex.stackexchange.com/questions/429/animation-in-pdf-presentations-without-adobe-reader) and to avoid uneccessary complications needed to get adobe reader working (http://abarry.org/the-complete-guide-to-embedded-videos-in-beamer-under-linux/).

smihael
  • 292
  • 3
  • 12
  • 1
    Here are some one step solutions: https://unix.stackexchange.com/questions/40638/how-to-do-i-convert-an-animated-gif-to-an-mp4-or-mv4-on-the-command-line – tommy.carstensen Nov 29 '20 at 23:31

1 Answers1

8

Step 1: Extract all frames from the input gif file (using imagemagick)

 convert INPUT.gif gif%05d.png

Step 2: Convert frames to video

 ffmpeg -r FRAMERATE -i gif%05d.png -y -an OUTPUT.mp4

Step 3 (optional): Delete all unnecessary temporal files

  rm gif*.png

Take care when deleting files.

Edit: In some versions of Ubuntu and Debian ffmpeg was replaced by avconv but the syntax remains same.

smihael
  • 292
  • 3
  • 12
  • 6
    FYI, FFmpeg isn't obsolete, it's still there and actively maintained. `avconv` is merely the fork Ubuntu chose to bundle. – slhck Jan 27 '13 at 16:07