Skip to content

Instantly share code, notes, and snippets.

@hernan43
Created April 16, 2020 19:11
Show Gist options
  • Save hernan43/94b607594dcd9da4740145651bf56572 to your computer and use it in GitHub Desktop.
Save hernan43/94b607594dcd9da4740145651bf56572 to your computer and use it in GitHub Desktop.
Simple video file to GIF file using FFMPEG/ImageMagick script
#!/usr/bin/env bash
FFMPEG=/usr/local/bin/ffmpeg
CONVERT=/usr/local/bin/convert
if [ -z "$1" ] || [ -z "$2" ]
then
echo "Must specify an input video file and output gif file"
exit 1
fi
$FFMPEG -i $1 -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm - | $CONVERT -delay 5 -loop 0 - gif:- | $CONVERT -layers Optimize - $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment