Last active
August 29, 2015 14:17
-
-
Save artursapek/5b3d15ecac5ff75593c4 to your computer and use it in GitHub Desktop.
mov2gif
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
#!/bin/bash | |
# mov2giv in out width | |
# mov2gif video_file_in.mov gif_file_out.gif 300 | |
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