Skip to content

Instantly share code, notes, and snippets.

@huytd
Created Feb 3, 2022
Embed
What would you like to do?
if [[ $1 == "-h" ]] || [ $# == 0 ]; then
echo "Convert video to GIF"
echo "Usage:"
echo " video2gif <file-name> [width] [fps]"
else
ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png"
ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif
rm "${1}.png"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment