annotate TOOLS/mencvcd.sh @ 32971:dc905c693b7a

Choose informative variable names. That way, a comment on the variable isn't longer necessary.
author ib
date Tue, 08 Mar 2011 19:07:55 +0000
parents e193fb0e07e7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27199
abd0a4e9daa0 Run bash-specific shell scripts with bash, not sh.
diego
parents: 27198
diff changeset
1 #!/bin/bash
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
2 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
3 # Version: 0.2.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
4 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
5 # Licence: GPL
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
6 #
29628
e193fb0e07e7 Convert to UTF-8.
diego
parents: 29627
diff changeset
7 # 2002/09/21 Jürgen Hammelmann <juergen.hammelmann@gmx.de>
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
8 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
9 # Script: MPlayer Sources (DVD) to (S)VCD ripping and burning
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
10 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
11 # requires: mplayer
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
12 # mjpegtools
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
13 # vcdimager
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
14 # cdrdao
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
15 # lame (optionally)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
16 # toolame (optionally)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
17 # sox (optionally)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
18
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
19 for exe in mplayer mpeg2enc mp2enc mplex yuvscaler ; do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
20 if [ -z "`which $exe`" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
21 echo "ERROR: $exe must be in your path $PATH!"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
22 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
23 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
24 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
25 for exe in vcdimager lame cdrdao yuvdenoise sox toolame normalize; do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
26 if [ -z "`which $exe`" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
27 echo "WARNING: $exe is not found in your path $PATH!"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
28 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
29 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
30
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
31 ################################################################################
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
32 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
33 # 2002/04/11 v0.1.0: first version
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
34 # 2002/04/12 v0.1.1:
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
35 # 2002/04/14 v0.1.2:
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
36 # - handles now multiple vcd's
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
37 # - support's mp3 audio as option
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
38 # - use of mp2enc/lame instead of toolame because of support
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
39 # of resampling and mp3
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
40 # 2002/04/16 v0.1.3:
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
41 # - new option "-burnonly"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
42 # - new option "-vbr"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
43 # - removes mpg file after mastering cd image
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
44 # (mplayer can read bin images!)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
45 # - bugfixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
46 # 2002/04/22 v0.1.4
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
47 # - bugfixes / changes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
48 # - more options
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
49 # 2002/05/06 v0.1.5
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
50 # - new option "-norm"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
51 # 2002/05/08 v0.1.6
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
52 # - bugfixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
53 # - new option "-vfr"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
54 # - "-norm" renamed to "-vnorm"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
55 # 2002/05/15 v0.1.7
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
56 # - bugfixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
57 # - more help
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
58 # 2002/05/26 v0.1.8
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
59 # - new option "-sync"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
60 # 2002/06/19 v0.1.9
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
61 # - new option "-mpgonly"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
62 # 2002/09/21 v0.1.10
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
63 # - bug fixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
64 # - tests now, if the commands are in path and give warnings
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
65 # and errors.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
66 # 2002/11/01 v0.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
67 # - bug fixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
68 # - new options: "-sox", "-volume", "-toolame"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
69 # - renamed "-mpg" to "-mpegsrc"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
70 # - default cd size changed to 800mb
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
71 # 2002/11/18 v0.2.1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
72 # - aspect ratio for vcd's, too
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
73 # - pulldown mode...
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
74 # 2002/12/01 v0.2.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
75 # - -normalize
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
76 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
77 ################################################################################
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
78 #
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
79 # global config section, change them to your needs!
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
80
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
81 TMPDIR="." # path to directory for creating temporary files, recommended 2-3GB space
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
82
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
83 CDDRV="generic-mmc" # cdrdao: cdwriter driver
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
84 CDDEV="--device 0,1,0" # or comment out and create link /dev/cdrecorder
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
85 # to your cdwriter dev
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
86 CDMAXSIZE=800
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
87
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
88 ################################################################################
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
89 AUDIO="audiodump.wav"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
90 VIDEO="stream.yuv"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
91 VCDMODE=2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
92 SVCDMODE=5
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
93 ################################################################################
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
94
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
95 usage() {
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
96 echo "Usage: $HOWCALLED <basename> [$HOWCALLED options] [mplayer options]"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
97 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
98 echo " <basename> is used as basename of the resulting mpg/bin files."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
99 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
100 echo "For mplayer options see mplayer help and manual."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
101 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
102 echo "$HOWCALLED options:"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
103 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
104 echo "-?|-h help."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
105 echo "-a <n> sets the aspect ratio (for SVCD):"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
106 echo " 1 - 1:1 display"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
107 echo " 2 - 4:3 display"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
108 echo " 3 - 16:9 display"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
109 echo " 4 - 2.21:1 display"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
110 echo "-abr <n> output audio bitrate in kbs [224]."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
111 echo "-asr <n> output audio sample rate in Hz [44100]."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
112 echo "-blank cleans cd-rw before burning."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
113 echo "-burnonly burn only the premastered <name>*.cue/<name>*.bin images."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
114 echo "-cdsize <n> maximal size of cd images [800 = 80min raw cd]."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
115 echo "-denoise denoises mpeg stream."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
116 echo "-mp3 outputs audio in mp3 instead of mp2 format."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
117 echo "-mpegsrc don't encode from source, multiplex/burn the "
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
118 echo " encoded mpg stream."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
119 echo "-mpgonly do only encoding to mpeg 1/2 format."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
120 echo "-noburn disables burning."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
121 echo "-normalize use 'normalize'."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
122 echo "-overburn enables overburning a cd."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
123 echo "-pulldown enable pulldown mode in output."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
124 echo "-ratio <s> output ratio size of frames, see yuvscaler (1)."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
125 echo "-size <X>x<Y> sets output size of frames."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
126 echo "-sox use sox for audio resampling."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
127 echo "-svcdout encode to SVCD format [VCD default]."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
128 echo "-sync <n> set the presentation timestamp offset of video"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
129 echo " stream w.r.t. audio stream (video-audio) in mSec."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
130 echo "-toolame use toolame instead of mp2enc."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
131 echo "-v <volume> change amplitude (floating point); less than 1.0"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
132 echo " decreases, greater than 1.0 increases. Use that only"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
133 echo " together with sox!"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
134 echo "-vbr <n> output video bitrate in kbs [VCD:1152, SVCD:2500]."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
135 echo "-vfr <n> sets the frame-rate of the output-stream. Currently"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
136 echo " only the standard MPEG rates are supported:"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
137 echo " 0 - illegal"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
138 echo " 1 - 24000.0/1001.0 (NTSC 3:2 pulldown converted FILM)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
139 echo " 2 - 24.0 (NATIVE FILM)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
140 echo " 3 - 25.0 (PAL/SECAM VIDEO / converted FILM)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
141 echo " 4 - 30000.0/1001.0 (NTSC VIDEO)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
142 echo " 5 - 30.0"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
143 echo " 6 - 50.0 (PAL FIELD RATE)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
144 echo " 7 - 60000.0/1001.0 (NTSC FIELD RATE)"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
145 echo " 8 - 60.0"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
146 echo "-vnorm <p|n|s> sets the input video norm p, n or s:"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
147 echo " forces the input stream to be treated as PAL|NTSC|SECAM"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
148 echo " regardless of what the stream header might suggest."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
149 echo "-w outputs in wide screen format 16:9."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
150 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
151 echo "examples:"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
152 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
153 echo "'$HOWCALLED teneriffa teneriffa.avi'"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
154 echo "this creates a VCD from an avi file."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
155 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
156 echo "'$HOWCALLED crazy dvd://3 -w':"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
157 echo "encodes and burns dvd title 3 to VCD in 16:9."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
158 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
159 echo "'$HOWCALLED carter dvd://1 -sid 0 -aid 128 -ss 3:00 -frames 1500 \\"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
160 echo " -noburn -vnorm n -vfr 1':"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
161 echo "this encodes 1500 frames of dvd title 1 with subtitle 0 and audio stream"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
162 echo "128 starting from 3:00 with frame rate 29.97 fps and input video norm NTSC"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
163 echo "and output frame rate 23.98 fps because of the 3:2 pulldown method in NTSC."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
164 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
165 echo "'$HOWCALLED bj -size 640x272 -vf expand=640:480:0:104:0 \\"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
166 echo " -cdsize 645 -noburn bj.avi'"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
167 echo "this example above shows you, how to deal with movies which are not"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
168 echo "created with aspect ratios of 4:3 or 16:9."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
169 }
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
170
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
171 HOWCALLED=`basename $0`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
172 if [ $# -le 1 ]; then
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
173 usage
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
174 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
175 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
176 case $1 in
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
177 -*)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
178 usage
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
179 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
180 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
181 *)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
182 NAME=$1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
183 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
184 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
185 esac
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
186
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
187 cd $TMPDIR
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
188 rm -f $VIDEO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
189 rm -f $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
190 # create a named pipe for video stream
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
191 mkfifo -m 660 $VIDEO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
192
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
193 # some inits
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
194 sub=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
195 size=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
196 aratio=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
197 ratio=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
198 params=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
199 wide=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
200 blank=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
201 burn=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
202 burnonly=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
203 mp3=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
204 mpgonly=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
205 mkstream=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
206 abr=224
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
207 abrset=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
208 asr=44100
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
209 vbr=1152
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
210 vbrset=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
211 denoise="cat -"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
212 vnorm="VCD"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
213 mplexnorm="-f $VCDMODE -m 1 -V -b 46"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
214 imaget="-t vcd2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
215 yuvin=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
216 framerate=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
217 sync=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
218 sox=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
219 toolame=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
220 volume="1.0"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
221 overburn=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
222 pd=""
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
223 norm=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
224
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
225 while [ "$1"x != "x" ]; do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
226 case $1 in
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
227 -a)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
228 aratio="-a $2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
229 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
230 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
231 -w)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
232 wide="-M WIDE2STD"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
233 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
234 -h|-?)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
235 usage
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
236 exit 0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
237 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
238 -abr)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
239 abr=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
240 abrset=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
241 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
242 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
243 -asr)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
244 asr=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
245 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
246 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
247 -cdsize)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
248 CDMAXSIZE=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
249 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
250 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
251 -blank)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
252 blank=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
253 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
254 -noburn)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
255 burn=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
256 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
257 -burnonly)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
258 burnonly=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
259 burn=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
260 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
261 -overburn)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
262 overburn="--overburn"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
263 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
264 -pulldown)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
265 pd="-p"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
266 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
267 -vfr)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
268 framerate="-F $2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
269 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
270 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
271 -mp3)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
272 mp3=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
273 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
274 -mpegsrc)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
275 mkstream=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
276 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
277 -mpgonly)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
278 mpgonly=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
279 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
280 -normalize)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
281 norm=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
282 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
283 -vnorm)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
284 yuvin="-n $2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
285 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
286 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
287 -volume)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
288 volume="$2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
289 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
290 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
291 -denoise)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
292 denoise="yuvdenoise"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
293 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
294 -ratio)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
295 ratio=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
296 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
297 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
298 -sid) # mplayer option: have to set vf expand, too!!!
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
299 sub="-vf pp,expand=-1:-1:-1:-1:1 -sid $2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
300 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
301 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
302 -size)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
303 size=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
304 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
305 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
306 -svcdout)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
307 vnorm="SVCD"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
308 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
309 -sync)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
310 sync="-O $2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
311 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
312 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
313 -sox)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
314 sox=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
315 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
316 -toolame)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
317 toolame=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
318 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
319 -vbr)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
320 vbr=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
321 vbrset=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
322 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
323 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
324 *)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
325 params="$params $1"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
326 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
327 esac
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
328 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
329 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
330
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
331 # some configs
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
332 mpegnorm="-f $VCDMODE -b $vbr -B 260 -V 46"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
333 if [ "$vnorm" = "SVCD" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
334 [ $vbrset -eq 0 ] && vbr=2500
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
335 mplexnorm="-f $SVCDMODE -m 2 -V -b 230"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
336 mpegnorm="-f $SVCDMODE -b $vbr -B 260 -V 230"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
337 imaget="-t svcd"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
338 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
339
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
340 # ratio overwrites wide sizing, size overwrites default frame size
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
341 [ -n "$ratio" ] && wide="-M $ratio"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
342 [ -n "$size" ] && size="-O SIZE_$size"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
343
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
344 # with mp3 audio set the default audio bitrate to 128 kbs
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
345 [ $mp3 -eq 1 -a $abrset -eq 0 ] && abr=128
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
346
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
347 # audio sample rate in kHz
29627
d8d2b355825c Fix bashism: Use '$(( ))' syntax instead of '(( ))' for arithmetic expressions.
diego
parents: 29263
diff changeset
348 a=$(($a=$asr / 1000))
d8d2b355825c Fix bashism: Use '$(( ))' syntax instead of '(( ))' for arithmetic expressions.
diego
parents: 29263
diff changeset
349 b=$(($b=$asr % 1000))
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
350 [ $b -le 9 ] && b="00$b00"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
351 [ $b -le 99 ] && b="0$b00"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
352 kasr="$a.$b"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
353
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
354 # start de-/encoding
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
355 if [ $burnonly -eq 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
356 # encode streams
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
357 if [ $mkstream -eq 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
358 # start mplayer
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
359 command="mplayer -noframedrop -vo yuv4mpeg -ao pcm:waveheader -v -osdlevel 0 $sub $params"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
360 echo "$command"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
361 $command &
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
362
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
363 # mjpegtools
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
364 ($denoise < $VIDEO | \
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
365 yuvscaler -v 0 $wide -O $vnorm $size $yuvin | \
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
366 mpeg2enc -v 0 -s $mpegnorm $aratio -S $CDMAXSIZE -g 6 -G 15 -r 16 \
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
367 $pd $framerate $yuvin -4 2 -2 1 -o $NAME.mpv) &
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
368
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
369 # wait for finishing the subprocesses
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
370 wait
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
371
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
372 # normalize sound
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
373 [ $norm -eq 1 ] && (echo "normalizing sound..."; normalize $AUDIO)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
374
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
375 # do resampling with sox
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
376 if [ $sox -ne 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
377 echo "wait, do resampling with sox..."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
378 sox $AUDIO -v $volume -r $asr $NAME.wav resample -qs
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
379 mv -f $NAME.wav $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
380 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
381
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
382 if [ $toolame -ne 0 -a $mp3 -eq 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
383 # do mp2 encoding with toolame
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
384 echo "wait, encoding to mp2 audio with toolame..."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
385 toolame -b $abr $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
386 mv -f `basename $AUDIO .wav`.mp2 $NAME.mpa
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
387 elif [ $toolame -eq 0 -a $mp3 -eq 0 ]; then
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
388 # mp2enc/lame can't read audiodump.wav directly from named pipe,
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
389 # we have to read the whole file.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
390 echo "wait, encoding to mp2 audio with mp2enc..."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
391 mp2enc -b $abr -r $asr -o $NAME.mpa < $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
392 elif [ $mp3 -ne 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
393 echo "wait, encoding to mp3 audio with lame..."
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
394 lame -b $abr --resample $kasr - $NAME.mpa < $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
395 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
396 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
397
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
398 # remove wav file, won't need anymore!
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
399 rm -f $AUDIO
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
400
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
401 # multiplex streams
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
402 [ -f $NAME.mpv -a -f $NAME.mpa ] || exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
403 rm -f ${NAME}*.mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
404 mplex $mplexnorm $sync $NAME.mpv $NAME.mpa -o ${NAME}%d.mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
405
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
406 # remove pipe, won't need anymore!
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
407 rm -f $VIDEO
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
408
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
409 # should i create only the mpeg file?
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
410 [ $mpgonly -eq 1 ] && exit 0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
411
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
412 # create cd images
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27199
diff changeset
413 for mpg in ${NAME}*.mpg; do
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
414 [ -f $mpg ] || exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
415 cue="`basename $mpg .mpg`.cue"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
416 bin="`basename $mpg .mpg`.bin"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
417 rm -f $cue $bin
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
418 vcdimager $imaget -c $cue -b $bin $mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
419 [ -f $bin -a -f $cue ] && rm -f $mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
420 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
421
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
422 # end of streaming/mastering
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
423 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
424
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
425 # burn the (s)vcd's
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
426 [ $burn -eq 0 ] && exit 0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
427
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
428 for cue in ${NAME}*.cue; do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
429 bin="`basename $cue .cue`.bin"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
430 [ -f $bin -a -f $cue ] || exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
431
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
432 echo "please insert a cd in your cdwriter, after a keypress we start:"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
433 read -n 1 i
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
434
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
435 if [ $blank -eq 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
436 cdrdao blank --reload $CDDEV --driver $CDDRV --blank-mode minimal
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
437 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
438 cdrdao write $overburn --reload $CDDEV --driver $CDDRV $cue
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
439 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
440 exit 0