A little shell script to put in your PATH if you forget the ffmpeg options to turn a video into an animated GIF.
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 | |
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=10,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