[MPlayer-users] Theora codec in mencoder
Bernhard Rosenkraenzer
bero at arklinux.org
Fri May 23 14:00:03 CEST 2003
On Fri, 23 May 2003, Lukasz Miller wrote:
Hi,
> Lately i builg my mplayer daily; i'm interested in this Theora codec.
> Is there a way to use it for encoding in mencoder?
While not mencoder, the attached script may help you - it converts
anything mplayer can play to theora using the encoder_example from theora
CVS.
Usage:
theora-encoder [-a x] [-A x] [-v x] [-V x] [-o x] [-aa x] [-va x] [-aspect
x] file
-a Set audio quality (-1 [worst] to 10 [best])
-A Set audio bitrate (not recommended, use -a instead)
-v Set video quality (0 [worst] to 10 [best])
-V Set video bitrate (not recommended, use -v instead)
-o Set output filename
-aa Pass an argument to the audio decoder [mplayer] unchanged
-va Pass an argument to the video decoder [mplayer] unchanged
(e.g. to use mplayer's deinterlacer:
theora-encoder -o test.ogg -va -vop -va pp=lb test.avi
-aspect Set the aspect ratio of the input file (usually
autodetected)
file input file name
--
Ark Linux - Linux for the masses
http://www.arklinux.org/
Redistribution and processing of this message is subject to
http://www.arklinux.org/terms.php
-------------- next part --------------
#!/bin/sh
# Theora encoder -- encodes any video file playable by mplayer to Theora
# (c) 2003 Ark Linux, written by Bernhard Rosenkraenzer <bero at arklinux.org>
#
# Released under the GNU GPL v2 or if, and only if, the GPL v2 is ruled
# invalid in a court of law, any subsequent version of the GPL.
#
ARGS=""
AUDIO=""
VIDEO=""
while [ "`echo $1 |cut -b1`" = "-" ]; do
case $1 in
-a|--audio-quality)
shift
ARGS="$ARGS -a $1"
;;
-A|--audio-bitrate)
shift
ARGS="$ARGS -A $1"
;;
-v|--video-quality)
shift
ARGS="$ARGS -v $1"
;;
-V|--video-bitrate)
shift
ARGS="$ARGS -V $1"
;;
-o|--output)
shift
DEST="$1"
if [ "`echo $DEST |cut -b1`" != "/" ]; then
DEST="`pwd`/$DEST"
fi
DEST="\"$DEST\""
ARGS="$ARGS -o $DEST"
;;
-aa|--audio-arg)
# Pass an argument to the audio decoder
shift
AUDIO="$AUDIO \"$1\""
;;
-va|--video-arg)
# Pass an argument to the video decoder
shift
VIDEO="$VIDEO \"$1\""
;;
-aspect)
# Aspect ratio of input file
shift
VIDEO="$VIDEO -aspect \"$1\""
;;
*)
echo "WARNING: Unknown option $1 ignored!" >&2
esac
shift
done
if [ -z "$1" -o "$#" != "1" ]; then
cat >&2 <<EOF
Usage: $0 [-a audioquality|-A audiobitrate] [-v videoquality|-V videobitrate] [-o outputfile] inputfile
EOF
exit 1
fi
SRC="$1"
if [ "`echo $SRC |cut -b1`" != "/" ]; then
SRC="`pwd`/$SRC"
fi
SRC="\"$SRC\""
DIR=`mktemp -d /tmp/theoraXXXXXX`
cat >$DIR/run.sh <<EOF
trap "rm -rf $DIR" 0 1 2 3 4 6 8 9 11 13 15
cd $DIR
mkfifo -m 0600 stream.yuv stream.wav
mplayer -ao pcm -aofile stream.wav -vo null -vc null $AUDIO $SRC &>mplayer-audio.log &
mplayer -vo yuv4mpeg -ao null -nosound $VIDEO $SRC &>mplayer-video.log &
encoder_example $ARGS stream.wav stream.yuv
rm -rf $DIR
EOF
chmod +x $DIR/run.sh
exec $DIR/run.sh
More information about the MPlayer-users
mailing list