Forked from nateberkopec/gist:dbc942f18359891fbc0b
Last active
October 7, 2015 14:23
-
-
Save aslam/f27929409f5ee6a2a8e2 to your computer and use it in GitHub Desktop.
Script to turn videos in to GIFs
This file contains hidden or 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 | |
rm -rf ./.pngs | |
rm -rf ./.gifs | |
mkdir .pngs | |
mkdir .gifs | |
ffmpeg -i $1 -r 10 ./.pngs/out%04d.png | |
sips -s format gif ./.pngs/*.png --out ./.gifs | |
gifsicle ./.gifs/*.gif --optimize=3 --delay=3 --loopcount --resize 720x405 --colors=255 > $1.gif | |
gifsicle --unoptimize $1.gif | gifsicle --dither --colors 48 --resize-fit-width 512 -O2 `seq -f "#%g" 0 2 213` -o $1.optimized.gif | |
rm -rf $1.gif | |
rm -rf ./.pngs | |
rm -rf ./.gifs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment