Skip to content

Instantly share code, notes, and snippets.

@franciscoj
Created August 4, 2016 14:50
Show Gist options
  • Save franciscoj/9abe1a7d25939685320078b32ab3db7b to your computer and use it in GitHub Desktop.
Save franciscoj/9abe1a7d25939685320078b32ab3db7b to your computer and use it in GitHub Desktop.
Transform a video into an animated gif.
#!/bin/sh
# Extracted from: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html#usage
palette="/tmp/palette.png"
filters="fps=15,scale=640:-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