1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 13:17:13 +00:00

- new option "-burnonly": burn only the preformated bin images

- new option "-vbr":      sets video bitrate
- removes mpg file after mastering cd image
 (mplayer can read bin images!)
- bug fixes


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5687 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atmos4 2002-04-18 17:41:54 +00:00
parent bb545e778c
commit 0a62f708c7

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Version: 0.1.2 # Version: 0.1.3
# #
# Licence: GPL # Licence: GPL
# #
@ -19,10 +19,16 @@
# 2002/04/11 v0.1.0: first version # 2002/04/11 v0.1.0: first version
# 2002/04/12 v0.1.1: # 2002/04/12 v0.1.1:
# 2002/04/14 v0.1.2: # 2002/04/14 v0.1.2:
# - handles now multiple vcd's # - handles now multiple vcd's
# - support's mp3 audio as option # - support's mp3 audio as option
# - use of mp2enc/lame instead of toolame because of support # - use of mp2enc/lame instead of toolame because of support
# of resampling and mp3 # 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!)
# - bug fixes
# #
################################################################################ ################################################################################
# #
@ -40,7 +46,7 @@ VIDEO="stream.yuv"
################################################################################ ################################################################################
function usage() { function usage() {
echo "usage: $HOWCALLED <filename> [options] [mplayer options]" echo "usage: $HOWCALLED <name> [options] [mplayer options]"
echo echo
echo "$HOWCALLED options:" echo "$HOWCALLED options:"
echo echo
@ -49,14 +55,15 @@ function usage() {
echo "-abr <n> output audio bitrate in kbs [224]" echo "-abr <n> output audio bitrate in kbs [224]"
echo "-asr <n> output audio sample rate in Hz [48000]" echo "-asr <n> output audio sample rate in Hz [48000]"
echo "-blank cleans cd-rw before burning" 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 [646]" echo "-cdsize <n> maximal size of cd images [646]"
echo "-denoise denoises mpeg stream" echo "-denoise denoises mpeg stream"
echo "-noburn disables burning" echo "-noburn disables burning"
echo "-mp3 outputs audio in mp3 instead of mp2 format" echo "-mp3 outputs audio in mp3 instead of mp2 format"
echo "-mpg don't encode from source, multiplex/burn" echo "-mpg don't encode from source, multiplex/burn"
echo " only the encoded mpg stream" echo " only the encoded mpg stream"
echo "-vcdout encode to VCD format [default]" echo "-svcdout encode to SVCD format [VCD default]"
echo "-svcdout encode to SVCD format" echo "-vbr <n> output video bitrate in kbs [VCD:1152, SVCD:2500]"
echo echo
echo "example:" echo "example:"
echo "'$HOWCALLED crazy -dvd 3 -w' encodes and burns dvd title 3 to VCD in 16:9." echo "'$HOWCALLED crazy -dvd 3 -w' encodes and burns dvd title 3 to VCD in 16:9."
@ -81,17 +88,21 @@ params=""
wide="" wide=""
blank=0 blank=0
burn=1 burn=1
burnonly=0
mp3=0 mp3=0
mkstream=1 mkstream=1
abr=224 abr=224
abrset=0 abrset=0
asr=44100 asr=44100
vbr=1152
vbrset=0
denoise="cat -" denoise="cat -"
norm="VCD" norm="VCD"
mplexnorm="-f 2 -m 1 -V" mplexnorm="-f 2 -m 1 -V"
max=646 max=646
mpegnorm="-f 2 -b 1152 -B 260" mpegnorm="-f 2 -b $vbr -B 260"
imaget="-t vcd2" imaget="-t vcd2"
while [ "$1"x != "x" ]; do while [ "$1"x != "x" ]; do
case $1 in case $1 in
-w) -w)
@ -120,6 +131,10 @@ while [ "$1"x != "x" ]; do
-noburn) -noburn)
burn=0 burn=0
;; ;;
-burnonly)
burnonly=1
burn=1
;;
-mp3) -mp3)
mp3=1 mp3=1
;; ;;
@ -129,17 +144,13 @@ while [ "$1"x != "x" ]; do
-denoise) -denoise)
denoise="yuvdenoise" denoise="yuvdenoise"
;; ;;
-vcdout)
norm="VCD"
mplexnorm="-f 2 -m 1 -V"
mpegnorm="-f 2 -b 1152 -B 260"
imaget="-t vcd2"
;;
-svcdout) -svcdout)
norm="SVCD" norm="SVCD"
mplexnorm="-f 4 -m 2 -V" ;;
mpegnorm="-f 4 -b 2500 -B 260" -vbr)
imaget="-t svcd" vbr=$2
vbrset=1
shift 1
;; ;;
*) *)
params="$params $1" params="$params $1"
@ -149,17 +160,15 @@ while [ "$1"x != "x" ]; do
done done
# some configs # some configs
if [ -n "$wide" ]; then if [ "$norm" == "SVCD" ]; then
if [ "$norm" == "SVCD" ]; then [ $vbrset -eq 0 ] && vbr=2500
wide="" mplexnorm="-f 5 -m 2 -V"
mpegnorm="$mpegnorm -a 3" mpegnorm="-f 5 -b $vbr -B 260 -a 2"
fi imaget="-t svcd"
fi fi
# with mp3 audio set the default audio bitrate to 128 kbs # with mp3 audio set the default audio bitrate to 128 kbs
if [ $mp3 -eq 1 -a $abrset -eq 0 ]; then [ $mp3 -eq 1 -a $abrset -eq 0 ] && abr=128
abr=128
fi
# audio sample rate in kHz # audio sample rate in kHz
((a=$asr / 1000)) ((a=$asr / 1000))
@ -168,45 +177,53 @@ fi
[ $b -le 99 ] && b="0$b00" [ $b -le 99 ] && b="0$b00"
kasr="$a.$b" kasr="$a.$b"
# encode streams if [ $burnonly -eq 0 ]; then
if [ $mkstream -eq 1 ]; then # encode streams
# start mplayer if [ $mkstream -eq 1 ]; then
mplayer -noframedrop -vo yuv4mpeg -ao pcm -waveheader $params & # start mplayer
mplayer -noframedrop -vo yuv4mpeg -ao pcm -waveheader \
-osdlevel 0 $params &
# mjpegtools # mjpegtools
($denoise < $VIDEO | \ ($denoise < $VIDEO | \
yuvscaler -v 0 $wide -O $norm | \ yuvscaler -v 0 $wide -O $norm | \
mpeg2enc -v 0 -s $mpegnorm -S $max -g 6 -G 15 -r 16 -o $NAME.mpv) & mpeg2enc -v 0 -s $mpegnorm -S $max -g 6 -G 15 -r 16 -o $NAME.mpv) &
# wait for finishing the subprocesses # wait for finishing the subprocesses
wait wait
if [ $mp3 -eq 0 ]; then if [ $mp3 -eq 0 ]; then
# mp2enc/lame can't read audiodump.wav directly from named pipe, # mp2enc/lame can't read audiodump.wav directly from named pipe,
# we have to read the whole file. # we have to read the whole file.
mp2enc -b $abr -r $asr -o $NAME.mpa < $AUDIO mp2enc -b $abr -r $asr -o $NAME.mpa < $AUDIO
else else
lame -b $abr --resample $kasr - $NAME.mpa < $AUDIO lame -b $abr --resample $kasr - $NAME.mpa < $AUDIO
fi
fi fi
# 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
mplex $mplexnorm $NAME.mpv $NAME.mpa -o ${NAME}%d.mpg
# 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
fi fi
# remove pipe and wav file, won't need anymore! # remove pipe, won't need anymore!
rm -f $VIDEO rm -f $VIDEO
rm -f $AUDIO
# multiplex streams
[ -f $NAME.mpv -a -f $NAME.mpa ] || exit 1
rm -f ${NAME}*.mpg
mplex $mplexnorm $NAME.mpv $NAME.mpa -o ${NAME}%d.mpg
# 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
done
# burn the (s)vcd's # burn the (s)vcd's
[ $burn -eq 0 ] && exit 0 [ $burn -eq 0 ] && exit 0