annotate TOOLS/divx2svcd @ 22573:749da6290adc

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