Last active
June 26, 2020 18:26
-
-
Save evantahler/10d2c62ff47dc53b0fe0934233c995ad to your computer and use it in GitHub Desktop.
Convert movies to animated gifs
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/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to https://gist.github.com/davidbarsky/18de6325f135116e20a5