Niels Segers

Full Stack Developer at delta.app


Converting videos to GIF's

During development I find myself capturing videos of bugs and issues on a regular basis. Sharing .mov files around is okayish when it's within an environment like Slack but obviously this doesn't work when commenting on Github issues or somewhere else. So I figured I needed an easy and reusable way of converting these videos to gifs with ease.

Introducing gifify 🤷‍♂️

alias gifify=convert_to_gif

function convert_to_gif() {
	filename=$(basename -- "$1")
	output="${filename%.*}.gif"
	ffmpeg -i $1 -pix_fmt rgb8 -r 10 $output # convert to gif
	gifsicle -O3 $output -o $output # optimize
}

You'll need to install the following to use it though:

brew install ffmpeg
brew install gifsicle

Use it as: gifify <filename>.mov and it will create a gif inside the same directory you're in with the same filename.

Written by Niels Segers