Skip to content

Instantly share code, notes, and snippets.

@matiskay
Last active December 17, 2015 17:29
Show Gist options
  • Save matiskay/5646776 to your computer and use it in GitHub Desktop.
Save matiskay/5646776 to your computer and use it in GitHub Desktop.

My version of Gifify

Creates gif files from .mov files. This is really helpful for documentation and asking for help.

  • Remove CloudApp Dependency
  • Make it quiet.

URL: https://github.com/jclem/gifify

#!/bin/bash
function printHelpAndExit {
echo 'Usage:'
echo ' gifify -conx filename'
echo ''
echo 'Options: (all optional)'
echo ' c CROP: The x and y crops, from the top left of the image, i.e. 640:480'
echo ' o OUTPUT: The basename of the file to be output (default "output")'
echo ' x: Remove the original file and resulting .gif once the script is complete'
echo ''
echo 'Example:'
echo ' gifify -c 240:80 -o my-gif -x my-movie.mov'
exit $1
}
OPTERR=0
while getopts "c:o:x" opt; do
case $opt in
c) crop=$OPTARG;;
h) printHelpAndExit 0;;
o) output=$OPTARG;;
x) cleanup=1;;
*) printHelpAndExit 1;;
esac
done
shift $(( OPTIND - 1 ))
filename=$1
if [ -z ${output} ]; then
output=$filename
fi
if [ -z $filename ]; then printHelpAndExit 1; fi
if [ $crop ]; then
crop="-vf crop=${crop}:0:0"
else
crop=
fi
ffmpeg -loglevel panic -i $filename $crop -r 10 -f image2pipe -vcodec ppm - | convert +dither -layers Optimize - ${output}.gif
echo ${output}.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment