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
Usage:
β Desktop ./gifit movie.mov π₯ Converting movie.mov to movie.gif frame= 177 fps= 22 q=-0.0 Lsize= 1644kB time=00:00:17.61 bitrate= 764.6kbits/s dup=0 drop=877 speed=2.16x gifsicle: warning: huge GIF, conserving memory (processing may take a while) π Complete in 0hrs 0min 26sec