Skip to content

Instantly share code, notes, and snippets.

@misebox
Created June 21, 2023 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misebox/5461553f46de5b2d4e015ad1775d7dc3 to your computer and use it in GitHub Desktop.
Save misebox/5461553f46de5b2d4e015ad1775d7dc3 to your computer and use it in GitHub Desktop.
The tool that converts a movie file to a compact animation GIF with ffmpeg
#!/bin/bash
if [ $# -lt 1 ]
then
echo "usage: $0 <input video file>"
fi
INPUT_FILE="$1"
OUTPUT_FILE=`echo ${INPUT_FILE} | sed -E 's/\.[^\.]*$//'`.gif
ffmpeg \
-i ${INPUT_FILE} \
-filter_complex "[0:v] fps=10,scale=640:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" \
${OUTPUT_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment