Skip to content

Instantly share code, notes, and snippets.

@zinozzino
Created January 31, 2019 09:53
Show Gist options
  • Save zinozzino/a119ed1e89a558875151a3167878a959 to your computer and use it in GitHub Desktop.
Save zinozzino/a119ed1e89a558875151a3167878a959 to your computer and use it in GitHub Desktop.
mov to gif
#!/bin/bash
# Original Gist: https://gist.github.com/baumandm/1dba6a055356d183bbf7
# Requirements:
# ffmpeg ( install via `brew install ffmpeg` )
SOURCE=$1
DEST=${SOURCE%%.*}
PALETTE="$(python -c "import uuid; print(uuid.uuid4().hex, end='')").png"
if [ "${SOURCEi##*.}" -ne "mov" ]; then
echo "It supports only .mov file..."
exit 1
fi
ffmpeg -y -i "$SOURCE" -vf fps=10,palettegen "$PALETTE"
ffmpeg -i "$SOURCE" -i "$PALETTE" -filter_complex "fps=10,paletteuse" "$DEST.gif"
rm "$PALETTE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment