Last active
September 21, 2016 18:05
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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