annotate TOOLS/divx2svcd @ 11891:0f25119d6a96

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