Friday, December 11, 2015

Convert video to gif

Convert video to gif

Install ImageMagick. ImageMagick has already included ffmpeg.exe in its installation file.

# mkdir tmp

# mkdir out

# ffmpeg -i MyVideo.avi -vf fps=fps=10 tmp/out%06d.png

(or ffmpeg -i MyVideo.avi -t 10 tmp/out%06d.png)
(or ffmpeg -i MyVideo -an -r 10 -y -s 640x480 out/out%06d.png)

# mogrify -format gif tmp/*.png

# convert -delay 10 tmp/*.gif -loop 0 out/out.gif

# convert -layers Optimize out/out.gif out/out_optimized.gif

# del "tmp\*"

Reference:

http://stackoverflow.com/questions/6079150/how-to-generate-gif-from-avi-using-ffmpeg

http://www.atrixnet.com/animated-gifs/

No comments: