Quickly create gifs from movs in the command line

How to quickly take your .mov files and turn them into .gif

A common pattern I need to perform is to do a short screen recording of an action and display it on a web page. For lots of things a short video will work perfectly, but sometimes all you want is a little gif showing the action. On OSx you can convert your screen recordings into gifs with this one-liner.

The Setup

You need to install one thing in order for this to work, ffmpeg, which can be installed with brew.;

  • brew install ffmpeg

This has been tested on macOS Catalina, but I see no reason why it wouldn’t work on older versions of macOS.

The one-liner

ffmpeg -i my.mov -pix_fmt rgb24 -r 10 -f gif my.gif

This first uses ffmpeg and takes the following flags:

  • -i is the input, in our case my.mov
  • -pix_fmt sets the pixel format, gifsicle prefers rgb24
  • -r sets the framerate, the default is 25 frames per second, we can get away with slower for a gif
  • -f is the output format, in our case gif

Then ffmpeg passes what it has to our output file, my.gif. If the file already exists it will ask if you want to overwrite it.

There are lots of other flags and services you can use to get better compression or to resize the gif, but for many use-cases you just want something quick you can share, this does that!

Recent posts View all


Forcing a Rails database column to be not null

How you can force a table column to always have something in it with Rails

Writing Marketing

We've deleted an article's worth of unhelpful words

We've improved several pages across our site by removing words that add no value, and often detract from the article.