Skip to content

Instantly share code, notes, and snippets.

@peterkappus
Created September 10, 2024 14:27
Show Gist options
  • Save peterkappus/096d36c157c9c7cf294ca51aab868f81 to your computer and use it in GitHub Desktop.
Save peterkappus/096d36c157c9c7cf294ca51aab868f81 to your computer and use it in GitHub Desktop.
Convert MOV to GIF
#!/bin/bash
# TIP: use Quicktime Player to capture a short screencast and convert to animated gif.
# Great for sharing software demos in chat/etc.
# Check if input and output file parameters are provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <input_file> <output_file>"
exit 1
fi
INPUT_FILE=$1
OUTPUT_FILE=$2
# Run the docker command with the provided filenames
docker run -i -v "$(pwd)":/data jrottenberg/ffmpeg \
-i "/data/$INPUT_FILE" \
-filter_complex "[0:v] fps=5,scale=480:-1,split [a][b];[a] palettegen=max_colors=16 [p];[b][p] paletteuse" \
"/data/$OUTPUT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment