Created
December 10, 2020 22:04
-
-
Save k0ff33/bb404dd5751956951810e5bd2816a965 to your computer and use it in GitHub Desktop.
Convert and optimise video to gif
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
usage="usage: gifenc [input.mov] [output.gif] [resolution] [fps]" | |
if [ $# -ne 4 ]; then | |
echo "$usage" | |
exit 1 | |
fi | |
palette="/tmp/palette.png" | |
filters="fps=$4,scale=$3:-1:flags=lanczos" | |
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette" | |
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment