Skip to content

Instantly share code, notes, and snippets.

@oquno
Last active December 11, 2015 18:49
Show Gist options
  • Save oquno/4644756 to your computer and use it in GitHub Desktop.
Save oquno/4644756 to your computer and use it in GitHub Desktop.
script to convert .3gp file into animated gif
if [ $# -eq 0 ]
then
echo "argument required"
exit
fi
wide=`ffmpeg -i $1 2>&1 | grep "DAR 16:9," | wc -l`
long=`ffmpeg -i $1 2>&1 | grep "DAR 9:16," | wc -l`
short=`ffmpeg -i $1 2>&1 | grep "DAR 3:4," | wc -l`
#sd=`ffmpeg -i $1 2>&1 | grep "DAR 4:3," | wc -l`
if [ $wide -eq 1 ]
then
aspect="480x270"
elif [ $long -eq 1 ]
then
aspect="270x480"
elif [ $short -eq 1 ]
then
aspect="300x400"
else
aspect="400x300"
fi
base=`echo "$1" | sed 's/.3gp//'`
ffmpeg -i $1 -f gif -pix_fmt rgb24 -r 8 -s $aspect $base.gif
mogrify $base.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment