First let me introduce you to some tools you'll use.
I'll present you two methods for DVD transcoding - using MEncoder
and transcode. Nevertheless you need some files for both method.
In an ideal world there would be only one codec - the best one. But this
world is far from ideal. The result is that there is a wide range of
video and audio codecs to chose from. First I'll explain the different
types of codecs:
Today most codecs come with a native version for Linux (like XviD,
DivX 4/5 and others).
Here's a list of supported video codecs:
- MPEG4 is an official video compression standard. There is no
codec whose name is simply MPEG4. If you talk about MPEG4 you don't
talk about a specific codec - you talk about a set of techniques to
compress videos. MPEG4 compliant means that a codec produces
files that can be played by other MPEG4 compliant codecs.
- DivX ;-) is the "original" hacked Microsoft MPEG4 codec that
started all those ripping frenzies. It does not support all MPEG4 features
like b-frames
* or
global movement compensation (GMC
*). Some still use it
under Windows with the excellent tool Nandub. It is seldom used
under Linux because there are codecs that provide better quality. It comes
as a Windows dynamic library (divx.dll and some others) and
requires avifile.
- DivX 4 and 5 are the official successors. DivX 5
replaces DivX 4. That's why you can't have both codecs installed
at the same time (well technically you can, but you shouldn't, for
obvious reasons). These are native Linux shared objects called
libdivxdecore.so and libdivxencore.so. This
is closed source. For Windows there are different versions available and
only the commercial version supports all encoding options like
b-frames*,
GMC*
or quarter PEL*. The
free version can still be used to view all files
created with even the commercial version. Unfortunately there's only
the free version for Linux which doesn't support all those nice options.
DivXNetworks are thinking about providing a commercial solution for
Linux as well. But don't expect that codec to be available soon.
- XviD (it's
DivX read backwards) is an Open
Source MPEG4 implementation that is really good considering compression
and picture quality. Support for advanced MPEG4 features
(b-frames*,
GMC*)
is being worked on or has already been implemented.
- libavcodec or short lavc is another Open Source MPEG4
compliant video codec which is superior in performance and quality to
DivX 5 and even to XviD. This codec supports
b-frames*. It is part
of the ffmpeg project.
- Of course there are the MPEG1 compliant codecs that you need for
VCDs and the MPEG2 compliant codecs for SVCDs or DVDs. At the moment
this guide aims at producing AVIs so I won't go into detail about
either one of these.
- Most other codecs are either outdated (like Intel Indeo 5) or
other cracked version of Microsoft's MPEG4 codec (like AngelPotion).
Still other codecs are under heavy development (like VP4) and do
not present a workable solution for us here.
This guide tries to focus on two codecs: XviD and lavc.
Reasons are that both provide excellent quality, both are fast and you only
need a MPEG4 compliant decoder (like DivX 5 or XviD) on a
Windows system for playback. Playback under Linux is no problem at all -
MPlayer or Xine do happily play DivX 4/5, XviD and
lavc encoded movies.
Again a list, this time for audio codecs:
- MP3 is short for MPEG1 layer 3 and is an official
audio compression standard. If you talk about MP3 you actually
talk about a compression technique, not about a codec in particular. There
are more codecs for MP3 than I can name in a full day.
- lame is an acronym for "Lame Ain't an MP3 Encoder" (although
it is ;-)). It provides a encoder that produces high quality MP3 files.
Both transcode and MEncoder use lame for
audio compression.
- AC3 is again an official audio compression standard. Almost all
DVDs contain AC3 encoded audio. Today there are decoders for
both Windows and Linux that work with AC3 sound inside AVIs.
The advantage is that no re-compression is necessary (recompressing
always loses quality) and that multi channel sound (Dolby Surround and
the likes) will be preserved. The disadvantage is that AC3 sound
needs more space than MP3 encoded sound.
- Vorbis is a new Open Source audio compression. It is available
for both Windows and Linux. Its advantages are a better quality : size
ratio compared to MP3 and multi channel support. Unfortunately
you cannot safely include Vorbis audio into AVI files - but I'm working
on a tool that can join video and Vorbis audio in an OGG container.
As soon as it is ready I will include it in this guide.
I hope this clears things up a bit.
I won't go into too much detail in this chapter. There is more documentation
on how to install included with each package. Refer to that if you have
problems. Also note that MPlayer has rather strong requirements
regarding versions of gcc, binutils and other central system components.
Refer to the
MPlayer installation documentation.
Note: Before downloading software check if your distribution
already contains that software. I use Debian Woody (testing) and have found
that a lot of software is already available prepackaged.
- libdvdcss - Head over to
the Ogle project page and download
libdvdcss-0.0.3.ogle3.tar.gz (note that version numbers may
differ as software is always under development). Un-tar-gz it, compile
it, and install it in /usr/local . Please note that
there different versions of this library floating around (0.0.3,
1.0.1). MPlayer still suggests that you use 0.0.3.
- libdvdread - Get it from the same web page as libdvdcss.
Note that Debian Woody already contains libdvdread. A simple
apt-get install libdvdread2 libdvdread2-dev should do the trick.
- XviD codec - Needed if you want to use transcode.
Short instructions taken from the MPlayer documentation:
cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid login
When asked for a password simply hit enter.
cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid co xvidcore
cd xvidcore/build/generic
- Edit Makefile.linux to fit your needs.
make -f Makefile.linux
- Copy the
xvidcore/src/divx4.h file to
/usr/local/include/decore.h and to
/usr/local/include/encore2.h. Be sure to make a backup
of the files you will overwrite!
- Copy
libxvidcore.so and libcore.a to
/usr/local/lib/
For the compilation you might need a special version of nasm
which you can get
here.
- vobcopy - Get it from
the
homepage.
- avifile - As explained it is needed to access Windows
codecs for which there are no native Linux binaries. Head over to
the homepage.
Before you do that check again if your Linux distribution already
provides avifile (Debian Woody does). You still need the
Windows codecs from the avifile homepage or directly
from
MPlayer's homepage.
- DivX 5 - although this guide does not focus on DivX 5
you can get it from
http://www.divx.com/. If you have some time to spare than I suggest
make some comparisons between DivX 5 and XviD or
lavc and see for yourself that it is worse than the two latter
codecs.
You need MPlayer. It doesn't matter if you'll use MEncoder
or transcode later on - you still need this. So get MPlayer
from
http://www.mplayerhq.hu/. I prefer the CVS version as it often has
features that the official releases lack! In fact I base this guide on
features have been committed to CVS just a few days earlier (today is April 30,
2002). Just do the same - be brave and get the CVS version.
If you want to encode using MEncoder I suggest you also get
a version of libavcode for encoding. You only need to download it
if you are using a CVS version of MPlayer. Releases come pre-packaged
with libavcodec. These instructions are taken from the
MPlayer documentation:
- Check out the ffmpeg project from CVS:
cvs -d:pserver:anonymous@cvs.ffmpeg.sourceforge.net:/cvsroot/ffmpeg
login. Just hit enter when you're prompted for a login or
password.
cvs
-d:pserver:anonymous@cvs.ffmpeg.sourceforge.net:/cvsroot/ffmpeg co
ffmpeg
- Move the libavcodec directory from the Ffmpeg sources to the root of the
MPlayer CVS tree. Symlinking is not enough, you have to copy/move it!!!
A note on compiling: Be sure not to include XviD support.
Instead include support for libavcodec. Installation instructions
are provided in the MPlayer docs. Yes, you've read correctly:
compile transcode with XviD and MPlayer
without XviD but with libavcodec. The
reason is that MPlayer can't contain support for both codecs at
the same time as both use variables that have the same name.
Get transcode from the
homepage. Make sure that it compiles with XviD
support as well as with support for MPlayer's post processing
functions. Again I advice you to chose the CVS version.
Additionally you really want to download dvd::rip, an excellent
Gtk+ based frontend for transcode. Get it from
here. Installation
instructions are included.
I know of at least two places where you can find some RPMs for the software
mentioned above: