Skip to content

Instantly share code, notes, and snippets.

@s4y
Last active September 21, 2016 18:05
Show Gist options
  • Select an option

  • Save s4y/66cb75f1645e2b9e344c44ca16155cb1 to your computer and use it in GitHub Desktop.

Select an option

Save s4y/66cb75f1645e2b9e344c44ca16155cb1 to your computer and use it in GitHub Desktop.
Little shell script to make a (nice-looking!) animated gif from a video with ffmpeg.
#!/bin/bash
set -euo pipefail
if [[ $# < 1 || $# > 2 ]]; then
echo "usage: $0 input.mov [filtergraph]" 1>&2
exit 1
fi
infile="$1"; shift
outfile="${infile%.*}.gif"
if [[ $# > 0 ]]; then
filter="$1, "
else
filter=""
fi
ffmpeg -i "$infile" -filter "$filter"'split[s1][s2], [s1]palettegen[p], [s2]fifo[s2], [s2][p]paletteuse' "$outfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment