Megatog615
Member
- Joined
- Dec 25, 2006
- Messages
- 163
CODE
#!/bin/bash
# Copyright (C) 2007 Evan Goers
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Input/Output Files(Do not change):
INPUTFILE="$1"
OUTPUTFILE="$(echo $INPUTFILE | sed 's_^.*/(.*)\.[^.]*$_\1_')"
OUTPUTDIR="$2"
# Current pass(this is the starting number; do not edit):
PASS="1"
function convert {
nice \
ffmpeg -i $INPUTFILE \
-pass $PASS \
-vcodec mpeg4 \
-vtag DIVX \
-s 320x240 \
-r 29.97 \
-aspect 4:3 \
-acodec mp2 \
-ar 44100 \
-ab 192k \
$OUTPUTDIR/$OUTPUTFILE.gp2x.avi
}
function credits {
echo "GP2X ffmpeg video conversion script."
echo "Most of the work was done by me, Evan Goers."
echo "A couple other things done by David Severwright."
}
function usage {
echo "Usage:"
echo "gp2xconvert <inputfile> [outputdir]"
echo "inputfile must exist. After the conversion is done,"
echo "a file named <inputfile>.gp2x.avi will be present"
echo "in the current directory(default), or another directory"
echo "of your choice, indicated by the second argument."
}
if [ -z $1 ]; then
usage;
exit 1
fi
if [ -z $2 ]; then
OUTPUTDIR="."
else
OUTPUTDIR="$2"
fi
if [ -e $INPUTFILE ]; then
credits;
convert;
PASS="2"
convert;
exit 0
else
echo '"$INPUTFILE" does not exist. Please try again.'
usage;
exit 1
fi
(Updated 09/08/07)
Please provide improvements. I also released this(or tried to for that matter) under the GPLv2. If I implemented the GPL license wrong(or if it's better that I shouldn't), please inform me. I will correct it as soon as I can. It is the first time I've ever used the GPL license so please forgive me for any mistakes.
I'm not sure of the best and most optimized video specs that the GP2X can handle. However, videos converted with this script will and do work on the GP2X. If someone could help me get the best optimized conversion values that would be nice.
#!/bin/bash
# Copyright (C) 2007 Evan Goers
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Input/Output Files(Do not change):
INPUTFILE="$1"
OUTPUTFILE="$(echo $INPUTFILE | sed 's_^.*/(.*)\.[^.]*$_\1_')"
OUTPUTDIR="$2"
# Current pass(this is the starting number; do not edit):
PASS="1"
function convert {
nice \
ffmpeg -i $INPUTFILE \
-pass $PASS \
-vcodec mpeg4 \
-vtag DIVX \
-s 320x240 \
-r 29.97 \
-aspect 4:3 \
-acodec mp2 \
-ar 44100 \
-ab 192k \
$OUTPUTDIR/$OUTPUTFILE.gp2x.avi
}
function credits {
echo "GP2X ffmpeg video conversion script."
echo "Most of the work was done by me, Evan Goers."
echo "A couple other things done by David Severwright."
}
function usage {
echo "Usage:"
echo "gp2xconvert <inputfile> [outputdir]"
echo "inputfile must exist. After the conversion is done,"
echo "a file named <inputfile>.gp2x.avi will be present"
echo "in the current directory(default), or another directory"
echo "of your choice, indicated by the second argument."
}
if [ -z $1 ]; then
usage;
exit 1
fi
if [ -z $2 ]; then
OUTPUTDIR="."
else
OUTPUTDIR="$2"
fi
if [ -e $INPUTFILE ]; then
credits;
convert;
PASS="2"
convert;
exit 0
else
echo '"$INPUTFILE" does not exist. Please try again.'
usage;
exit 1
fi
(Updated 09/08/07)
Please provide improvements. I also released this(or tried to for that matter) under the GPLv2. If I implemented the GPL license wrong(or if it's better that I shouldn't), please inform me. I will correct it as soon as I can. It is the first time I've ever used the GPL license so please forgive me for any mistakes.
I'm not sure of the best and most optimized video specs that the GP2X can handle. However, videos converted with this script will and do work on the GP2X. If someone could help me get the best optimized conversion values that would be nice.
Last edited by a moderator: