Skip to content

Instantly share code, notes, and snippets.

@JCash
Created July 17, 2016 10:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JCash/dda6e6804c011b645a80abad96775645 to your computer and use it in GitHub Desktop.
Save JCash/dda6e6804c011b645a80abad96775645 to your computer and use it in GitHub Desktop.
A quick way to convert Defold video (.ivf) into a compressed .gif
#!/usr/bin/env bash
FPS=15
SIZEPX=320
STARTTIME=0
DURATION=0
PALETTE="/tmp/palette.png"
TMPGIF="/tmp/$2"
FILTERS="fps=$FPS,scale=$SIZEPX:-1:flags=lanczos"
ffmpeg -v warning -ss $STARTTIME -t $DURATION -i $1 -vf "$FILTERS,palettegen" -y $PALETTE
ffmpeg -v warning -ss $STARTTIME -t $DURATION -i $1 -i $PALETTE -lavfi "$FILTERS [x]; [x][1:v] paletteuse" -y $TMPGIF
gifsicle -O1 --lossy=80 -i $TMPGIF -o $2
rm $PALETTE
rm $TMPGIF
@JCash
Copy link
Author

JCash commented Jul 17, 2016

$ ./make_gif_from_video.sh ~/defold_rec.ivf output.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment