Skip to content

Instantly share code, notes, and snippets.

@marty-Wallace
Created February 14, 2018 21:09
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 marty-Wallace/e64d97adf20546e4299c300f8bcffcd6 to your computer and use it in GitHub Desktop.
Save marty-Wallace/e64d97adf20546e4299c300f8bcffcd6 to your computer and use it in GitHub Desktop.
Encode a .ogv to a .gif. Requires ffmpeg
#!/bin/bash
inputFile=$1
FPS=15
WIDTH=1200
#Generate palette for better quality
ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png
#Generate gif using palette
ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
rm tmp_palette.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment