-
-
Save edsu/c30a615400515535e02bf67bd8f8274a to your computer and use it in GitHub Desktop.
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 | |
# Turn a video file into an animated GIF | |
USAGE="usage: gif video_file [gif_file]" | |
video_file=$1 | |
if [ "$video_file" = "" ]; then | |
echo $USAGE | |
exit 1 | |
elif [ $2 ]; then | |
gif_file=$2 | |
else | |
gif_file="${video_file%.*}.gif" | |
fi | |
echo "converting ${video_file} to ${gif_file} ..." | |
ffmpeg -i "${video_file}" -vf "fps=5,scale=1000:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "${gif_file}" -loglevel error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment