Skip to content

Commit

Permalink
Add gifify bash function to create super awesome PRs ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Feb 28, 2014
1 parent 9b3ad33 commit 29a3edf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions bash/functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# gifify - https://gist.github.com/SlexAxton/4989674

### install
# brew install ffmpeg
# brew tap phinze/homebrew-cask
# brew install brew-cask
# brew cask install x-quartz
# open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg
# # click through the stuff
# brew install gifsicle
# brew install imagemagick
#
# # I had a weird problem with Convert/imagemagick where I had to do:
# ln -s /usr/local/Cellar/libtool/2.4.2/lib/libltdl.7.dylib libltdl.7.dylib
# # But hopefully you don't have to

### usage

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

# gifify screencap.mov
# gifify screencap.mov --good

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
}
1 change: 1 addition & 0 deletions bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source ~/.bash/aliases
source ~/.bash/completions
source ~/.bash/config
source ~/.bash/functions

if [ -f ~/.bashrc ]; then
. ~/.bashrc
Expand Down

0 comments on commit 29a3edf

Please sign in to comment.