Skip to content

Instantly share code, notes, and snippets.

@raineorshine
Created July 12, 2020 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raineorshine/121168942e6784dd9bec431ef3eed3a1 to your computer and use it in GitHub Desktop.
Save raineorshine/121168942e6784dd9bec431ef3eed3a1 to your computer and use it in GitHub Desktop.
Convert a video to an animated gif (with small file size!)
# convert a video to an animated gif
# requires ffmpeg and gifsicle
togif() {
if [ $# -lt 1 ]
then
echo "Converts a video to a compressed, animated gif. Outputs to INPUT.xyz.gif"
echo ""
echo "Usage:"
echo "togif input.mov"
return 1
else
ffmpeg -i "$@" -r 25 -f gif - | gifsicle --optimize=3 --lossy=90 --scale 0.5 --colors=32 > "$@.gif"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment