Last active
August 29, 2015 14:00
-
-
Save artursapek/11453978 to your computer and use it in GitHub Desktop.
Convert .mov files to GIFs easily
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
brew install ffmpeg | |
brew install imagemagick | |
brew install libtool --universal | |
brew link libtool |
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
#!/bin/bash | |
# Usage: | |
# mov2gif input output dimensions(optional) | |
# mov2gif screen-capture.mov screen-capture.gif 400 | |
tmp_dir=/tmp/frames_$(date +%s) | |
mkdir $tmp_dir | |
if [ -z "$3" ] | |
then | |
size=600 | |
else | |
size=$3 | |
fi | |
echo "Converting $1 => $2 ($3 px wide)" | |
echo "Generating frames" | |
(ffmpeg -i $1 -vf scale=$size:-1 -r 10 $tmp_dir/ffout%03d.png) >& /dev/null | |
echo "Building gif from frames" | |
(convert -delay 5 -loop 0 $tmp_dir/ffout*.png $2) >& /dev/null | |
echo "Cleaning up" | |
rm -rf $tmp_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment