Last active
December 11, 2015 18:49
-
-
Save oquno/4644756 to your computer and use it in GitHub Desktop.
script to convert .3gp file into animated 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
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