Skip to content

Instantly share code, notes, and snippets.

@zchee
Forked from nhooyr/zhostrc
Created March 13, 2016 04:55
Show Gist options
  • Save zchee/723ab1a05d53808615d7 to your computer and use it in GitHub Desktop.
Save zchee/723ab1a05d53808615d7 to your computer and use it in GitHub Desktop.
function vid2Gif {
if [[ $# != 3 ]]; then
print "too many or too less arguments"
return
fi
ffmpeg -y -i $1.mov -vf fps=10,scale=${2}:${3}:flags=lanczos,palettegen palette_$1.png
ffmpeg -i $1.mov -i palette_$1.png -filter_complex "fps=10,scale=${2}:${3}:flags=lanczos[x];[x][1:v]paletteuse" -f gif - | gifsicle --optimize=3 > $1.gif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment