I created a command line function using ffmpeg to quickly convert a MOV file to a GIF. I often do screen recordings of the apps and things that I develop. I then want to share this recordings, most of the times in Slack or in a website. That’s why I want to create a fast GIF from the recording.

To make this work you will need ffmpeg. If you are on a mac you can simply run:

$~ brew install ffmpeg

After that command you will have ffmpeg installed. Next step is creating a bash function that will serve as a command to convert mov to gif. Look like I’m downscaling to 1080p but you can edit that part if you want:

# add this to your .bashrc or .zshrc
function gif() { ffmpeg -i $1 -pix_fmt rgb8 -vf scale=-1:1080 $2 }

All done! Reload your terminal or just run source ~/.zshrc. You can use the following command to convert mov to gif this way:

$~ gif whatever.mov output.gif

Don't miss any updates

I write articles about coding, side projects, open-source, and creative tools. If you like this article, you can join the newsletter: