Search This Blog

Saturday, July 14, 2018

FFMPEG + ImageMagic to make gif of video.

Step 1 - Convert video to images


Tool Used : FFMPEG 
ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source.
It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter.

[Command]
ffmpeg -i foo.mp4 -vf fps=25 foo%04.jpg -hide_banner

[Options]
-vf : Video filter to change frame property (fps to 25)
-hide_banner : Suppress printing banner.

Step 2 - Convert sequence of jpgs to gif  :


Tool Used : ImageMagick Convert
The convert program is a member of the ImageMagick suite of tools.
It is used to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

[Syntax] 
convert [ip-options] ip-file [op-options] op-file 

[Command]

convert -resize 30% -delay 15 -loop 0 foo*.jpg output.gif 

[Options]
-resize : resize the image
-delay : pause between images
-loop : number of loops for gif