Created
January 30, 2015 01:51
-
-
Save jorgemf/a7be22abdc60aebacf1f to your computer and use it in GitHub Desktop.
Shell script that converts a video to a gif file using ffmpeg and convert commands
This file contains 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/sh | |
if [ $# -eq 0 ]; then | |
echo "video2gif.sh [INPUT] [HEIGHT] [START] [LENGTH]" | |
exit | |
fi | |
INPUT=$1 | |
HEIGHT=$2 | |
INIT=$3 | |
LENGTH=$4 | |
ffmpeg -i $INPUT -vf scale=-1:$HEIGHT -ss $INIT -t $LENGTH -r 14 -f image2pipe -vcodec ppm - | convert -delay 7 -loop 0 -dither None -colors 80 -fuzz "40%" - gif:- | convert -layers Optimize - $INPUT-optimized.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment