9675
|
1 <?xml version="1.0" encoding="iso-8859-1"?>
|
|
2 <chapter id="cd-dvd">
|
|
3 <title>CD/DVD usage</title>
|
|
4
|
|
5 <sect1 id="drives">
|
|
6 <title>CD/DVD drives</title>
|
|
7 <para>
|
|
8 Linux documentation excerpt:
|
|
9 </para>
|
|
10
|
|
11 <para>
|
|
12 Modern CD-ROM drives can attain very high head speeds, yet some CD-ROM drives
|
|
13 are capable of running at reduced speeds. There are several reasons that might
|
|
14 make you consider changing the speed of a CD-ROM drive:
|
|
15 </para>
|
|
16
|
|
17 <itemizedlist>
|
|
18 <listitem><para>
|
|
19 There have been reports of read errors at high speeds, especially
|
|
20 with badly pressed CD-ROMs. Reducing the speed can prevent data loss under
|
|
21 these circumstances.
|
|
22 </para></listitem>
|
|
23
|
|
24 <listitem><para>
|
|
25 Many CD-ROM drives are annoyingly loud, a lower speed may reduce the noise.
|
|
26 </para></listitem>
|
|
27 </itemizedlist>
|
|
28
|
|
29 <para>
|
|
30 You can reduce the speed of IDE CD-ROM drives with <command>hdparm</command> or a
|
|
31 program called <command>setcd</command>. It works like this:
|
|
32 <screen>hdparm -E [speed] [cdrom device]</screen>
|
|
33 <screen>setcd -x [speed] [cdrom device]</screen>
|
|
34 </para>
|
|
35
|
|
36 <para>
|
|
37 You can also try
|
|
38 <screen>echo current_speed:4 > /proc/ide/[cdrom device]/settings</screen>
|
|
39 but you will need root privileges. The following command may also help:
|
|
40 <screen>echo file_readahead:2000000 > /proc/ide/[cdrom device]/settings</screen>
|
|
41 </para>
|
|
42
|
|
43 <para>
|
|
44 This sets prefetched file reading to 2MB, which helps with scratched CD-ROMs.
|
|
45 If you set it to too high, the drive will continuously spin up and down, and
|
|
46 will dramatically decrease the performance.
|
|
47 It is recommended that you also tune your CD-ROM drive with <command>hdparm</command>:
|
|
48 <screen>hdparm -d1 -a8 -u1 <replaceable>cdrom device</replaceable></screen>
|
|
49 </para>
|
|
50
|
|
51 <para>
|
|
52 This enables DMA access, read-ahead, and IRQ unmasking (read the <command>hdparm</command>
|
|
53 man page for a detailed explanation).
|
|
54 </para>
|
|
55
|
|
56 <para>
|
|
57 Please refer to "<filename>/proc/ide/[cdrom device]/settings"</filename>
|
|
58 for fine-tuning your CD-ROM.
|
|
59 </para>
|
|
60
|
|
61 <para>
|
|
62 SCSI drives do not have a uniform way of setting these parameters (Do you know one?
|
|
63 Tell us!) There is a tool that works for
|
|
64 <ulink url="http://das.ist.org/~georg/">Plextor SCSI drives</ulink>.
|
|
65 </para>
|
|
66
|
|
67 <para>FreeBSD:</para>
|
|
68 <para>Speed: <command>cdcontrol [-f device] speed [speed]</command></para>
|
|
69 <para>DMA: <command>sysctl hw.ata.atapi_dma=1</command></para>
|
|
70 </sect1>
|
|
71
|
|
72 <sect1 id="dvd">
|
|
73 <title>DVD playback</title>
|
|
74 <para>
|
|
75 For the complete list of available options, please read the man page.
|
|
76 The Syntax for a standard Digital Versatile Disc (DVD) is as follows:
|
|
77 <screen>mplayer -dvd <track> [-dvd-device <device>]</screen>
|
|
78 </para>
|
|
79
|
|
80 <para>
|
|
81 Example:
|
|
82 <screen>mplayer -dvd 1 -dvd-device /dev/hdc</screen>
|
|
83 </para>
|
|
84
|
|
85 <para>
|
|
86 The default DVD device is <filename>/dev/dvd</filename>. If your setup
|
|
87 differs, make a symlink or specify the correct device on the command
|
|
88 line with the <option>-dvd-device</option> option.
|
|
89 </para>
|
|
90
|
|
91 <formalpara>
|
|
92 <title>New-style DVD support (mpdvdkit2)</title>
|
|
93 <para>
|
|
94 <application>MPlayer</application> uses <systemitem>libdvdread</systemitem> and
|
|
95 <systemitem>libdvdcss</systemitem> for DVD decryption and playback. These two
|
|
96 libraries are contained in the <filename class="directory">libmpdvdkit2/</filename>
|
|
97 subdirectory of the MPlayer source tree, you do not have to install them separately.
|
|
98 We opted for this solution because we had to fix a <systemitem>libdvdread</systemitem>
|
|
99 bug and apply a patch which adds
|
|
100 <emphasis role="bold">cracked CSS keys caching support</emphasis> to
|
|
101 <systemitem>libdvdcss</systemitem> This results in a large speed increase because the
|
|
102 keys do not have to be cracked every time before playing.
|
|
103 </para>
|
|
104 </formalpara>
|
|
105
|
|
106 <para>
|
|
107 <application>MPlayer</application> can also use system-wide <systemitem>libdvdread</systemitem>
|
|
108 and <systemitem>libdvdcss</systemitem> libraries, but this solution is
|
|
109 <emphasis role="bold">not</emphasis> recommended, as it can result in bugs,
|
|
110 library incompatibilities and slower speed.
|
|
111 </para>
|
|
112
|
|
113 <formalpara>
|
|
114 <title>DVD Navigation support (dvdnav)</title>
|
|
115 <para>
|
|
116 Support for DVD navigation via <systemitem>dvdnav</systemitem> was being worked
|
|
117 on, but it was never finished properly and it is currently unmaintained. Who
|
|
118 knows, it might even compile.
|
|
119 </para>
|
|
120 </formalpara>
|
|
121
|
|
122 <formalpara>
|
|
123 <title>Old-style DVD support - OPTIONAL</title>
|
|
124 <para>
|
|
125 Useful if you want to play encoded VOBs from <emphasis role="bold">hard disk</emphasis>.
|
|
126 Compile and install <emphasis role="bold">libcss</emphasis> 0.0.1 (not newer) for this
|
|
127 (If MPlayer fails to detect it, use the <option>-csslib /path/to/libcss.so</option>
|
|
128 option). To use it, you need to be root, use a suid root MPlayer binary or let
|
|
129 MPlayer call the suid-root fibmap_mplayer wrapper program.
|
|
130 </para>
|
|
131 </formalpara>
|
|
132
|
|
133 <formalpara>
|
|
134 <title>DVD structure</title>
|
|
135 <para>
|
|
136 DVD disks have 2048 bytes per sector with ECC/CRC. They usually have an UDF
|
|
137 filesystem on a single track, containing various files (small .IFO and .BUK
|
|
138 files and big (1GB) .VOB files). They are real files and can be copied/played
|
|
139 from the mounted filesystem of an unencrypted DVD.
|
|
140 </para>
|
|
141 </formalpara>
|
|
142
|
|
143 <para>
|
|
144 The .IFO files contain the movie navigation information (chapter/title/angle
|
|
145 map, language table, etc) and are needed to read and interpret the .VOB content
|
|
146 (movie). The .BUK files are backups of them. They use
|
|
147 <emphasis role="bold">sectors</emphasis> everywhere, so you need to use raw
|
|
148 addressing of sectors of the disc to implement DVD navigation or decrypt the
|
|
149 content.
|
|
150 </para>
|
|
151
|
|
152 <para>
|
|
153 The whole old-style DVD support with <systemitem>libcss</systemitem> therefore
|
|
154 needs a mounted DVD filesystem and raw sector-based access to the device.
|
|
155 Unfortunately you must (under Linux) be root to get the sector address of a
|
|
156 file. You have the following choices:
|
|
157
|
|
158 <itemizedlist>
|
|
159 <listitem><para>
|
|
160 Be root or use a suid-root <application>MPlayer</application> binary.
|
|
161 </para></listitem>
|
|
162
|
|
163 <listitem><para>
|
|
164 Let <application>MPlayer</application> call the suid-root fibmap_mplayer
|
|
165 wrapper program to access the DVD (used in the old-style DVD playback over
|
|
166 <systemitem>libcss</systemitem>).
|
|
167 </para></listitem>
|
|
168
|
|
169 <listitem><para>
|
|
170 Don't use the kernel's filesystem driver at all and reimplement it in
|
|
171 userspace. <systemitem>libdvdread</systemitem> 0.9.x and <systemitem>libmpdvdkit</systemitem>
|
|
172 do this (new-style DVD support). The kernel UDF filesystem driver is not
|
|
173 needed as they already have their own builtin UDF filesystem driver.
|
|
174 Also the DVD does not have to be mounted as only the raw sector-based
|
|
175 access is used.
|
|
176 </para></listitem>
|
|
177 </itemizedlist>
|
|
178 </para>
|
|
179
|
|
180 <para>
|
|
181 Sometimes <filename>/dev/dvd</filename> cannot be read by users, so the
|
|
182 <systemitem>libdvdread</systemitem> authors implemented an emulation layer
|
|
183 which transfers sector addresses to filenames+offsets, to emulate raw
|
|
184 access on top of a mounted filesystem or even on a hard disk.
|
|
185 </para>
|
|
186
|
|
187 <para>
|
|
188 <systemitem>libdvdread</systemitem> even accepts the mountpoint instead of
|
|
189 the device name for raw access and checks <filename>/proc/mounts</filename>
|
|
190 to get the device name. It was developed for Solaris, where device names
|
|
191 are dynamically allocated.
|
|
192 </para>
|
|
193
|
|
194 <para>
|
|
195 The default DVD device is <filename>/dev/dvd</filename>. If your setup differs,
|
|
196 make a symlink, or specify the correct device on the command line with the
|
|
197 <option>-dvd-device</option> option.
|
|
198 </para>
|
|
199
|
|
200 <formalpara>
|
|
201 <title>DVD authentication</title>
|
|
202 <para>
|
|
203 The authentication and decryption method of the new-style DVD support is done
|
|
204 using a patched <systemitem>libdvdcss</systemitem> (see above). The method can
|
|
205 be specified through the environment variable <envar>DVDCSS_METHOD</envar>,
|
|
206 which can be set to key, disk or title.
|
|
207 </para>
|
|
208 </formalpara>
|
|
209
|
|
210 <para>
|
|
211 If nothing is specified it tries the following methods (default: key,
|
|
212 title request):
|
|
213 </para>
|
|
214
|
|
215 <orderedlist>
|
|
216 <listitem><para>
|
|
217 <emphasis role="bold">bus key</emphasis>: This key is negotiated during
|
|
218 authentication (a long mix of ioctls and various key exchanges, crypto
|
|
219 stuff) and is used to encrypt the title and disk keys before sending them
|
|
220 over the unprotected bus (to prevent eavesdropping). The bus key is needed
|
|
221 to get and predecrypt the crypted disk key.
|
|
222 </para></listitem>
|
|
223
|
|
224 <listitem><para>
|
|
225 <emphasis role="bold">cached key</emphasis>: <application>MPlayer</application>
|
|
226 looks for already cracked title keys which are stored in the
|
|
227 <filename class="directory">~/.mplayer/DVDKeys</filename> directory (fast ;).
|
|
228 </para></listitem>
|
|
229
|
|
230 <listitem><para>
|
|
231 <emphasis role="bold">key</emphasis>: If no cached key is available,
|
|
232 <application>MPlayer</application> tries to decrypt the disk key with a set
|
|
233 of included player keys.
|
|
234 </para></listitem>
|
|
235
|
|
236 <listitem><para>
|
|
237 <emphasis role="bold">disk</emphasis>: If the key method fails
|
|
238 (e.g. no included player keys), <application>MPlayer</application>
|
|
239 will crack the disk key using a brute force algorithm. This process
|
|
240 is CPU intensive and requires 64 MB of memory (16M 32Bit entries hash
|
|
241 table) to store temporary data. This method should always work (slow).
|
|
242 </para></listitem>
|
|
243
|
|
244 <listitem><para>
|
|
245 <emphasis role="bold">title request</emphasis>: With the disk key
|
|
246 <application>MPlayer</application> requests the crypted title keys,
|
|
247 which are inside <emphasis>hidden sectors</emphasis> using <systemitem>ioctl()</systemitem>.
|
|
248 The region protection of RPC-2 drives is performed in this step and may fail on such drives.
|
|
249 If it succeeds, the title keys will be decrypted with the bus and disk key.
|
|
250 </para></listitem>
|
|
251
|
|
252 <listitem><para>
|
|
253 <emphasis role="bold">title</emphasis>: This method is used if the title
|
|
254 request failed and does not rely on any key exchange with the DVD drive.
|
|
255 It uses a crypto attack to guess the title key directly (by finding a
|
|
256 repeating pattern in the decrypted VOB content and guessing that the
|
|
257 plain text corresponding to the first encrypted bytes is a continuation
|
|
258 of that pattern). The method is also known as "known plaintext attack"
|
|
259 or "DeCSSPlus". In rare cases this may fail because there is not
|
|
260 enough encrypted data on the disk to perform a statistical attack or because
|
|
261 the key changes in the middle of a title. This method is the only way to
|
|
262 decrypt a DVD stored on a hard disk or a DVD with the wrong region on an
|
|
263 RPC2 drive (slow).
|
|
264 </para></listitem>
|
|
265 </orderedlist>
|
|
266
|
|
267 <para>
|
|
268 RPC-1 DVD drives only protect region settings through software. RPC-2 drives
|
|
269 have a hardware protection that allows 5 changes only. It might be
|
|
270 needed/recommended to upgrade the firmware to RPC-1 if you have a RPC-2 DVD
|
|
271 drive. Firmware upgrades can be found on this
|
|
272 <ulink url="http://www.firmware-flash.com">firmware page</ulink>. If there is
|
|
273 no firmware upgrade available for your device, use the
|
|
274 <ulink url="http://www.linuxtv.org/download/dvd/dvd_disc_20000215.tar.gz">regionset tool</ulink>
|
|
275 to set the region code of your DVD drive (under Linux).
|
|
276 <emphasis role="bold">Warning</emphasis>: You can only set the region 5 times.
|
|
277 </para>
|
|
278 </sect1>
|
|
279
|
|
280 <sect1 id="vcd">
|
|
281 <title>VCD playback</title>
|
|
282 <para>
|
|
283 For the complete list of available options, please read the man page. The Syntax for a
|
|
284 standard Video CD (VCD) is as follows:
|
|
285 <screen>mplayer -vcd <track> [-cdrom-device <device>]</screen>
|
|
286 Example:
|
|
287 <screen>mplayer -vcd 2 -cdrom-device /dev/hdc</screen>
|
|
288 The default VCD device is <filename>/dev/cdrom</filename>. If your setup
|
|
289 differs, make a symlink or specify the correct device on the command line
|
|
290 with the <option>-cdrom-device</option> option.
|
|
291 </para>
|
|
292
|
|
293 <note><para>
|
|
294 At least Plextor and some Toshiba SCSI CD-ROM drives have horrible performance
|
|
295 reading VCDs. This is because the the CDROMREADRAW <systemitem>ioctl</systemitem>
|
|
296 is not fully implemented for these drives. If you have some knowledge of SCSI
|
|
297 programming, please <ulink url="../../tech/patches.txt">help us</ulink>
|
|
298 implement generic SCSI support for VCDs.
|
|
299 </para></note>
|
|
300
|
|
301 <para>
|
|
302 In the meantime you can extract data from VCDs with
|
|
303 <ulink url="http://140.132.1.204/OS/Linux/packages/X/viewers/readvcd/">readvcd</ulink>
|
|
304 and play the resulting file with <application>MPlayer</application>.
|
|
305 </para>
|
|
306
|
|
307 <formalpara>
|
|
308 <title>VCD structure</title>
|
|
309 <para>VCD disks consist of one or more tracks:</para>
|
|
310 </formalpara>
|
|
311
|
|
312 <itemizedlist>
|
|
313 <listitem><para>
|
|
314 The first track is a small 2048 bytes/sector data track with an iso9660
|
|
315 filesystem, usually containing Windows VCD player programs and maybe other
|
|
316 information (images, text, etc).
|
|
317 </para></listitem>
|
|
318
|
|
319 <listitem><para>
|
|
320 The second and other tracks are raw 2324 bytes/sector MPEG (movie)
|
|
321 tracks, containing one MPEG PS data packet per sector instead of a
|
|
322 filesystem. Similar to audio CD tracks, these tracks <emphasis role="bold">cannot
|
|
323 be mounted</emphasis> (Did you ever mount an audio CD to play it?).
|
|
324 As most movies are inside this track, you should try <option>-vcd 2</option> first.
|
|
325 </para></listitem>
|
|
326
|
|
327 <listitem><para>
|
|
328 There exist VCD disks without the first track (single track and no filesystem
|
|
329 at all). They are still playable, but cannot be mounted.
|
|
330 </para></listitem>
|
|
331 </itemizedlist>
|
|
332
|
|
333 <formalpara>
|
|
334 <title>About .DAT files</title>
|
|
335 <para>
|
|
336 The ~600 MB file visible on the first track of the mounted VCD is not a real
|
|
337 file! It is a so called ISO gateway, created to allow Windows to handle such
|
|
338 tracks (Windows does not allow raw device access to applications at all).
|
|
339 Under Linux you cannot copy or play such files (they contain garbage). Under
|
|
340 Windows it is possible as its iso9660 driver emulates the raw reading of
|
|
341 tracks in this file. To play a .DAT file you need the kernel driver which can
|
|
342 be found in the Linux version of PowerDVD. It has a modified iso9660 filesystem
|
|
343 (<filename>vcdfs/isofs-2.4.X.o</filename>) driver, which is able to emulate the
|
|
344 raw tracks through this shadow .DAT file. If you mount the disc using their
|
|
345 driver, you can copy and even play .DAT files with mplayer. But it will not
|
|
346 work with the standard iso9660 driver of the Linux kernel! Use the
|
|
347 <option>-vcd</option> option instead. Alternatives for VCD copying are the
|
|
348 new <ulink url="http://www.elis.rug.ac.be/~ronsse/cdfs/">cdfs</ulink> kernel
|
|
349 driver (not part of the official kernel) that shows CD sessions as image files and
|
|
350 <ulink url="http://cdrdao.sourceforge.net/">cdrdao</ulink>, a bit-by-bit
|
|
351 CD grabbing/copying application.
|
|
352 </para>
|
|
353 </formalpara>
|
|
354 </sect1>
|
|
355 </chapter>
|