Animated gif to avi on linux

 ̄綄美尐妖づ 提交于 2019-12-29 18:38:12

问题


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.


回答1:


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/




回答2:


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



回答3:


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.




回答4:


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

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



回答5:


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



来源:https://stackoverflow.com/questions/3212821/animated-gif-to-avi-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!