Skip to content

Instantly share code, notes, and snippets.

@mutewinter
Forked from SlexAxton/.zshrc
Last active December 25, 2015 12:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutewinter/6976815 to your computer and use it in GitHub Desktop.
Save mutewinter/6976815 to your computer and use it in GitHub Desktop.
# Sweet Gif Creation from .mov
#
# Adapted from https://gist.github.com/SlexAxton/4989674
gifify() {
if [[ -n "$1" ]]; then
GIF="${1%.*}.gif"
if [[ $2 == '--bad' ]]; then
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $GIF
else
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $GIF
rm out-static*.png
fi
else
echo "proper usage: gifify <input_movie.mov>. You DO need to include extension."
fi
}

Install

brew install ffmpeg
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install x-quartz
open /opt/homebrew-cask/Caskroom/x-quartz/2.7.4/XQuartz.pkg
brew install gifsicle
brew install imagemagick

Usage

Take screencast using Quicktime. Export as high quality as possible.

gifify screencap.mov
gifify screencap.mov --bad # lower quality
@mutewinter
Copy link
Author

Default to --good from forked snippet and change file extension to .gif instead of .mov.gif.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment