john-jones
john-jones

Reputation: 7780

Animated gif to avi on linux

Is there any way to convert an animated gif to a video format (e.g. .avi) on Linux?

I have already tried

ffmpeg -i thegif.gif thevideo.avi

but all I get is the first image of the video.

Upvotes: 27

Views: 38151

Answers (5)

user3507085
user3507085

Reputation: 720

If you dont want temporary files, you can try mencoder:

mencoder myfile.gif -mf fps=25 -o myfile.avi -ovc lavc -lavcopts vcodec=mpeg4

Upvotes: 3

äxl
äxl

Reputation: 11

If you like to have a loop as output

ffmpeg -loop 1 -t x -i some%05d.png some.avi

where x is the time the video should run in seconds.

Source

Upvotes: 0

Crami
Crami

Reputation: 416

If you like to have a certain framerate as input because the resulting video is to fast or to slow

ffmpeg -r 'xx' -i some%05d.png some.avi  

where xx is the input framerate.

Upvotes: 9

Nordic Mainframe
Nordic Mainframe

Reputation: 28737

ffmpeg's gif input doesn't work too well. It's usually easier to unpack the gif frames with convert (from ImageMagick) and process these with ffmpeg:

convert some.gif some%05d.png  
ffmpeg -i some%05d.png some.avi  
rm some*.png

Upvotes: 46

Arshdeep
Arshdeep

Reputation: 4323

I can suggest combination of imagemagick and ffmpeg

do this to extract each frame as png/jpeg

$magick> convert 'images.gif[0]' image.png

Do this to convert images to movie sequence

ffmpeg -f image2 -i image%d.jpg video.mpg

More help on commands

http://www.imagemagick.org/script/command-line-processing.php

http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs

http://electron.mit.edu/~gsteele/ffmpeg/

Upvotes: 13

Related Questions