Skip to content

Instantly share code, notes, and snippets.

@gargolito
Last active June 28, 2020 13:15
Show Gist options
  • Save gargolito/c4bda9274a27a41169a93afe9deddbd4 to your computer and use it in GitHub Desktop.
Save gargolito/c4bda9274a27a41169a93afe9deddbd4 to your computer and use it in GitHub Desktop.
video to gif with good quality gif and compression
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