开发者

Animated gif to avi on linux

开发者 https://www.devze.com 2023-01-06 09:59 出处:网络
Is there any way to convert an animated gif to a video format (e.g. .avi) on Linux? I have already tried

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.av开发者_运维百科i

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


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


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/


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.


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

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消