Skip to content

Instantly share code, notes, and snippets.

@mattstabeler
Created December 15, 2016 17:05
Show Gist options
  • Save mattstabeler/2231b0bed4a7c45e7ef628286ead0660 to your computer and use it in GitHub Desktop.
Save mattstabeler/2231b0bed4a7c45e7ef628286ead0660 to your computer and use it in GitHub Desktop.
convert a movie file to a gif
#!/bin/bash
# assumes you have ffmpeg - brew install ffmpeg
if [ -z "$1" ]; then
echo "No input file"
exit
fi
if [ -z "$2" ]; then
echo "No output file"
exit
fi
RATE=$3
if [ -z "$3" ]; then
echo "No Framerate, using 10fps"
RATE=10
fi
ffmpeg -ss 00:00:00.000 -i $1 -pix_fmt rgb24 -r $RATE $2
# Limit the length:
# ffmpeg -ss 00:00:00.000 -i $1 -pix_fmt rgb24 -r 10 -t 00:00:10.000 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment