LDP/LDP/howto/linuxdoc/DVD-Playing-HOWTO.sgml

440 lines
14 KiB
Plaintext

<!doctype linuxdoc system>
<article>
<title>DVD Playing HOWTO</title>
<author>Nathan Rowlan, nkr@helo.org</author>
<date>v0.1.8 5 June 2000</date>
<abstract>
A (hopefully) easy to follow explanation on how to get DVD movie playback
in Linux.
</abstract>
<toc>
<sect>
Introduction<label id="Introduction" >
<sect1>
Goal
<p>
The purpose of this is to provide step by step instructions on getting DVD movies to play in Linux. I will try to be as clear as possible, but if something is confusing or incorrect, please tell me about it and I'll fix it. If you have any questions, you can subscribe to the livid-dev mailing list by sending a blank email to livid-dev-subscribe@linuxvideo.org.
</p>
<sect1>
New Versions
<p>
This howto is available in many formats, including html and tex. The newest version can always be retrieved from my site at <url url="http://helo.org/dvd/howto/" name="http://helo.org/dvd/howto/">. It is highly recommended that you get the most recent version, as this howto is being updated quite often.
</p>
<sect1>
Copyrights and Trademarks
<p>
This manual may be reproduced in whole or in part, without fee, subject
to the following restrictions:
</p>
<p>
<itemize>
<item> The copyright notice above and this permission notice must be preserved complete on all complete or partial copies.
<item> Any translation or derived work must be approved by the author in writing before distribution.
<item> If you distribute this work in part, instructions for obtaining the complete version of this manual must be included, and a means for obtaining a complete version provided.
<item> Small portions may be reproduced as illustrations for reviews or quotes in other works without this permission notice if proper citation is given.
</itemize>
</p>
<p>
Exceptions to these rules may be granted for acedemic purposes: Write to the author and ask. These restrictions are here to protect us as authors, not to restrict you as learners and educators. Any souce code (aside from the SGML this document was written in) in this document is placed under the GNU General Public License, available via anonymous FTP from <url url="ftp://ftp.gnu.org/GNU/COPYING" name="the GNU archive">.
</p>
<sect1>
Thanks
<p>
Thanks to the authors of oms and the rest of the LiViD developers, who have given the project much of their time and work, and also to those individuals who have given me feedback to make this HOWTO better.
</p>
<p>
Much of the layout of this HOWTO was gotten from the HOWTO-HOWTO, written by Mark F. Komarinski. It can be found at <url url="http://www.linuxdoc.org/" name="http://www.linuxdoc.org/">.
</p>
<sect1>
Translations
<p>
Any translations of this document that I recieve go into <url url="http://helo.org/dvd/howto/trans/" name="http://helo.org/dvd/howto/trans/">. If you would like to translate this howto, please email me at nkr@helo.org.
</p>
<sect>
Requirements<label id="Requirements">
<p>
This HOWTO assumes you have:
<itemize>
<item> Linux > v2.2.0
<item> XFree86 3.3.X
<item> A DVD-ROM/RAM/RW drive supported in Linux (most are)
<item> A decent knowledge of bash and english
<item> A master's degree in Nuclear Engineering
</itemize>
<p>
<sect>
Files<label id="Files" >
<p>
First things first, you need to get a kernel with MTRR (more on this later)
and DVD ioctl support. While MTRR's have been in the kernel since 2.2.11
(correct me if I'm wrong), you will probably need to update your kernel
to get DVD ioctls. There are two ways to skin this cat, you can
either download a development kernel (v2.3.x), or patch a stable release
kernel (v2.2.x), the patches are at <url url="http://www.kernel.dk/" name="http://www.kernel.dk/">,
and the kernel can be found on your favorite mirror of <url url="ftp://ftp.kernel.org" name="ftp://ftp.kernel.org/">.
</p>
<p>
Next, you need to get the LiViD utilities. This can be done two ways:
</p>
<p>
<itemize>
<item> Get the LiViD utilities from CVS, so you can update it as it is being
updated by the developers. (recommended)
</itemize>
</p>
<p>
<verb>
The following commands will retrieve them:
# mkdir ~/livid
# cd ~/livid
# export CVSROOT=:pserver:anonymous@cvs.linuxvideo.org:/cvs/livid
# cvs login
(Logging in to anonymous@cvs.linuxvideo.org)
CVS password:
There is no password for anonymous, just press enter.
# cvs -z3 co -P ac3dec oms mpeg2dec mgadvd
They should download into their respective directories.
</verb>
</p>
<p>
<itemize>
<item>
If you don't like CVS (freak!), you can download the most recent
nightly tarball of LiViD. This contains more than you need, but if
you are really afraid of using CVS for some reason, suit yourself.
</itemize>
</p>
<p>
<verb>
It can be found at:
http://linuxvideo.org/developer/data/livid.tar.gz
</verb>
</p>
<sect>
Installation<label id="Installation">
<sect1>
Kernel
<p>
If you have a development kernel (2.3.x), you should
already have DVD ioctl support, so you just need to make sure you
have MTRR support enabled in the kernel configuration, and then compile
and install it as you normally would.
</p>
<p>
If you want to patch your exisiting kernel, start by going to
<verb>
http://www.kernel.dk/
</verb>
and downloading the correct patch for your kernel.
</p>
<p>
If don't know how to install or patch your kernel, you should go read
the Kernel HOWTO at:
<verb>
http://howto.tucows.com/LDP/HOWTO/Kernel-HOWTO.html
</verb>
</p>
<sect1>
LiViD Utilities
<p>
To install the LiViD utilities, you need to make sure you have /usr/local/lib
somewhere in /etc/ld.so.conf.
The following commands should compile and install the LiViD utilities on
your system. If you have problems, please see the "Problems" section.
</p>
<p>
<verb>
ac3dec:
# cd ~/livid/ac3dec
# ./autogen.sh
# make
# make install
mpeg2dec:
# cd ~/livid/mpeg2dec
# ./autogen.sh
# make
# make install
oms:
# cd ~/livid/oms
# ./autogen.sh
# ./configure
# make
# make install
</verb>
</p>
<p>
Now the necessary LiViD utilities should be installed. oms needs some
special fifo pipes to be created for the DVD data to travel over. These
can be made with the following commands (if they don't already exist):
</p>
<p>
<verb>
# mkfifo /tmp/video
# mkfifo /tmp/audio
</verb>
</p>
<p>
One last thing to do. Oms needs /dev/dvd to be a symlink to where
your DVD drive resides, such as /dev/hdb1 or /dev/scd0. If it is at
/dev/cdrom, you would create the link by typing:
</p>
<p>
<verb>
# ln -s /dev/cdrom /dev/dvd
</verb>
</p>
<p>
It is generally a good idea not to make a symlink to a symlink, because it
adds unnecessary I/O. Replace /dev/cdrom with the
correct device that your dvd drive is on.
</p>
<sect>
Playing<label id="Playing">
<p>
To play a DVD, you need to be running X in 16-bit color mode. With the
DVD in the drive, type:
</p>
<p>
<verb>
# ac3dec /tmp/audio& mpeg2dec /tmp/video& oms
</verb>
</p>
<p>
If all has gone well, some text should fly by, followed by it asking
you if you want it to look up the name of the disk in the DVDDB.
It is safe to say yes. Then, the oms panel should pop up. Click
the play button and the video window should appear and begin playing.
</p>
<sect>
Additional Stuff<label id="Additional Stuff">
<sect1>
Setting up MTRR's
<p>
<verb>
** Note to Matrox video card owners **
If you have matroxfb compiled into the kernel,
chances are that your MTRR's are already set
up. You can probably just skip this section.
</verb>
Setting up your MTRR's can increase video performance quite
a bit in some cases, so it is a good idea to do it. First,
you need to make sure you have MTRR support in your kernel by
typing:
<verb>
# ls /proc/mtrr
</verb>
</p>
<p>
If it tells you that there is no such thing as /proc/mtrr, you
need to recompile your kernel with MTRR support (it is under
"Processor type and features" in menuconfig).
</p>
<p>
Once you know MTRR is working, you need to know the base memory
address of your video card, and how much video ram it has. The
easiest way to do this is to look at the output of X as it starts
up. Because the output usually scrolls off the screen and is
lost when it switches to a different tty, you need to redirect the
output of X to a file (xoutput) so you can go back and look at it
to get the needed values. This can be done by typing:
</p>
<p>
<verb>
# startx 2> xoutput
</verb>
</p>
<p>
The line having the needed information is probably somewhere
towards the middle of xoutput, and should look something like:
</p>
<p>
<verb>
(--) SVGA: PCI: NVidia Riva TNT2 rev 17, Memory @ 0xee000000, 0xe2000000
</verb>
</p>
<p>
Once you have located that, write down the last memory address, in
this case 0xe2000000. Depending on your hardware, you may or may not
have multiple memory addresses shown, so don't worry if yours looks a
little different. With this information recorded, you can delete
xoutput.
</p>
<p>
Next you need to create a new MTRR. In order to do that, you have
know how much ram your video card has in hex. Here are some common
values:
</p>
<p>
<verb>
4MB -- 0x400000
8MB -- 0x800000
16MB -- 0x1000000
32MB -- 0x2000000
</verb>
</p>
<p>
To add the MTRR, type:
</p>
<p>
<verb>
# echo "base=0xe2000000 size=0x2000000 type=write-combining" >| /proc/mtrr
</verb>
</p>
<p>
Substituting "0xe2000000" and "0x2000000" with the base address and amount
of video ram specific to your system.
</p>
<p>
Now you should have MTRR set up, and just to make sure, type:
</p>
<p>
<verb>
# cat /proc/mtrr
</verb>
</p>
<p>
And you should get output that looks remotely similar to:
</p>
<p>
<verb>
reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1
reg01: base=0xe2000000 (3616MB), size= 32MB: write-combining, count=1
</verb>
</p>
<p>
Again, the number of entries will probably be different from these,
don't sweat it.
</p>
<sect>
Problems<label id="Problems">
<sect1>
Run time errors<label id="Run time erors">
<p>
This is a (small) list of known run-time errors.
</p>
<sect2>
Illegal Instruction Error
<p>
If you use a non-Intel chip (K6 especially), and you are getting
this error when you try to run mpeg2video, try editing
nist/configure.in, lines 129 and 130:
</p>
<p>
<verb>
CFLAGS="$CFLAGS -DHAVE_MMX -DLINUX -march=i686 -fschedule-insns2 -malign-doub
CXXFLAGS="$CXXFLAGS -DHAVE_MMX -DLINUX -march=i686 -fschedule-insns2 -malign-
</verb>
</p>
<p>
replace "-march=i686" in both with "-march=i586", and then recompile
and reinstall.
</p>
<sect1>
Compilation errors<label id="Compilation errors">
<p>
This is a running list of common compilation errors that have known
fixes.
</p>
<sect2>
`dvd_struct' undeclared...
<p>
The most frequent problem people have when trying to compile these utilities stems from oms looking in the wrong place for the kernel headers. By default, it uses /usr/include/[linux|asm], but those headers are from a stable kernel so that when you compile a normal program, it will be using stable headers. oms needs to use non-stable (or patched) kernel headers, so when oms tries to compile, many things are undeclared and compilation fails. The best way to fix this is to edit the oms Makefile and -I/usr/src/linux/include to the CFLAGS and CXXFLAGS. (thanks to Adam Powell for this info)
</p>
<p>
<verb>
These commands should do it:
# mkdir /usr/include/old
# mv /usr/include/linux /usr/include/old/linux
# mv /usr/include/asm /usr/include/old/asm
# mv /usr/include/scsi /usr/include/old/scsi
# ln -s /usr/src/linux/include/linux /usr/include/linux
# ln -s /usr/src/linux/include/scsi /usr/include/scsi
# ln -s /usr/src/linux/include/asm /usr/include/asm
</verb>
</p>
<sect2>
can't determine absolute dir of '../../../../src/plugin/codec/mpeg2dec/.libs'
<p>
Another common error is with the oms/src/plugin/codec/mpeg2dec/.libs
directory. For some reason or another, this directory does not
exist, and it needs to for compilation. To fix it, just make the
directory:
</p>
<p>
<verb>
# mkdir src/plugin/codec/mpeg2dec/.libs
</verb>
</p>
<sect1>
Broken stuff<label id="Broken stuff">
<p>
Features that don't currently work as intended:
<itemize>
<item> None of the chapter seek buttons work very well (crash).
<item> Once stopped, it doesn't like to start again (crash).
<item> Audio/video like to skip every second or so.
<item> Extreme slowdowns at beginning of chapters with mpeg2dec.
<item> Sometimes ac3dec doesn't close properly, and must be killed via "killall ac3dec".
</itemize>
</p>
<sect1>
Other errors<label id="Other errors">
<p>
If your problem isn't listed here, then likely the current CVS
code has a bug in it. The best thing to do
is just to wait a few days, and then try updating from CVS. There is
a mailing list where you can ask questions, to subscribe send a
blank email to livid-dev-subscribe@linuxvideo.org.
</p>
<sect>
To Do<label id="To Do">
<p>
<itemize>
<item> Get someone with a Matrox card to send me a list of things
they did to improve performance. (dent!!!)
<item> Makefile options (HAVE_MMX, HAVE_3Dnow, etc)
<item> -march=k6 for mpeg2dec
<item> add easy MTRR stuff (framebuffer)
<item> add need for region coding to be set on most drives: www.linuxtv.org/dvd
</itemize>
</p>
</article>