Skip to content

Instantly share code, notes, and snippets.

@luciovilla
Forked from SlexAxton/.zshrc
Last active February 25, 2016 20:49
Show Gist options
  • Save luciovilla/670df6208b3d1c84e594 to your computer and use it in GitHub Desktop.
Save luciovilla/670df6208b3d1c84e594 to your computer and use it in GitHub Desktop.
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
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 - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
echo "proper usage: gifify <input_movie.mov>. You DO need to include extension."
fi
}
brew install ffmpeg
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install xquartz
# xquartz should install on its own. Search for xquartz application to verify.
brew install gifsicle
brew install imagemagick

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

Converting video file to GIF

  • gifify screencap.mov
  • gifify screencap.mov --good

Change the FPS to match video

Most videos are 24 fps so change '-r 10' from: ffmpeg -i $1 -r 10 to '-r 24' in order to match the video's fps.

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