Sunday, March 14, 2010

Create animated gif from movie on command line

I saw a post where it was creating an sequence image from command line then using gimp to combine it, the post is at and Now lets have more fun with it by just using command line for all the process.

You might need MPlayer and ImageMagick for this
sudo apt-get install mplayer imagemagick

The for the animated gif
mplayer -ao null -ss 0:00:01 -endpos 4 /path/to/video -vo jpeg:outdir=Extracted
cd Extracted
convert -delay 10 *.jpg -loop 0 animate.gif

If you want your full video to be converted to gif you could use this (byexamples archives)
mplayer -vo gif89a /path/to/video

For the explanation of the mplayer part please see the referenced site, for the convert please see