Skip to content

Instantly share code, notes, and snippets.

@nicholasspencer
Last active March 18, 2019 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholasspencer/b4db446fa952f192d909fc7f8d20d554 to your computer and use it in GitHub Desktop.
Save nicholasspencer/b4db446fa952f192d909fc7f8d20d554 to your computer and use it in GitHub Desktop.
Quicktime Screen Recording to GIF
#!/usr/bin/env bash
# converts .mov (quicktime screen recordings) to animated .gif images
# requires ffmpeg and gifsicle which are easily `brew install`'d
gifplease() {
ffmpeg -i $1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=8 > $1.gif
gif="$(pwd)/$1.gif"
echo "👉 $gif"
open -na Safari "file://$gif"
}
if which ffmpeg > /dev/null & which gifsicle > /dev/null; then
gifplease $1
exit 0
else
if ! which brew > /dev/null; then
echo "Install homebrew... I'm not doing that"
exit 1
fi
if ! which ffmpeg > /dev/null; then
brew install ffmpeg
fi
if ! which gifsicle > /dev/null; then
brew install gifsicle
fi
fi
gifplease $1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment