5

I'm looking for a tool (GUI would be best) to convert an animated gif to a mp4-video to send it via WhatsApp. Do you have any suggestions that get this job done?

0

3 Answers 3

17

You can use two programs, Imagemagick's convert command and ffmpeg, to do this.

convert -coalesce animation.gif frames%04d.png

Then convert the pngs to a movie:

ffmpeg -r 10 -i frames%04d.png -vcodec mjpeg -y movie.mp4

For a GUI, it would not gain you much convenience, but I know QuickTime Pro (you might have to get the old version) will convert a stack of sequential images into an animation. I don't know if it will read the GIF properly.

3
  • Can you explain why you want to include answers given by others into yours? Anybody visiting this Q&A will see all the answers anyway, so they will for sure find all of the information they need. Referencing other answers makes things harder to read for everybody.
    – nohillside
    Jan 12 at 20:17
  • I am just mentioning that one flag because sometimes people use the most upvoted answer without reading all the others. My answer was written in 2013. I don't there is any harm in point out a way to improve it, and the other answer (which was copied from my answer two years later) is not identical to the one I've given. Please just leave it alone.
    – beroe
    Jan 13 at 23:20
  • We have amazingly little insights into which answers people actually read and use :-) I see no harm in this ("use the most upvoted answer without reading all the others"). If it works for them, great, if it doesn't they hopefully come back to look for alternatives. If yo want to add a second option, please do so, but make it stand on it's own so people can just copy/paste the command.
    – nohillside
    Jan 14 at 7:28
8

Beroe's answer was really helpful but I found that when I created mp4s using his method it didn't work on QT or iMovie on El Capitan. I did a little digging and read the encoding logs and stumbled upon this solution, seems to work with QT and iMovie:

ffmpeg -r 10 -i frames%04d.jpg -vcodec h264 -y -pix_fmt yuv420p movie.mp4

3
  • I think you need frames*.jpg or frames*.png rather than frames%04d.jpg Nov 17, 2015 at 11:45
  • This worked for me after converting the gif to jpg's by using @beroe's method from his answer above: convert -coalesce animation.gif frames%04d.jpg Feb 7, 2019 at 21:52
  • 1
    @MarkSetchell No he does mean frames%04d which is ffmpeg syntax for any file with four digits e.g. frames0001.png frames0002.png etc
    – Carlos P
    Apr 23, 2019 at 20:30
2

Despite using Mavericks, I still keep Quicktime 7 Pro Player on my disk. It is just fine for viewing animated GIFs and exporting them in other formats.

added

Requires Quicktime 7 (optional install, or keep it in your Applications when you install new versions of the OS). Requires the paid "Pro" upgrade key, Quicktime 7 version available since 2005 or so.

Open the GIF file with Quicktime Player 7. (Drag the GIF icon onto the Player icon; or right-click the GIF icon and choose Quicktime Player 7 under "Open with"; or start Quicktime Player 7, then use Open File... in theFile menu)

Play it to make sure it is working. You can use the left and right arrow keys to go forward or back one frame at a time.

Window > Show Movie Inspector (or ⌘-I). Write down the "Normal size", 270 x 600 or whatever it is

inspector

File > Export (or ⌘-E)

In the Export: menu choose Movie to MPEG-4 (or some other format if you wish)

export

Use the Options button to control some characteristics of the MP4 file. In particular, set the Image size (if the size you wrote down isn't in the menu, choose Custom and write it in). Try format MPEG-4 Improved. Click OK when you are finished with options.

options

Select the destination and filename for the MP4 file

Click Save

1
  • Hi, could I ask you to summarise the steps required to achieve this, as I think it's useful info that still may need further explaining for some users.
    – stuffe
    Jan 8, 2014 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .