Skip to content

Instantly share code, notes, and snippets.

@eheikes
Created September 7, 2017 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eheikes/9e7aefa1360f59b0f3137ec222fb4fc3 to your computer and use it in GitHub Desktop.
Save eheikes/9e7aefa1360f59b0f3137ec222fb4fc3 to your computer and use it in GitHub Desktop.
Convert video to gif using appropriate palette (no dithering)
#!/bin/sh
# From the great article at http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
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