Last active
June 28, 2020 13:15
-
-
Save gargolito/c4bda9274a27a41169a93afe9deddbd4 to your computer and use it in GitHub Desktop.
video to gif with good quality gif and compression
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
vid2gif() { | |
file=$(realpath $1) | |
name=$(basename ${file/.*}) | |
ffmpeg -y -i "${file}" -vf fps=${3:-24},scale=${2:-480}:-1:flags=lanczos,palettegen "${name}.png" | |
ffmpeg -y -i "${file}" -i "${name}.png" -filter_complex "fps=${3:-24},scale=${2:-480}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${name}".gif | |
rm "${name}.png" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment