Last active
March 18, 2019 21:31
-
-
Save nicholasspencer/b4db446fa952f192d909fc7f8d20d554 to your computer and use it in GitHub Desktop.
Quicktime Screen Recording to GIF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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