Skip to content

Instantly share code, notes, and snippets.

@evantahler
Last active June 26, 2020 18:26
Show Gist options
  • Save evantahler/10d2c62ff47dc53b0fe0934233c995ad to your computer and use it in GitHub Desktop.
Save evantahler/10d2c62ff47dc53b0fe0934233c995ad to your computer and use it in GitHub Desktop.
Convert movies to animated gifs
#!/bin/bash
# This script required ffmpeg and gifsicle
# On OSX: `brew install ffmpeg gifsicle`
SECONDS=0
INPUT_FILE=$1
BASENAME="${INPUT_FILE%.*}"
OUTPUT_FILE="$BASENAME.gif"
echo "🎥 Converting $INPUT_FILE to $OUTPUT_FILE"
ffmpeg -i $INPUT_FILE -pix_fmt rgb8 -r 10 $OUTPUT_FILE -loglevel warning -stats && gifsicle -O3 $OUTPUT_FILE -o $OUTPUT_FILE
ELAPSED="$(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
echo "🎉 Complete in $ELAPSED"
@evantahler
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment