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

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.