annotate TOOLS/divx2svcd.sh @ 27619:ca11fb4eaea5

typo fix spotted by diego
author compn
date Sat, 20 Sep 2008 17:08:21 +0000
parents 305dc504c407
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27198
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
1 #!/bin/bash
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 # (c) 2003 Vajna Miklos <mainroot@freemail.hu>
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
4 # divx2svcd for MPlayer
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
5 # distributed under GPL License
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
6
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
7 # simple utility that creates a SVCD from a video in an AVI container
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 # The newest version of this utility can be found at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
10 # http://vmiklos.uw.hu/divx2svcd/divx2svcd
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
11 # MPlayer available at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
12 # http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0pre3try2.tar.bz2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
13
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
14 ###changelog###
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
15 #nobody cares about it :-)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
16 cat >/dev/null <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
17 0.5.1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
18 - faster code by not re-mplexing one-cd-size or smaller videos
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
19
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
20 0.5.0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
21 - needless for dumpvideo patch ;-)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
22
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
23 0.4.9
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
24 - changed default bitrate to 1600 for better quality
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
25 - fix for burning more than one cd
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
26 - fix for wrong parameter help
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
27
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
28 0.4.8
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
29 - small fixes
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 0.4.7
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
32 - fixed bug, when there is no sub available
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
33
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
34 0.4.6
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
35 - support for burning the svcd with cdrecord
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
36 - lots of paranoid options for better quality from Denes Balatoni
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
37
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
38 0.4.5
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
39 - support for filenames including spaces
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
40
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
41 0.4.4
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
42 - support for checking all applications this script uses
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
43 - this changelog
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
44
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
45 0.4.3
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
46 - advanced detectation of movie aspect (mpeg4 codec, mpeg container)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
47
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
48 0.4.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
49 - advanced vf options for movies with non-standard aspect
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
50
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
51 0.4.1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
52 - checking for available sub
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
53
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
54 0.4.0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
55 - support for tcmplex-panteltje
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
56 - support for libavcodec audio encoder
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
57
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
58 0.3.1-0.3.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
59 - small fixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
60
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
61 0.3
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
62 - almost totally rewritten from scratch
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
63 based on the idea of Denes Balatoni <pnis@coder.hu>
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
64 - support for toolame instead of mp2enc
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
65 - suppert for libavcodec mpeg2video codec instead of mpeg2enc
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
66
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
67 0.2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
68 - support for tcmplex instead of mplex
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
69
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
70 0.1rc2-rc4
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
71 - small bugfixes
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
72
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
73 0.1rc1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
74 - initial release
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
75
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
76 EOF
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 ###preparing###
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
80 #help
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
81
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
82 usage()
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
83 {
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
84 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
85 Usage: `basename $0` input_avi [options]
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
86
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
87 Options:
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
88 -b|--bitrate xx bitrate of mp2 video stream [1375]
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
89 -s|--cdsize xx size of the cd we split the video to [795]
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
90 -w|--writecd enables burning [disable]
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
91 -d|--device xx scsi cd-recording device if you are using linux 2.4.x [0,0,0]
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
92 -c|--clean clean up svcd images you just created
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
93 -h|--help this help screen
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
94 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
95
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
96 }
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
97
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
98 #initializating constants
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
99 version='0.5.1'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
100 bitrate=1375
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
101 cdsize=795
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
102 burning=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
103 cleaning=0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
104 dev4='0,0,0'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
105 firstcd=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
106
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
107 #paranoid options
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
108 paraopts='vrc_override=1,10,708:vqcomp=0.1:vratetol=10000000:vrc_buf_size=917:vrc_maxrate=2500: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'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
109
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
110 #header
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
111 echo "DivX2SvcD $version (C) 2003-2004 Vajna Miklos"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
112 echo
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
113
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
114 #checking for ls
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
115 ls=`which ls`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
116
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
117 #checking for bc
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
118 which bc >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
119 bcbin=`which bc 2>/dev/null`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
120 if [ $? != 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
121 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
122 ERROR: Can't find bc. You can download it at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
123 ftp://ftp.ibiblio.org/pub/gnu/bc/bc-1.06.tar.gz
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
124 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
125 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
126 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
127
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
128 #checking for vcdimager
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
129 which vcdimager >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
130 bcbin=`which vcdimager 2>/dev/null`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
131 if [ $? != 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
132 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
133 ERROR: Can't find vcdimager. You can download it at http://www.vcdimager.org
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
134 /pub/vcdimager/vcdimager-0.7_UNSTABLE/vcdimager-0.7.14.tar.gz
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
135 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
136 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
137 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
138
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
139 #checking which mplex utility we have to use
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
140 which tcmplex-panteltje >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
141 if [ $? = 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
142 tcp_path=`which tcmplex-panteltje 2>&1`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
143 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
144 tcp_path="x"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
145 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
146 which tcmplex >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
147 if [ $? = 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
148 tc_path=`which tcmplex 2>&1`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
149 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
150 tc_path="x"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
151 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
152
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
153 if [ -x $tcp_path ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
154 tcbin=tcmplex-panteltje
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
155 tcopt=-0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
156 elif [ -x $tc_path ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
157 tcbin=tcmplex
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
158 tcopt=-p
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
159 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
160 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
161 ERROR: Can't find any sutable mplex utility. You can download
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
162 tcmplex-panteltje at http://sunsite.rediris.es/
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
163 sites2/ibiblio.org/linux/apps/video/tcmplex-panteltje-0.3.tgz
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
164 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
165 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
166 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
167
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
168 #pharsing parameters
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 if [ $# -le 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
171 echo "Missing parameter!"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
172 usage
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
173 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
174 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
175
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 -h)
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 echo "Missing parameter!"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
183 usage
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
184 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
185 ;;
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 input=`echo $1 |sed 's/\\ / /'`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
188 if [ "$input" = "`basename "$input"`" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
189 input="`pwd`/$1"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
190 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
191 nev=`basename "$input" .avi`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
192 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
193 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
194 esac
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
195
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
196 while [ "$1"x != "x" ]; do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
197 case $1 in
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
198 -b|--bitrate)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
199 bitrate=$2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
200 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
201 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
202 -s|--cdsize)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
203 cdsize="$2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
204 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
205 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
206 -d|--device)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
207 dev4="$2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
208 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
209 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
210 -w|--write)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
211 burning=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
212 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
213 -c|--clean)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
214 cleaning=1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
215 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
216 -h|--help)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
217 usage
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
218 exit 0
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
219 ;;
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
220 esac
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
221 shift 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
222 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
223
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
224 #checking for cd-recording device
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
225 if [ "$burning" = 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
226 echo -n "Searching for cdrecorder device... "
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
227
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
228 if [ `uname -r |cut -d '.' -f 2` = 4 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
229 #linux 2.4.x
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
230 dev="dev=$dev4"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
231 echo "$dev4"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
232 elif [ `uname -r |cut -d '.' -f 2` = 6 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
233 #linux 2.6.x
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
234 if [ -e /dev/cdrecorder ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
235 dev='dev=/dev/cdrecorder'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
236 echo "/dev/cdrecorder"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
237 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
238 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
239 ERROR: Device file /dev/cdrecorder not found. Please link your
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
240 cd-recording device to /dev/cdrecorder!
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
241 Example: 'cd /dev; ln -s hdc cdrecorder'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
242 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
243 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
244 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
245 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
246 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
247 ERROR: Linux 2.4 or 2.6 series not found. You can download it at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
248 http://www.kernel.org/ ;-)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
249 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
250 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
251 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
252
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
253 #checking for cdrecord
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
254 which cdrecord >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
255 cdrbin=`which cdrecord 2>/dev/null`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
256 if [ $? != 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
257 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
258 ERROR: Can't find cdrecord. You can download it at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
259 ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01a20.tar.gz
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
260 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
261 exit 1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
262 else #checking for version >= 2.01a14
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
263 echo -n "Checking for cdrecord version >= 2.01a14... "
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
264 $cdrbin cuefile=a 2>&1 |grep 'Bad Option' >/dev/null 2>&1
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
265 if [ "$?" = 0 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
266 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
267 ERROR: Can't find cdrecord version >= 2.01a14. You can download it at
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
268 ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01a20.tar.gz
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
269 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
270 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
271 echo "`$cdrbin -version |cut -d ' ' -f 2`"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
272 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
273 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
274 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
275
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
276 #checking for sub avariable
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
277
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
278 if [ -f "$nev.sub" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
279 subopts=$nev.sub
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
280 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
281 subopts=''
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
282 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
283
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
284 if [ "x$subopts" = "x" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
285 subs=''
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
286 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
287 subs='-sub '
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
288 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
289
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
290 #checking for what height needed
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
291 inputwidth=`mplayer -vo null -ao null "$input" -frames 1 2>/dev/null |grep '=>'|cut -d ' ' -f 5|cut -d x -f 1`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
292 inputheight=`mplayer -vo null -ao null "$input" -frames 1 2>/dev/null |grep '=>'|cut -d ' ' -f 5|cut -d x -f 2`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
293 svcdaspect=`echo -e "scale=10\n1.596/($inputwidth/$inputheight)"|bc /dev/stdin`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
294 height=`echo -e "scale=10\n$svcdaspect*480"|bc /dev/stdin|cut -d . -f 1`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
295
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
296 #checking for ratios less than 1.33
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
297 istoohigh=`expr $height \> 577`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
298 if [ "$istoohigh" = 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
299 height=576
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
300 fi
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 #find out the vf options
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
303 if [ "$height" = 576 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
304 vfopts='-vf scale=480:576'
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
305 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
306 #-vf processes filters in reverse order
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
307 exy=`echo -e "scale=10\n(576-$height)/2"|bc /dev/stdin|cut -d . -f 1`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
308 vfopts="-vf scale=480:$height,expand=480:576:0:$exy:1"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
309 echo "Using filter options: '$vfopts'"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
310 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
311
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
312 #finish displaying informations
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
313 if [ "$burning" = 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
314 #asking for cd
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
315 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
316
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
317 Please insert a blank cd in your cdwriter.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
318 (If you are using a rewritable media,
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
319 don't forgot to blank it before using divx2svcd.)
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
320 Press any key when your are ready.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
321 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
322 read -n 1 i
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
323 fi
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
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
326 ###start working###
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
327 #encoding
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
328 mencoder -ofps 25 -oac lavc "$input" -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=$bitrate:acodec=mp2:abitrate=128:keyint=25:aspect=4/3:$paraopts -o "${nev}2.avi" -srate 44100 -of mpeg -channels 2 $vfopts $subs "$subopts"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
329
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
330 videosize=`$ls -l "${nev}2.avi"|tr -s ' '|cut -d ' ' -f5`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
331 if ! [ `echo $(( $cdsize*1048576 < $videosize ))` = "1" ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
332 #video is smaller, than $cdsize
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
333 mv ${nev}2.avi ${nev}00.mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
334 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
335 #splitting
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
336 mplayer -dumpvideo -dumpfile "$nev.m2v" "${nev}2.avi"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
337 mplayer -dumpaudio -dumpfile "$nev.mp2" "${nev}2.avi"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
338 rm "${nev}2.avi"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
339 echo "maxFileSize = $cdsize" > template
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
340 $tcbin -i "$nev.m2v" $tcopt "$nev.mp2" -o "$nev.mpg" -m s -F template
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
341 rm template
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
342 rm "$nev.m2v" "$nev.mp2"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
343 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
344
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
345 for i in *mpg
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
346 do
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
347 nev2=`basename "$i" .mpg`
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
348 #creating images
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
349 vcdimager -t svcd -c "$nev2.cue" -b "$nev2.bin" "$i"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
350 #burning if needs
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
351 if [ "$burning" = 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
352 if [ "$firstcd" != 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
353 cat <<EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
354
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
355 Please insert an another blank cd in your cdwriter.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
356 Press any key when your are ready.
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
357 EOF
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
358 read -n 1 i
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
359 else
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
360 firstcd=2
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
361 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
362 $cdrbin -v -dao $dev speed=12 gracetime=2 driveropts=burnfree -eject cuefile="$nev2.cue"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
363 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
364 #cleaning if needs
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
365 if [ "$cleaning" = 1 ]; then
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
366 rm -f "$nev2.cue" "$nev2.bin"
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
367 fi
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
368 done
305dc504c407 Give all shell scripts a .sh suffix for consistency.
diego
parents:
diff changeset
369 rm -f "$nev"*mpg