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

My son has made some animations with Pivot Stickfigure Animator which we'd like to upload to YouTube. The problem is Pivot saves as animated GIFs which I can't upload to YouTube.

The Wikipedia article recommends using Windows Movie Maker to convert GIF to WMV, but unfortunately I'm using Windows 7 for which you can get the new Windows Live Movie Maker which doesn't seem to support GIFs.

I Googled and found an article which said to use Beneton Movie GIF to convert animated GIF to AVI, but this seemed to rely on a 3rd Party application which wasn't installed and so failed. Installing the missing application - pjBmp2Avi - by hand and adding it to the path still didn't allow Beneton to do the conversion.

I hoped FFmpeg might do the trick but this only outputs to animated GIFs, it won't read from then.

Further Googling found lots of applications with 30 day trials and so on but I was hoping for something free.

So any suggestions on how I can convert an animated GIF to a movie file on Windows using free (as in beer) software?


Solution 1:

Try this Open Source software http://www.virtualdub.org

Open your .gif as a video file... then save as .avi

Solution 2:

The ImageMagick convert program can split up animated GIFs. e.g. given the existence of a file 'foo.gif', I can run:

convert foo.gif foo.png

and it will create files foo-0.png, foo-1.png, etc, one for each frame. If you have more digits, then use the following syntax, for example with 4 digits:

convert foo.gif foo%04d.png

You could then use FFmpeg to build those into a movie.

ffmpeg -f image2 -r framerate -i foo-%d.png -c:v libx264 -pix_fmt yuv420p output.mp4

To change the quality of the resulting video, add the -crf option, e.g. -crf 23, where lower means better quality. Sane values are between 18 and 28, but since the GIF quality shouldn't be too good in the first place, you probably won't need this option.

As of 2013, recent versions of ffmpeg can accept animated gifs as input directly.

ffmpeg -r framerate -i input.gif -c:v libx264 -pix_fmt yuv420p output.mp4

Solution 3:

Just

ffmpeg -i input.gif output.mp4

(taken from @framp's comment on @John Fouhy's answer above)

Don't know about YouTube, but the codec can be specified with the -c:v options (see ffmpeg -codecs for the list of codecs).

This codec for example imports well into Final Cut:

ffmpeg -i input.gif -c:v qtrle output.mov