Created
November 4, 2021 11:09
-
-
Save antdking/5bf1c09090f20b0f6a66d41b1157fbf6 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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
video_file="${1}" | |
palette_file="$(mktemp --suffix=.png)" | |
output_file="${video_file%.*}.gif" | |
function cleanup() { | |
rm -f "${palette_file}" | |
} | |
trap cleanup EXIT | |
ffmpeg -y -i "${video_file}" -vf palettegen "${palette_file}" | |
ffmpeg -i "${video_file}" -i "${palette_file}" -filter_complex paletteuse -r 10 "${output_file}" | |
echo "${output_file}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment