Gifs From Videos via ImageMagick/FFMPEG

Handy notes on creating gifs from videos.

I recently wrote a blog on our Vulnerability Advisor (VA) service GA’ing in IBM Cloud Private. In the blog I wanted to show some VA capabilities in a simple way. The usual goto for us for these is via screen recordings and screenshots. I have seen how folks put sped up gifs into their blogs for some of these introductions. So I decided to do something as such. It turns out this is super easy with ImageMagick and FFMPEG, which I recently used in my latest timelapse workflow.

So I got to go about doing this by creating a screenrecording with Quicktime and then used ImageMagick for the conversion. I had to add one more dependency to my prior ImageMagick stack. So here go my latest set of dependencies:

canomac$ brew install imagemagick
canomac$ brew install ffmpeg #Needed for creating video
canomac$ brew install gifsicle #Needed for creating gif

I created the final gif with the following command:

canomac$ ffmpeg -i VA3.mov -r 9 -f gif - | gifsicle --optimize=3 --delay=3 > VA3b.gif

There are several other options that you can tune and play with to optmize as I learned here. I started with this one below and worked through options until I met requirements.

canomac$ ffmpeg -i try2.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif

 

Parting Thoughts

One thing I realized is, the gifs can be big. My one constraint was to keep it under 25MB as o/w “medium.com” rejects the upload. I finally succumbed and reduced my frame rate to make this, which made my gif go a bit faster than I hoped. Also, there is no simple way to pause/stop with gifs as with movies, which gets to be annoying after a few times trying to catch a certain step.

Here is a copy of the two final products that came out of this experiment. Second one might take a bit to load, but, let’s see…

1. VA Access:

2. VA

 

Leave a Reply

Your email address will not be published.