Skip to content

Instantly share code, notes, and snippets.

@wyattearp
Forked from synth/gist:d1045e129a5f35d87b69
Last active January 10, 2019 03:17
Show Gist options
  • Save wyattearp/5185e43d479cbbe80b7c016421795581 to your computer and use it in GitHub Desktop.
Save wyattearp/5185e43d479cbbe80b7c016421795581 to your computer and use it in GitHub Desktop.
High quality gifs on Linux from OctoPrint
#!/bin/bash
# used for turning octoprint items into timelapse gifs.
# usage ./mkgif.sh <input_movie> <output_gif>
# - error checking is for people who type things poorly :)
FPS=10
# Option 1
# http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
PALETTE="pallet-$1.png"
ffmpeg -y -i $1 -vf fps=$FPS,scale=800:-1:flags=lanczos,palettegen "$PALETTE"
ffmpeg -i $1 -i "$PALETTE" -filter_complex "fps=$FPS,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" $2
rm $PALETTE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment