Skip to content

Instantly share code, notes, and snippets.

@ikonst
Last active October 2, 2019 15:47
Show Gist options
  • Save ikonst/00447a2df9dc8fcb8bfb to your computer and use it in GitHub Desktop.
Save ikonst/00447a2df9dc8fcb8bfb to your computer and use it in GitHub Desktop.
#!/bin/sh -e
# Converts a Quicktime movie to a GIF aniamtion.
# Useful for screen recordings.
# Preliminary step with palette required to make it look good
# without dithering artifacts.
FPS=10
PALETTE=$(mktemp).png
MOV=$1
GIF=$2
[[ -n "$MOV" && -n "$GIF" ]] || {
echo "Syntax: $0 [mov] [gif]"
exit 1
}
which ffmpeg || {
echo "Error: ffmpeg not found"
exit 1
}
ffmpeg -i "$MOV" -vf palettegen $PALETTE
ffmpeg -i "$MOV" -i $PALETTE -r $FPS -lavfi paletteuse "$GIF"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment