[MEncoder-users] Sony DSC-M1 and Philips DVP642
Rick Richardson
rickr at mn.rr.com
Fri Aug 25 16:05:24 CEST 2006
Attached:
mp4toavi
$ mp4toavi
Usage:
mp4toavi [options] file ... dir
Convert Sony DSC-M1 .mp4's to .avi for Philips DVP-642 DVD player.
One pass:
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame \
-o dir/file.avi file.mp4
Two passes (the default):
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame \
-o dir/file.avi.tmp file.mp4
mencoder -oac copy -ovc copy -forceidx \
-o dir/file.avi dir/file.avi.tmp
Options:
-1 Do one pass (fast forward does a STOP player)
-2 Do two passes (fast forward advances to the next video)
-f Force even if AVI file exists.
-l lameopts Set lameopts (e.g. vol=9:vbr=0)
-D lvl Debug level
--
Rick Richardson rickr at mn.rr.com http://home.mn.rr.com/richardsons/
Linux printer driver for HP CLJ 2600n http://foo2hp.rkkda.com/
Linux printer driver (KM 2430 and HP 10xx) http://foo2zjs.rkkda.com/
Linux tools for geocaching http://geo.rkkda.com/
"your new name should be "lindos" and your slogan should be "because
it's the W that is causing all the problems."
-- Anonymous Lindows customer
-------------- next part --------------
#!/bin/sh
PROGNAME="$0"
usage() {
cat <<EOF
Usage:
`basename $PROGNAME` [options] file ... dir
Convert Sony DSC-M1 .mp4's to .avi for Philips DVP-642 DVD player.
One pass:
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame \\
-o dir/file.avi file.mp4
Two passes (the default):
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame \\
-o dir/file.avi.tmp file.mp4
mencoder -oac copy -ovc copy -forceidx \\
-o dir/file.avi dir/file.avi.tmp
Options:
-1 Do one pass (fast forward does a STOP player)
-2 Do two passes (fast forward advances to the next video)
-f Force even if AVI file exists.
-l lameopts Set lameopts (e.g. vol=9:vbr=0)
-D lvl Debug level
EOF
exit 1
}
#
# Report an error and exit
#
error() {
echo "`basename $PROGNAME`: $1" >&2
exit 1
}
debug() {
if [ $DEBUG -ge $1 ]; then
shift
echo "`basename $PROGNAME`: $*" >&2
fi
}
#
# Process the options
#
LAMEOPTS=vbr=0:vol=8
LAMEOPTS=
DEBUG=0
FORCE=0
PASS=2
while getopts "12fl:D:h?" opt
do
case $opt in
1) PASS=1;;
2) PASS=2;;
f) FORCE=1;;
l) LAMEOPTS="$OPTARG";;
D) DEBUG="$OPTARG";;
h|\?) usage;;
esac
done
shift `expr $OPTIND - 1`
if [ "$LAMEOPTS" != "" ]; then
LAMEOPTS="-lameopts $LAMEOPTS"
fi
if [ $# -lt 2 ]; then
usage
fi
#
# Main Program
#
files=
while [ $# -gt 1 ]; do
case "$1" in
*.mp4)
base=$(echo "$1" | sed -e "s/.mp4//")
files="$files $base"
;;
*)
error "Must be .mp4"
esac
shift
done
debug 2 "$files"
dir="$1"
if [ ! -d "$dir" ]; then
error "Last argument must be a directory."
fi
for i in $files; do
avi="$dir/$(basename $i).avi"
if [ -f "$avi" -a $FORCE = 0 ]; then
continue;
fi
if [ $PASS = 1 ]; then
debug 1 \
"mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame $LAMEOPTS"\
"-o $avi $i.mp4"
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame $LAMEOPTS \
-msglevel all=1 -really-quiet -o $avi $i.mp4 \
>/dev/null 2>&1
else
debug 1 \
"mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame $LAMEOPTS"\
"-o $avi.tmp $i.mp4"
mencoder -ffourcc DX50 -ovc copy -oac lavc -oac mp3lame $LAMEOPTS \
-msglevel all=1 -really-quiet -o $avi.tmp $i.mp4 \
>/dev/null 2>&1
debug 1 "mencoder -oac copy -ovc copy -forceidx -o $avi $avi.tmp"
mencoder -oac copy -ovc copy -forceidx -o $avi $avi.tmp \
>/dev/null 2>&1
rm -f $avi.tmp
fi
touch -d "$(stat -c "%y" $i.mp4)" $avi
done
More information about the MEncoder-users
mailing list