I am visitor from the "linux media" forum and thought I'd get a few ideas from here.
I tried your script but can't get it to work. I left it pretty much alone and only commented and uncommented a few lines. When I do "./[name of script] [file.avi], I get the following message:
Usage: $HOWCALLED <shrunk name> <file or mplayer source> [variable video bitrate kbs [$VBITRATE]]"
"result: (S,X)VCD and mpeg(1,2) encoded with $HOWCALLED."
or something close...I copied this message from the script as it is the closest. I'm away from my linux box now.
Here is a copy of the script if you care to look. As I said, I only changed a few "#" to make it work for the file.
-------------------------------------------------------------------------------------
#!/bin/bash
#
# Copyright (C) 2003-2038 russiansexpat
#
# script: mpeg(1,2,3,4) conversion to (S,X)VCD with quantisation matrix
# and auto-splitting into multiple CDs and writing them.
#
# requires: mencoder mplayer ffmpeg tcmplex vcdimager cdrdao
for exe in mencoder mplayer ffmpeg tcmplex vcdimager cdrdao; do
if [ -z "`which $exe`" ]; then
echo "ERROR: $exe must be in your path $PATH"
exit 1
fi
done
MATRIX="\
intra_matrix=\
8,9,12,22,26,27,29,34,\
9,10,14,26,27,29,34,37,\
12,14,18,27,29,34,37,38,\
22,26,27,31,36,37,38,40,\
26,27,29,36,39,38,40,48,\
27,29,34,37,38,40,48,58,\
29,34,37,38,40,48,58,69,\
34,37,38,40,48,58,69,79:\
inter_matrix=\
16,18,20,22,24,26,28,30,\
18,20,22,24,26,28,30,32,\
20,22,24,26,28,30,32,34,\
22,24,26,30,32,32,34,36,\
24,26,28,32,34,34,36,38,\
26,28,30,32,34,36,38,40,\
28,30,32,34,36,38,42,42,\
30,32,34,36,38,40,42,44\
"
VBITRATE=1152 # 1 = 1000 bits
#---------- below you can edit parameters ----------
SWS=0 # fast bilinear
#SWS=2 # bicubic (for upscaling)
#SWS=9 # lanczos (quality? slow)
VFILTER="denoise3d,eq2,"
#FPS=",telecine,lavcdeint -fps 29.97 -ofps 29.97"
FPS=" -ofps 29.97" # NTSC
#FPS=" -ofps 25" # PAL
#FPS=" -ofps 23.976" # NTSC pulldowned
#FPS=",ivtc=1 -ofps 23.976"
#FPS=" -ofps 10" # must for variable and progressive fps
# for vcd
WID=352
HEI=240
#HEI=288
VCODEC=mpeg1video
AUDIORATE=128
MUXMODE="-m 1 -F tcmplex.tmp"
IMAMODE="-t vcd2"
# for svcd
#WID=480
#HEI=480
#HEI=576
#VCODEC=mpeg2video
#AUDIORATE=224
#MUXMODE="-m s -F tcmplex.tmp"
#IMAMODE="-t svcd"
LAVCOPTS=":vlelim=-4:vcelim=7:lumi_mask=0.05:dark_mask=0.01"
PASS="single"
#PASS="1st 2nd"
NOTverbose="2> /dev/null"
#NOTverbose="&> /dev/null"
#CDSIZE=735 # 74min CD
CDSIZE=130 # 80min CD
#CDSIZE=895 # 90min CD
CDOPT="--force --reload --eject"
CDDEV="--device 0,0,0"
#---------- above you can edit parameters ----------
function usage() {
echo
echo "Usage: $HOWCALLED <shrunk name> <file or mplayer source> [variable video bitrate kbs [$VBITRATE]]"
echo
echo "result: (S,X)VCD and mpeg(1,2) encoded with $HOWCALLED."
echo
exit 1
}
HOWCALLED=`basename $0`
[ $# -lt 2 ] && usage
case $1 in
-*)
usage
;;
*)
NAME=$1
shift 1
;;
esac
DIR="`pwd`"
FILE=$1
if [ "$1" == "`basename \"$1\"`" ]; then
FILE="$DIR/$1"
fi
shift 1
if [ "$1"x != "x" ]; then
VBITRATE=$1
shift 1
fi
COMMAND_LINE_MENCODER=$*
rm -rf divx2pass.log
rm -rf frameno.avi
for word in $PASS ; do
VIDEO="video.mpg"
[ "$word" == "single" ] && pass=""
[ "$word" == "1st" ] && pass=":vpass=1"
[ "$word" == "1st" ] && VIDEO="/dev/null"
[ "$word" == "2nd" ] && pass=":vpass=2"
command="mencoder -sws $SWS -vf ${VFILTER}scale=$WID:-3,expand=0:$HEI${FPS} \
-forceidx -of mpeg -nosound \
-ovc lavc -lavcopts vcodec=$VCODEC:$MATRIX:mbd=2:vbitrate=$VBITRATE:vr c_minrate=300:vrc_maxrate=2300:vrc_buf_size=320:ke yint=25${LAVCOPTS}$pass \
$COMMAND_LINE_MENCODER $FILE -o $VIDEO"
echo "$command $NOTverbose"
eval "$command $NOTverbose"
done
rm -rf $NAME.mpv
eval "mplayer -noframedrop -vc dummy -vo null -dumpvideo -dumpfile $NAME.mpv $VIDEO &> /dev/null &"
AUDIO="audio.wav"
rm -f $AUDIO
mkfifo -m 660 $AUDIO
eval "mplayer -noframedrop -vc dummy -vo null -ao pcm -waveheader -aofile $AUDIO $FILE &> /dev/null &"
eval "ffmpeg -y -i $AUDIO -ab $AUDIORATE -ar 44100 -ac 2 -f mp2 $NAME.mpa &"
#eval "lame -h --abr $AUDIORATE --resample 44.1 - $NAME.mpa < $AUDIO &"
wait
rm -f $VIDEO
rm -f $AUDIO
rm -f $NAME??.mpg
echo "maxFileSize = $CDSIZE" > tcmplex.tmp
eval "tcmplex $MUXMODE -i $NAME.mpv -p $NAME.mpa -o $NAME.mpg"
rm -f tcmplex.tmp
for i in $NAME??.mpg; do
cue="`basename $i .mpg`.cue"
bin="`basename $i .mpg`.bin"
rm -f $cue $bin
eval "vcdimager $IMAMODE -c $cue -b $bin $i"
done
echo -e "\n$HOWCALLED encoding is completed in $SECONDS seconds.\n"
for cue in $NAME??.cue; do
bin="`basename $cue .cue`.bin"
echo "PLEASE INSERT BLANK CD IN CD-WRITER, after a keypress we start:"
read -n 1 null
eval "cdrdao write $CDOPT $CDDEV $cue"
echo "CD WRITING IS COMPLETED."
done
exit 0
# last line of this script