2002-04-11 22:53:48 +00:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
2003-05-30 17:37:33 +00:00
|
|
|
|
# Version: 0.2.2
|
2002-04-11 22:53:48 +00:00
|
|
|
|
#
|
|
|
|
|
# Licence: GPL
|
|
|
|
|
#
|
2002-09-21 21:54:42 +00:00
|
|
|
|
# 2002/09/21 J<>rgen Hammelmann <juergen.hammelmann@gmx.de>
|
2002-04-11 22:53:48 +00:00
|
|
|
|
#
|
|
|
|
|
# Script: MPlayer Sources (DVD) to (S)VCD ripping and burning
|
|
|
|
|
#
|
2002-11-02 17:27:23 +00:00
|
|
|
|
# requires: mplayer
|
|
|
|
|
# mjpegtools
|
2002-04-11 22:53:48 +00:00
|
|
|
|
# vcdimager
|
|
|
|
|
# cdrdao
|
2002-11-02 17:27:23 +00:00
|
|
|
|
# lame (optionally)
|
|
|
|
|
# toolame (optionally)
|
|
|
|
|
# sox (optionally)
|
2002-09-21 21:54:42 +00:00
|
|
|
|
|
|
|
|
|
for exe in mplayer mpeg2enc mp2enc mplex yuvscaler ; do
|
|
|
|
|
if [ -z "`which $exe`" ]; then
|
|
|
|
|
echo "ERROR: $exe must be in your path $PATH!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
2003-05-30 17:37:33 +00:00
|
|
|
|
for exe in vcdimager lame cdrdao yuvdenoise sox toolame normalize; do
|
2002-09-21 21:54:42 +00:00
|
|
|
|
if [ -z "`which $exe`" ]; then
|
|
|
|
|
echo "WARNING: $exe is not found in your path $PATH!"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2002-04-11 22:53:48 +00:00
|
|
|
|
################################################################################
|
|
|
|
|
#
|
2002-04-15 14:01:07 +00:00
|
|
|
|
# 2002/04/11 v0.1.0: first version
|
|
|
|
|
# 2002/04/12 v0.1.1:
|
|
|
|
|
# 2002/04/14 v0.1.2:
|
2002-04-18 17:41:54 +00:00
|
|
|
|
# - handles now multiple vcd's
|
|
|
|
|
# - support's mp3 audio as option
|
|
|
|
|
# - use of mp2enc/lame instead of toolame because of support
|
|
|
|
|
# of resampling and mp3
|
|
|
|
|
# 2002/04/16 v0.1.3:
|
|
|
|
|
# - new option "-burnonly"
|
|
|
|
|
# - new option "-vbr"
|
|
|
|
|
# - removes mpg file after mastering cd image
|
|
|
|
|
# (mplayer can read bin images!)
|
2002-04-22 09:42:34 +00:00
|
|
|
|
# - bugfixes
|
|
|
|
|
# 2002/04/22 v0.1.4
|
|
|
|
|
# - bugfixes / changes
|
|
|
|
|
# - more options
|
2002-05-07 08:39:22 +00:00
|
|
|
|
# 2002/05/06 v0.1.5
|
|
|
|
|
# - new option "-norm"
|
2002-05-09 10:27:36 +00:00
|
|
|
|
# 2002/05/08 v0.1.6
|
|
|
|
|
# - bugfixes
|
|
|
|
|
# - new option "-vfr"
|
|
|
|
|
# - "-norm" renamed to "-vnorm"
|
2002-05-17 05:45:30 +00:00
|
|
|
|
# 2002/05/15 v0.1.7
|
|
|
|
|
# - bugfixes
|
|
|
|
|
# - more help
|
2002-05-31 21:44:39 +00:00
|
|
|
|
# 2002/05/26 v0.1.8
|
|
|
|
|
# - new option "-sync"
|
2002-06-22 23:49:50 +00:00
|
|
|
|
# 2002/06/19 v0.1.9
|
|
|
|
|
# - new option "-mpgonly"
|
2002-09-21 21:54:42 +00:00
|
|
|
|
# 2002/09/21 v0.1.10
|
|
|
|
|
# - bug fixes
|
|
|
|
|
# - tests now, if the commands are in path and give warnings
|
|
|
|
|
# and errors.
|
2002-11-02 17:27:23 +00:00
|
|
|
|
# 2002/11/01 v0.2
|
|
|
|
|
# - bug fixes
|
|
|
|
|
# - new options: "-sox", "-volume", "-toolame"
|
|
|
|
|
# - renamed "-mpg" to "-mpegsrc"
|
|
|
|
|
# - default cd size changed to 800mb
|
2003-05-30 17:37:33 +00:00
|
|
|
|
# 2002/11/18 v0.2.1
|
|
|
|
|
# - aspect ratio for vcd's, too
|
|
|
|
|
# - pulldown mode...
|
|
|
|
|
# 2002/12/01 v0.2.2
|
|
|
|
|
# - -normalize
|
2002-04-15 14:01:07 +00:00
|
|
|
|
#
|
|
|
|
|
################################################################################
|
|
|
|
|
#
|
|
|
|
|
# global config section, change them to your needs!
|
2002-04-11 22:53:48 +00:00
|
|
|
|
|
|
|
|
|
TMPDIR="." # path to directory for creating temporary files, recommended 2-3GB space
|
|
|
|
|
|
2002-11-02 17:27:23 +00:00
|
|
|
|
CDDRV="generic-mmc" # cdrdao: cdwriter driver
|
|
|
|
|
CDDEV="--device 0,1,0" # or comment out and create link /dev/cdrecorder
|
|
|
|
|
# to your cdwriter dev
|
|
|
|
|
CDMAXSIZE=800
|
2002-04-15 14:01:07 +00:00
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
AUDIO="audiodump.wav"
|
|
|
|
|
VIDEO="stream.yuv"
|
2002-04-22 09:42:34 +00:00
|
|
|
|
VCDMODE=2
|
|
|
|
|
SVCDMODE=5
|
2002-04-11 22:53:48 +00:00
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
function usage() {
|
2003-05-30 17:37:33 +00:00
|
|
|
|
echo "Usage: $HOWCALLED <basename> [$HOWCALLED options] [mplayer options]"
|
|
|
|
|
echo
|
|
|
|
|
echo " <basename> is used as basename of the resulting mpg/bin files."
|
2002-11-02 17:27:23 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "For mplayer options see mplayer help and manual."
|
2002-04-11 22:53:48 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "$HOWCALLED options:"
|
|
|
|
|
echo
|
2002-11-02 17:27:23 +00:00
|
|
|
|
echo "-?|-h help."
|
|
|
|
|
echo "-a <n> sets the aspect ratio (for SVCD):"
|
|
|
|
|
echo " 1 - 1:1 display"
|
|
|
|
|
echo " 2 - 4:3 display"
|
|
|
|
|
echo " 3 - 16:9 display"
|
|
|
|
|
echo " 4 - 2.21:1 display"
|
|
|
|
|
echo "-abr <n> output audio bitrate in kbs [224]."
|
|
|
|
|
echo "-asr <n> output audio sample rate in Hz [44100]."
|
|
|
|
|
echo "-blank cleans cd-rw before burning."
|
|
|
|
|
echo "-burnonly burn only the premastered <name>*.cue/<name>*.bin images."
|
|
|
|
|
echo "-cdsize <n> maximal size of cd images [800 = 80min raw cd]."
|
|
|
|
|
echo "-denoise denoises mpeg stream."
|
|
|
|
|
echo "-mp3 outputs audio in mp3 instead of mp2 format."
|
|
|
|
|
echo "-mpegsrc don't encode from source, multiplex/burn the "
|
|
|
|
|
echo " encoded mpg stream."
|
|
|
|
|
echo "-mpgonly do only encoding to mpeg 1/2 format."
|
|
|
|
|
echo "-noburn disables burning."
|
2003-05-30 17:37:33 +00:00
|
|
|
|
echo "-normalize use 'normalize'."
|
|
|
|
|
echo "-overburn enables overburning a cd."
|
|
|
|
|
echo "-pulldown enable pulldown mode in output."
|
2002-11-02 17:27:23 +00:00
|
|
|
|
echo "-ratio <s> output ratio size of frames, see yuvscaler (1)."
|
|
|
|
|
echo "-size <X>x<Y> sets output size of frames."
|
|
|
|
|
echo "-sox use sox for audio resampling."
|
|
|
|
|
echo "-svcdout encode to SVCD format [VCD default]."
|
|
|
|
|
echo "-sync <n> set the presentation timestamp offset of video"
|
|
|
|
|
echo " stream w.r.t. audio stream (video-audio) in mSec."
|
|
|
|
|
echo "-toolame use toolame instead of mp2enc."
|
|
|
|
|
echo "-v <volume> change amplitude (floating point); less than 1.0"
|
|
|
|
|
echo " decreases, greater than 1.0 increases. Use that only"
|
|
|
|
|
echo " together with sox!"
|
|
|
|
|
echo "-vbr <n> output video bitrate in kbs [VCD:1152, SVCD:2500]."
|
|
|
|
|
echo "-vfr <n> sets the frame-rate of the output-stream. Currently"
|
|
|
|
|
echo " only the standard MPEG rates are supported:"
|
|
|
|
|
echo " 0 - illegal"
|
|
|
|
|
echo " 1 - 24000.0/1001.0 (NTSC 3:2 pulldown converted FILM)"
|
|
|
|
|
echo " 2 - 24.0 (NATIVE FILM)"
|
|
|
|
|
echo " 3 - 25.0 (PAL/SECAM VIDEO / converted FILM)"
|
|
|
|
|
echo " 4 - 30000.0/1001.0 (NTSC VIDEO)"
|
|
|
|
|
echo " 5 - 30.0"
|
|
|
|
|
echo " 6 - 50.0 (PAL FIELD RATE)"
|
|
|
|
|
echo " 7 - 60000.0/1001.0 (NTSC FIELD RATE)"
|
|
|
|
|
echo " 8 - 60.0"
|
|
|
|
|
echo "-vnorm <p|n|s> sets the input video norm p, n or s:"
|
|
|
|
|
echo " forces the input stream to be treated as PAL|NTSC|SECAM"
|
|
|
|
|
echo " regardless of what the stream header might suggest."
|
|
|
|
|
echo "-w outputs in wide screen format 16:9."
|
2002-05-17 05:45:30 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "examples:"
|
|
|
|
|
echo
|
2002-11-02 17:27:23 +00:00
|
|
|
|
echo "'$HOWCALLED teneriffa teneriffa.avi'"
|
|
|
|
|
echo "this creates a VCD from an avi file."
|
|
|
|
|
echo
|
2003-07-09 20:10:48 +00:00
|
|
|
|
echo "'$HOWCALLED crazy dvd://3 -w':"
|
2002-05-17 05:45:30 +00:00
|
|
|
|
echo "encodes and burns dvd title 3 to VCD in 16:9."
|
2002-04-11 22:53:48 +00:00
|
|
|
|
echo
|
2003-07-09 20:10:48 +00:00
|
|
|
|
echo "'$HOWCALLED carter dvd://1 -sid 0 -aid 128 -ss 3:00 -frames 1500 \\"
|
2002-05-17 05:45:30 +00:00
|
|
|
|
echo " -noburn -vnorm n -vfr 1':"
|
|
|
|
|
echo "this encodes 1500 frames of dvd title 1 with subtitle 0 and audio stream"
|
|
|
|
|
echo "128 starting from 3:00 with frame rate 29.97 fps and input video norm NTSC"
|
|
|
|
|
echo "and output frame rate 23.98 fps because of the 3:2 pulldown method in NTSC."
|
2003-05-30 17:37:33 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "'$HOWCALLED bj -size 640x272 -vop expand=640:480:0:104:0 \\"
|
|
|
|
|
echo " -cdsize 645 -noburn bj.avi'"
|
|
|
|
|
echo "this example above shows you, how to deal with movies which are not"
|
|
|
|
|
echo "created with aspect ratios of 4:3 or 16:9."
|
2002-04-11 22:53:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HOWCALLED=`basename $0`
|
|
|
|
|
if [ $# -le 1 ]; then
|
|
|
|
|
usage
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2003-05-30 17:37:33 +00:00
|
|
|
|
case $1 in
|
|
|
|
|
-*)
|
|
|
|
|
usage
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
NAME=$1
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2002-04-11 22:53:48 +00:00
|
|
|
|
|
|
|
|
|
cd $TMPDIR
|
2002-04-15 14:01:07 +00:00
|
|
|
|
rm -f $VIDEO
|
|
|
|
|
rm -f $AUDIO
|
|
|
|
|
# create a named pipe for video stream
|
|
|
|
|
mkfifo -m 660 $VIDEO
|
2002-04-11 22:53:48 +00:00
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
# some inits
|
2002-04-22 09:42:34 +00:00
|
|
|
|
sub=""
|
|
|
|
|
size=""
|
2002-11-02 17:27:23 +00:00
|
|
|
|
aratio=""
|
2002-04-22 09:42:34 +00:00
|
|
|
|
ratio=""
|
2002-04-11 22:53:48 +00:00
|
|
|
|
params=""
|
|
|
|
|
wide=""
|
|
|
|
|
blank=0
|
|
|
|
|
burn=1
|
2002-04-18 17:41:54 +00:00
|
|
|
|
burnonly=0
|
2002-04-15 14:01:07 +00:00
|
|
|
|
mp3=0
|
2002-06-22 23:49:50 +00:00
|
|
|
|
mpgonly=0
|
2002-04-11 22:53:48 +00:00
|
|
|
|
mkstream=1
|
|
|
|
|
abr=224
|
2002-04-15 14:01:07 +00:00
|
|
|
|
abrset=0
|
|
|
|
|
asr=44100
|
2002-04-18 17:41:54 +00:00
|
|
|
|
vbr=1152
|
|
|
|
|
vbrset=0
|
2002-04-11 22:53:48 +00:00
|
|
|
|
denoise="cat -"
|
2003-06-03 18:48:03 +00:00
|
|
|
|
vnorm="VCD"
|
2002-04-22 09:42:34 +00:00
|
|
|
|
mplexnorm="-f $VCDMODE -m 1 -V -b 46"
|
2002-04-11 22:53:48 +00:00
|
|
|
|
imaget="-t vcd2"
|
2002-05-17 05:45:30 +00:00
|
|
|
|
yuvin=""
|
2002-05-09 10:27:36 +00:00
|
|
|
|
framerate=""
|
2002-05-31 21:44:39 +00:00
|
|
|
|
sync=""
|
2002-11-02 17:27:23 +00:00
|
|
|
|
sox=0
|
|
|
|
|
toolame=0
|
|
|
|
|
volume="1.0"
|
2003-05-30 17:37:33 +00:00
|
|
|
|
overburn=""
|
|
|
|
|
pd=""
|
|
|
|
|
norm=0
|
2002-04-18 17:41:54 +00:00
|
|
|
|
|
2002-04-11 22:53:48 +00:00
|
|
|
|
while [ "$1"x != "x" ]; do
|
|
|
|
|
case $1 in
|
2002-11-02 17:27:23 +00:00
|
|
|
|
-a)
|
|
|
|
|
aratio="-a $2"
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-04-11 22:53:48 +00:00
|
|
|
|
-w)
|
|
|
|
|
wide="-M WIDE2STD"
|
|
|
|
|
;;
|
2002-04-15 14:01:07 +00:00
|
|
|
|
-h|-?)
|
|
|
|
|
usage
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
2002-04-11 22:53:48 +00:00
|
|
|
|
-abr)
|
|
|
|
|
abr=$2
|
2002-04-15 14:01:07 +00:00
|
|
|
|
abrset=1
|
2002-04-11 22:53:48 +00:00
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
-asr)
|
2002-04-15 14:01:07 +00:00
|
|
|
|
asr=$2
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
-cdsize)
|
2002-11-02 17:27:23 +00:00
|
|
|
|
CDMAXSIZE=$2
|
2002-04-11 22:53:48 +00:00
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
-blank)
|
|
|
|
|
blank=1
|
|
|
|
|
;;
|
|
|
|
|
-noburn)
|
|
|
|
|
burn=0
|
|
|
|
|
;;
|
2002-04-18 17:41:54 +00:00
|
|
|
|
-burnonly)
|
|
|
|
|
burnonly=1
|
|
|
|
|
burn=1
|
|
|
|
|
;;
|
2003-05-30 17:37:33 +00:00
|
|
|
|
-overburn)
|
|
|
|
|
overburn="--overburn"
|
|
|
|
|
;;
|
|
|
|
|
-pulldown)
|
|
|
|
|
pd="-p"
|
|
|
|
|
;;
|
2002-05-09 10:27:36 +00:00
|
|
|
|
-vfr)
|
|
|
|
|
framerate="-F $2"
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-04-15 14:01:07 +00:00
|
|
|
|
-mp3)
|
|
|
|
|
mp3=1
|
|
|
|
|
;;
|
2002-11-02 17:27:23 +00:00
|
|
|
|
-mpegsrc)
|
2002-04-11 22:53:48 +00:00
|
|
|
|
mkstream=0
|
|
|
|
|
;;
|
2002-06-22 23:49:50 +00:00
|
|
|
|
-mpgonly)
|
|
|
|
|
mpgonly=1
|
|
|
|
|
;;
|
2003-05-30 17:37:33 +00:00
|
|
|
|
-normalize)
|
|
|
|
|
norm=1
|
|
|
|
|
;;
|
2002-05-09 10:27:36 +00:00
|
|
|
|
-vnorm)
|
2002-05-17 05:45:30 +00:00
|
|
|
|
yuvin="-n $2"
|
2002-05-07 08:39:22 +00:00
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-11-02 17:27:23 +00:00
|
|
|
|
-volume)
|
|
|
|
|
volume="$2"
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-04-11 22:53:48 +00:00
|
|
|
|
-denoise)
|
|
|
|
|
denoise="yuvdenoise"
|
|
|
|
|
;;
|
2002-04-22 09:42:34 +00:00
|
|
|
|
-ratio)
|
|
|
|
|
ratio=$2
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
-sid) # mplayer option: have to set vop expand, too!!!
|
|
|
|
|
sub="-vop pp,expand=-1:-1:-1:-1:1 -sid $2"
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
|
|
|
|
-size)
|
|
|
|
|
size=$2
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-04-11 22:53:48 +00:00
|
|
|
|
-svcdout)
|
2003-06-03 18:48:03 +00:00
|
|
|
|
vnorm="SVCD"
|
2002-04-18 17:41:54 +00:00
|
|
|
|
;;
|
2002-05-31 21:44:39 +00:00
|
|
|
|
-sync)
|
|
|
|
|
sync="-O $2"
|
|
|
|
|
shift 1
|
|
|
|
|
;;
|
2002-11-02 17:27:23 +00:00
|
|
|
|
-sox)
|
|
|
|
|
sox=1
|
|
|
|
|
;;
|
|
|
|
|
-toolame)
|
|
|
|
|
toolame=1
|
|
|
|
|
;;
|
2002-04-18 17:41:54 +00:00
|
|
|
|
-vbr)
|
|
|
|
|
vbr=$2
|
|
|
|
|
vbrset=1
|
|
|
|
|
shift 1
|
2002-04-11 22:53:48 +00:00
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
params="$params $1"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
shift 1
|
|
|
|
|
done
|
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
# some configs
|
2002-11-02 17:27:23 +00:00
|
|
|
|
mpegnorm="-f $VCDMODE -b $vbr -B 260 -V 46"
|
2003-06-03 18:48:03 +00:00
|
|
|
|
if [ "$vnorm" == "SVCD" ]; then
|
2002-04-18 17:41:54 +00:00
|
|
|
|
[ $vbrset -eq 0 ] && vbr=2500
|
2002-04-22 09:42:34 +00:00
|
|
|
|
mplexnorm="-f $SVCDMODE -m 2 -V -b 230"
|
2003-05-30 17:37:33 +00:00
|
|
|
|
mpegnorm="-f $SVCDMODE -b $vbr -B 260 -V 230"
|
2002-04-18 17:41:54 +00:00
|
|
|
|
imaget="-t svcd"
|
2002-04-11 22:53:48 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2002-04-22 09:42:34 +00:00
|
|
|
|
# ratio overwrites wide sizing, size overwrites default frame size
|
|
|
|
|
[ -n "$ratio" ] && wide="-M $ratio"
|
|
|
|
|
[ -n "$size" ] && size="-O SIZE_$size"
|
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
# with mp3 audio set the default audio bitrate to 128 kbs
|
2002-04-18 17:41:54 +00:00
|
|
|
|
[ $mp3 -eq 1 -a $abrset -eq 0 ] && abr=128
|
2002-04-15 14:01:07 +00:00
|
|
|
|
|
|
|
|
|
# audio sample rate in kHz
|
|
|
|
|
((a=$asr / 1000))
|
|
|
|
|
((b=$asr % 1000))
|
|
|
|
|
[ $b -le 9 ] && b="00$b00"
|
|
|
|
|
[ $b -le 99 ] && b="0$b00"
|
|
|
|
|
kasr="$a.$b"
|
|
|
|
|
|
2002-04-22 09:42:34 +00:00
|
|
|
|
# start de-/encoding
|
2002-04-18 17:41:54 +00:00
|
|
|
|
if [ $burnonly -eq 0 ]; then
|
|
|
|
|
# encode streams
|
|
|
|
|
if [ $mkstream -eq 1 ]; then
|
|
|
|
|
# start mplayer
|
2002-11-02 17:27:23 +00:00
|
|
|
|
command="mplayer -noframedrop -vo yuv4mpeg -ao pcm -waveheader -v -osdlevel 0 $sub $params"
|
|
|
|
|
echo "$command"
|
|
|
|
|
$command &
|
|
|
|
|
|
2002-04-18 17:41:54 +00:00
|
|
|
|
# mjpegtools
|
|
|
|
|
($denoise < $VIDEO | \
|
2003-06-03 18:48:03 +00:00
|
|
|
|
yuvscaler -v 0 $wide -O $vnorm $size $yuvin | \
|
2003-05-30 17:37:33 +00:00
|
|
|
|
mpeg2enc -v 0 -s $mpegnorm $aratio -S $CDMAXSIZE -g 6 -G 15 -r 16 \
|
|
|
|
|
$pd $framerate $yuvin -4 2 -2 1 -o $NAME.mpv) &
|
2002-04-11 22:53:48 +00:00
|
|
|
|
|
2002-04-18 17:41:54 +00:00
|
|
|
|
# wait for finishing the subprocesses
|
|
|
|
|
wait
|
|
|
|
|
|
2003-05-30 17:37:33 +00:00
|
|
|
|
# normalize sound
|
|
|
|
|
[ $norm -eq 1 ] && (echo "normalizing sound..."; normalize $AUDIO)
|
|
|
|
|
|
2002-11-02 17:27:23 +00:00
|
|
|
|
# do resampling with sox
|
|
|
|
|
if [ $sox -ne 0 ]; then
|
|
|
|
|
echo "wait, do resampling with sox..."
|
|
|
|
|
sox $AUDIO -v $volume -r $asr $NAME.wav resample -qs
|
|
|
|
|
mv -f $NAME.wav $AUDIO
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ $toolame -ne 0 -a $mp3 -eq 0 ]; then
|
|
|
|
|
# do mp2 encoding with toolame
|
|
|
|
|
echo "wait, encoding to mp2 audio with toolame..."
|
|
|
|
|
toolame -b $abr $AUDIO
|
|
|
|
|
mv -f `basename $AUDIO .wav`.mp2 $NAME.mpa
|
|
|
|
|
elif [ $toolame -eq 0 -a $mp3 -eq 0 ]; then
|
2002-04-18 17:41:54 +00:00
|
|
|
|
# mp2enc/lame can't read audiodump.wav directly from named pipe,
|
|
|
|
|
# we have to read the whole file.
|
2002-11-02 17:27:23 +00:00
|
|
|
|
echo "wait, encoding to mp2 audio with mp2enc..."
|
2002-04-18 17:41:54 +00:00
|
|
|
|
mp2enc -b $abr -r $asr -o $NAME.mpa < $AUDIO
|
2002-11-02 17:27:23 +00:00
|
|
|
|
elif [ $mp3 -ne 0 ]; then
|
|
|
|
|
echo "wait, encoding to mp3 audio with lame..."
|
2002-04-18 17:41:54 +00:00
|
|
|
|
lame -b $abr --resample $kasr - $NAME.mpa < $AUDIO
|
|
|
|
|
fi
|
2002-04-15 14:01:07 +00:00
|
|
|
|
fi
|
2002-04-18 17:41:54 +00:00
|
|
|
|
|
|
|
|
|
# remove wav file, won't need anymore!
|
|
|
|
|
rm -f $AUDIO
|
|
|
|
|
|
|
|
|
|
# multiplex streams
|
|
|
|
|
[ -f $NAME.mpv -a -f $NAME.mpa ] || exit 1
|
|
|
|
|
rm -f ${NAME}*.mpg
|
2002-05-31 21:44:39 +00:00
|
|
|
|
mplex $mplexnorm $sync $NAME.mpv $NAME.mpa -o ${NAME}%d.mpg
|
2002-04-18 17:41:54 +00:00
|
|
|
|
|
2002-09-21 21:54:42 +00:00
|
|
|
|
# remove pipe, won't need anymore!
|
|
|
|
|
rm -f $VIDEO
|
|
|
|
|
|
2002-06-22 23:49:50 +00:00
|
|
|
|
# should i create only the mpeg file?
|
|
|
|
|
[ $mpgonly -eq 1 ] && exit 0
|
|
|
|
|
|
2002-04-18 17:41:54 +00:00
|
|
|
|
# create cd images
|
|
|
|
|
for mpg in ${NAME}*.mpg; do
|
|
|
|
|
[ -f $mpg ] || exit 1
|
|
|
|
|
cue="`basename $mpg .mpg`.cue"
|
|
|
|
|
bin="`basename $mpg .mpg`.bin"
|
|
|
|
|
rm -f $cue $bin
|
|
|
|
|
vcdimager $imaget -c $cue -b $bin $mpg
|
|
|
|
|
[ -f $bin -a -f $cue ] && rm -f $mpg
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# end of streaming/mastering
|
2002-04-11 22:53:48 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
# burn the (s)vcd's
|
2002-04-11 22:53:48 +00:00
|
|
|
|
[ $burn -eq 0 ] && exit 0
|
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
for cue in ${NAME}*.cue; do
|
|
|
|
|
bin="`basename $cue .cue`.bin"
|
|
|
|
|
[ -f $bin -a -f $cue ] || exit 1
|
|
|
|
|
|
|
|
|
|
echo "please insert a cd in your cdwriter, after a keypress we start:"
|
|
|
|
|
read -n 1 i
|
2002-04-11 22:53:48 +00:00
|
|
|
|
|
2002-04-15 14:01:07 +00:00
|
|
|
|
if [ $blank -eq 1 ]; then
|
|
|
|
|
cdrdao blank --reload $CDDEV --driver $CDDRV --blank-mode minimal
|
|
|
|
|
fi
|
2003-05-30 17:37:33 +00:00
|
|
|
|
cdrdao write $overburn --reload $CDDEV --driver $CDDRV $cue
|
2002-04-15 14:01:07 +00:00
|
|
|
|
done
|
2002-04-11 22:53:48 +00:00
|
|
|
|
exit 0
|