Skip to content

Instantly share code, notes, and snippets.

@kevinn
Last active March 31, 2017 04:27
Show Gist options
  • Save kevinn/f9e5aa9c29f37b3ed83be3d4b01b79a8 to your computer and use it in GitHub Desktop.
Save kevinn/f9e5aa9c29f37b3ed83be3d4b01b79a8 to your computer and use it in GitHub Desktop.
High quality video to gif encoding using ffmpeg. From http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
#!/bin/sh
# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
# usage: ./gifenc.sh [input].mov [output].gif
palette="palette.png"
filters="fps=15,scale=-1:-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