#!/bin/sh
FILENAME=$1
BASENAME=`basename $FILENAME .mp4`
FPS=1
if [ $# -ge 2 ]; then
FPS=$2
fi
ffmpeg -i $FILENAME -f image2 -vf fps=$FPS tmp/${BASENAME}.%3d.png
convert -delay 50 -loop 0 tmp/${BASENAME}.*.png ${BASENAME}.gif
rm -f tmp/${BASENAME}.*.png