Created
March 12, 2018 14:31
-
-
Save fbrinker/b33b4684a9ce3f812925eeebbe4d9ffa to your computer and use it in GitHub Desktop.
A small script to convert movies (tested with mpg files) into gifs. Usage: ./movieToGif.sh input.mpg [output.gif]
This file contains hidden or 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 | |
# dependencies: ffmpeg imgemagick | |
INPUT=$1 | |
OUTPUT=$2 | |
if [ -z ${2+x} ]; then | |
OUTPUT="$1.gif" | |
fi | |
mkdir /tmp/gif | |
echo "Converting..." | |
ffmpeg -loglevel panic -i $INPUT -vf scale=320:-1:flags=lanczos,fps=10 /tmp/gif/ffout%04d.png | |
echo "Generating gif..." | |
convert -loop 0 -delay 10 /tmp/gif/*.png $OUTPUT | |
echo "Cleaning up..." | |
rm -rf /tmp/gif | |
echo "Converted the movie into $OUTPUT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment