Created
March 28, 2018 09:26
-
-
Save knokmki612/c7e035bab50806cf8a04819793eb279a to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
TMP_DIR="$HOME/${0##*/}.$(openssl rand -base64 12 | tr +/ -_)" | |
mkdir "$TMP_DIR" | |
do_exit() { | |
rm -r "$TMP_DIR" | |
exit | |
} | |
trap 'do_exit' 1 2 3 15 | |
[ ! -f "$1" ] && do_exit | |
SRC="${1##*/}" | |
SRC_NAME="${SRC%.*}" | |
ffmpeg -i "$1" -vf \ | |
fps=10,scale=iw:-1:flags=lanczos,palettegen "${TMP_DIR}/palette.png" | |
ffmpeg -i "$1" -i "${TMP_DIR}/palette.png" -filter_complex \ | |
fps=10,scale=iw:-1:flags=lanczos[x]\;[x][1:v]paletteuse "${SRC_NAME}.gif" | |
do_exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment