~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to DOCS/xml/en/codecs.xml

  • Committer: Reinhard Tartler
  • Date: 2006-07-08 08:45:33 UTC
  • Revision ID: siretart@tauware.de-20060708084533-dbc155bde7122e78
imported mplayer_0.99+1.0pre7try2+cvs20060117

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!-- $Revision: 1.74 $ -->
 
3
<chapter id="codecs">
 
4
<title>Codecs</title>
 
5
 
 
6
<sect1 id="video-codecs">
 
7
<title>Video codecs</title>
 
8
 
 
9
<para>
 
10
See the <ulink url="../../codecs-status.html">codec status table</ulink>
 
11
for the complete, daily generated list. Quite a few codecs are available for
 
12
download from our homepage. Grab them from our
 
13
<ulink url="http://www.mplayerhq.hu/MPlayer/releases/codecs/">codecs page</ulink>.
 
14
</para>
 
15
 
 
16
<para>
 
17
The most important ones above all:
 
18
</para>
 
19
 
 
20
<itemizedlist>
 
21
<listitem><simpara>
 
22
  <emphasis role="bold">MPEG-1</emphasis> (<emphasis role="bold">VCD</emphasis>) and
 
23
  <emphasis role="bold">MPEG-2</emphasis> (<emphasis role="bold">DVD</emphasis>) video
 
24
  </simpara></listitem>
 
25
<listitem><simpara>
 
26
  native decoders for <emphasis role="bold">DivX ;-), OpenDivX (DivX4),
 
27
  DivX 5 (Pro), 3ivX, M$ MPEG-4</emphasis> v1, v2 and other MPEG-4 variants
 
28
  </simpara></listitem>
 
29
<listitem><simpara>
 
30
  native decoder for <emphasis role="bold">Windows Media Video 7/8</emphasis>
 
31
  (<emphasis role="bold">WMV1/WMV2</emphasis>), and Win32 DLL decoder
 
32
  for <emphasis role="bold">Windows Media Video 9</emphasis>
 
33
  (<emphasis role="bold">WMV3</emphasis>), both used in <filename>.wmv</filename>
 
34
  files
 
35
  </simpara></listitem>
 
36
<listitem><simpara>
 
37
  native <emphasis role="bold">Sorenson 1 (SVQ1)</emphasis> decoder
 
38
  </simpara></listitem>
 
39
<listitem><simpara>
 
40
  native <emphasis role="bold">Sorenson 3 (SVQ3)</emphasis> decoder
 
41
  </simpara></listitem>
 
42
<listitem><simpara>
 
43
  <emphasis role="bold">3ivx</emphasis> v1, v2 decoder
 
44
  </simpara></listitem>
 
45
<listitem><simpara>
 
46
  Cinepak and <emphasis role="bold">Intel Indeo</emphasis> codecs (3.1,3.2,4.1,5.0)
 
47
  </simpara></listitem>
 
48
<listitem><simpara>
 
49
  <emphasis role="bold">MJPEG</emphasis>, AVID, VCR2, ASV2 and other hardware
 
50
  formats
 
51
  </simpara></listitem>
 
52
<listitem><simpara>
 
53
  VIVO 1.0, 2.0, I263 and other <emphasis role="bold">H.263(+)</emphasis> variants
 
54
  </simpara></listitem>
 
55
<listitem><simpara>
 
56
  FLI/FLC
 
57
  </simpara></listitem>
 
58
<listitem><simpara>
 
59
  <emphasis role="bold">RealVideo 1.0 &amp; 2.0</emphasis> from
 
60
  <systemitem class="library">libavcodec</systemitem>, and
 
61
  <emphasis role="bold">RealVideo 3.0 &amp; 4.0</emphasis> codecs using RealPlayer
 
62
  libraries
 
63
  </simpara></listitem>
 
64
<listitem><simpara>
 
65
  native decoder for HuffYUV
 
66
  </simpara></listitem>
 
67
<listitem><simpara>
 
68
  Various old simple RLE-like formats
 
69
  </simpara></listitem>
 
70
</itemizedlist>
 
71
 
 
72
<para>
 
73
If you have a Win32 codec not listed here which is not supported yet,
 
74
please read the <link linkend="codec-importing">codec importing HOWTO</link>
 
75
and help us add support for it.
 
76
</para>
 
77
 
 
78
 
 
79
<sect2 id="divx4-5">
 
80
<title>DivX4/DivX5</title>
 
81
 
 
82
<para>
 
83
This section contains information about the DivX4 and DivX5 codecs of
 
84
<ulink url="http://www.projectmayo.com">Project Mayo</ulink>.
 
85
Their first available alpha version was OpenDivX 4.0 alpha 47 and 48.
 
86
Support for this was included in <application>MPlayer</application> in the
 
87
past, and built by default. We also used its postprocessing code to
 
88
optionally enhance visual quality of MPEG-1/2 movies. Now we use our own,
 
89
for all file types.
 
90
</para>
 
91
 
 
92
<para>
 
93
The new generation of this codec is called DivX4 and can even decode
 
94
movies made with the infamous DivX codec! In addition it is much faster
 
95
than the native Win32 DivX DLLs but slower than
 
96
<systemitem class="library">libavcodec</systemitem>.
 
97
Hence its usage as a decoder is
 
98
<emphasis role="bold">discouraged</emphasis>. However, it is useful for
 
99
encoding. One disadvantage of this codec is that it is not available under an
 
100
Open Source license.
 
101
</para>
 
102
 
 
103
<para>
 
104
DivX4 works in two modes:
 
105
<variablelist>
 
106
<varlistentry><term><option>-vc odivx</option></term>
 
107
<listitem><simpara>
 
108
  Uses the codec in OpenDivX fashion. In this case it produces YV12 images
 
109
  in its own buffer, and <application>MPlayer</application> does colorspace
 
110
  conversion via libvo. (<emphasis role="bold">Fast, recommended!</emphasis>)
 
111
  </simpara></listitem>
 
112
</varlistentry>
 
113
<varlistentry><term><option>-vc divx4</option></term>
 
114
<listitem><simpara>
 
115
  Uses the colorspace conversion of the codec.  In this mode you can use
 
116
  YUY2/UYVY, too. (<emphasis role="bold">SLOW</emphasis>)
 
117
  </simpara></listitem>
 
118
</varlistentry>
 
119
</variablelist>
 
120
</para>
 
121
 
 
122
<para>
 
123
The <option>-vc odivx</option> method is usually faster, due to the fact
 
124
that it transfers image data in YV12 (planar YUV 4:2:0) format, thus
 
125
requiring much less bandwidth on the bus. For packed YUV modes (YUY2, UYVY)
 
126
use the <option>-vc divx4</option> method. For RGB modes the speed is the
 
127
same, differing at best according to your current color depth.
 
128
<note>
 
129
<para>
 
130
If your <option>-vo</option> driver supports direct rendering, then <option>-vc
 
131
divx4</option> may be faster, or even the fastest solution.
 
132
</para>
 
133
 
 
134
<para>
 
135
The DivX4/5 binary codec library can be downloaded from
 
136
<ulink url="http://avifile.sf.net">avifile</ulink> or
 
137
<ulink url="http://www.divx.com">divx.com</ulink>
 
138
Unpack it, run <filename>./install.sh</filename> as root and do not forget adding
 
139
<filename class="directory">/usr/local/lib</filename> to your
 
140
<filename>/etc/ld.so.conf</filename> and running <command>ldconfig</command>.
 
141
</para>
 
142
 
 
143
<para>
 
144
Get the CVS version of the OLD OpenDivX core library like this:
 
145
</para>
 
146
 
 
147
<procedure>
 
148
<step><para>
 
149
<screen>cvs -d:pserver:anonymous@cvs.projectmayo.com:/cvsroot login</screen>
 
150
</para></step>
 
151
<step><para>
 
152
<screen>cvs -d:pserver:anonymous@cvs.projectmayo.com:/cvsroot co divxcore</screen>
 
153
</para></step>
 
154
<step><para>
 
155
This core library is split into a decore and encore library that have to be
 
156
compiled separately. For the decore Library, simply type
 
157
<screen>
 
158
cd divxcore/decore/build/linux
 
159
make
 
160
cp libdivxdecore.so /usr/local/lib
 
161
ln -s libdivxdecore.so /usr/local/lib/libdivxdecore.so.0
 
162
cp ../../src/decore.h /usr/local/include
 
163
</screen>
 
164
</para></step>
 
165
<step><para>
 
166
Alas, for the encore library there is no Linux Makefile available, and the
 
167
MMX optimized code only works on Windows. You can still compile it, though,
 
168
by using this
 
169
<ulink url="ftp://ftp.mplayerhq.hu/MPlayer/contrib/divx-mf/Makefile">Makefile</ulink>.
 
170
<screen>
 
171
cd ../../../encore/build
 
172
mkdir linux
 
173
cd linux
 
174
cp path/Makefile .
 
175
make
 
176
cp libdivxencore.so /usr/local/lib
 
177
ln -s libdivxencore.so /usr/local/lib/libdivxencore.so.0
 
178
cp ../../src/encore.h /usr/local/include
 
179
</screen>
 
180
</para></step>
 
181
</procedure>
 
182
 
 
183
<para>
 
184
<application>MPlayer</application> autodetects DivX4/DivX5 if it is
 
185
properly installed, just compile as usual. If it does not detect it, you
 
186
did not install or configure it correctly.
 
187
</para>
 
188
 
 
189
</note>
 
190
</para>
 
191
</sect2>
 
192
 
 
193
 
 
194
<sect2 id="ffmpeg" xreflabel="FFmpeg/libavcodec">
 
195
<title>FFmpeg/libavcodec</title>
 
196
 
 
197
<para>
 
198
<ulink url="http://ffmpeg.org">FFmpeg</ulink> contains an
 
199
<emphasis role="bold">open source</emphasis> codec package, which is capable
 
200
of decoding streams with various audio and video codecs. It also offers an
 
201
impressing encoding facility and higher speed than the Win32 codecs or the
 
202
DivX.com DivX4/5 libraries!
 
203
</para>
 
204
 
 
205
<para>
 
206
It contains a lot of nice codecs, especially important are the MPEG-4 variants:
 
207
DivX3, DivX4, DivX5, Windows Media Video 7/8 (WMV1/WMV2). Also a very interesting one
 
208
is the WMA decoder.
 
209
</para>
 
210
 
 
211
<para>
 
212
The most recent codec deserving credit is the <emphasis role="bold">Sorenson 3</emphasis>
 
213
(SVQ3) codec. This is the first, completely opensource implementation. It is even
 
214
faster than the original. Be sure to prefer this instead of the binary codec!
 
215
</para>
 
216
 
 
217
<para>
 
218
For a complete list of supported codecs please visit the FFmpeg homepage.
 
219
Supported <ulink url="http://ffmpeg.org/ffmpeg-doc.html#SEC19">video</ulink>
 
220
and <ulink url="http://ffmpeg.org/ffmpeg-doc.html#SEC20">audio</ulink> codecs.
 
221
</para>
 
222
 
 
223
<para>
 
224
If you use an <application>MPlayer</application> release you have
 
225
<systemitem class="library">libavcodec</systemitem>
 
226
right in the package, just build  as usual. If you use
 
227
<application>MPlayer</application> from CVS you have to extract
 
228
<systemitem class="library">libavcodec</systemitem> from
 
229
the FFmpeg CVS tree as FFmpeg releases are very rare. The CVS is mostly stable
 
230
and offers the most features. In order to achieve this do:
 
231
</para>
 
232
 
 
233
<procedure>
 
234
<step><para>
 
235
  <screen>cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login</screen>
 
236
  </para></step>
 
237
<step><para>
 
238
  <screen>cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -P ffmpeg/libavcodec ffmpeg/libavutil</screen>
 
239
  </para></step>
 
240
<step><para>
 
241
  Move the <filename>libavcodec</filename> and <filename>libavutil</filename>
 
242
  directories from the FFmpeg
 
243
  sources to the root of the <application>MPlayer</application> CVS tree.
 
244
  It should look like this:
 
245
  <filename class="directory">main/libavcodec</filename>
 
246
  <filename class="directory">main/libavutil</filename>
 
247
  </para><para>
 
248
  Symlinking is <emphasis role="bold">not</emphasis> enough, you have to
 
249
  copy/move it!
 
250
  </para></step>
 
251
<step><para>
 
252
  If you prefer having <systemitem class="library">libavcodec</systemitem>
 
253
  updated at the same time you update
 
254
  <application>MPlayer</application> CVS, put the following line into the
 
255
  <filename>main/CVS/Entries</filename> file:
 
256
  <screen>D/libavcodec////</screen>
 
257
  <screen>D/libavutil////</screen>
 
258
  </para></step>
 
259
<step><para>
 
260
  Compile. <filename>configure</filename> should detect problems before
 
261
  compilation.
 
262
  </para></step>
 
263
</procedure>
 
264
 
 
265
<note>
 
266
<para>
 
267
<application>MPlayer</application> from CVS does contain a
 
268
<filename>libavcodec</filename> subdirectory, but it does
 
269
<emphasis role="bold">not</emphasis> contain the source for
 
270
<systemitem class="library">libavcodec</systemitem>!
 
271
You must follow the steps above to obtain the source for this library.
 
272
</para>
 
273
</note>
 
274
 
 
275
<para>
 
276
With FFmpeg and my Matrox G400, I can view even the highest resolution DivX
 
277
movies without dropped frames on my K6-2 500.
 
278
</para>
 
279
</sect2>
 
280
 
 
281
 
 
282
<sect2 id="xanim">
 
283
<title>XAnim codecs</title>
 
284
 
 
285
<note>
 
286
<para>
 
287
Be advised that the XAnim binary codecs are packaged with a piece of text
 
288
claiming to be a legally binding software license which, besides other
 
289
restrictions, forbids the user to use the codecs in conjunction with any
 
290
program other than <application>XAnim</application>. However, the XAnim
 
291
author has yet to bring legal action against anyone for codec-related issues.
 
292
</para>
 
293
</note>
 
294
 
 
295
<formalpara>
 
296
<title>INSTALLATION AND USAGE</title>
 
297
<para>
 
298
<application>MPlayer</application> is capable of employing the XAnim codecs
 
299
for decoding. Follow the instructions to enable them:
 
300
</para>
 
301
</formalpara>
 
302
 
 
303
<procedure>
 
304
<step><para>
 
305
  Download the codecs you wish to use from the
 
306
  <ulink url="http://xanim.va.pubnix.com">XAnim site</ulink>.
 
307
  The <emphasis role="bold">3ivx</emphasis> codec is not there, but at the
 
308
  <ulink url="http://www.3ivx.com">3ivx site</ulink>.
 
309
  </para></step>
 
310
<step><para>
 
311
  <emphasis role="bold">OR</emphasis> download the codecs pack from our
 
312
  <ulink url="http://www.mplayerhq.hu/MPlayer/releases/codecs/">codecs page</ulink>
 
313
  </para></step>
 
314
<step><para>
 
315
  Use the <option>--with-xanimlibdir</option> option to tell
 
316
  <filename>configure</filename> where
 
317
  to find the XAnim codecs. By default, it looks for them at
 
318
  <filename class="directory">/usr/local/lib/codecs</filename>,
 
319
  <filename class="directory">/usr/local/lib/xanim/mods</filename>,
 
320
  <filename class="directory">/usr/lib/xanim/mods</filename> and
 
321
  <filename class="directory">/usr/lib/xanim</filename>.
 
322
  Alternatively you can set the environment variable
 
323
  <envar>XANIM_MOD_DIR</envar> to the directory of the XAnim codecs.
 
324
  </para></step>
 
325
<step><para>
 
326
  Rename/symlink the files, cutting out the architecture stuff, so they
 
327
  will have filenames like these: <filename>vid_cvid.xa</filename>,
 
328
  <filename>vid_h263.xa</filename>, <filename>vid_iv50.xa</filename>
 
329
  </para></step>
 
330
</procedure>
 
331
 
 
332
<para>
 
333
XAnim is video codec family <systemitem>xanim</systemitem>, so you may want
 
334
to use the <option>-vfm xanim</option> option to tell <application>MPlayer</application>
 
335
to use them if possible.
 
336
</para>
 
337
 
 
338
<para>
 
339
Tested codecs include: <emphasis role="bold">Indeo 3.2, 4.1, 5.0, CVID, 3ivX,
 
340
H.263.</emphasis>
 
341
</para>
 
342
</sect2>
 
343
 
 
344
 
 
345
<sect2 id="vivo-video">
 
346
<title>VIVO video</title>
 
347
<para>
 
348
<application>MPlayer</application> can play Vivo (1.0 and 2.0) videos. The
 
349
most suitable codec for 1.0 files is FFmpeg's H.263 decoder, you can use it
 
350
with the <option>-vc ffh263</option> option. For 2.0 files, use the
 
351
Win32 DLL through the <option>-vc vivo</option> option. If you do not supply
 
352
command line options <application>MPlayer</application> selects the best codec
 
353
automatically.
 
354
</para>
 
355
</sect2>
 
356
 
 
357
 
 
358
<sect2 id="mpeg12">
 
359
<title>MPEG-1/2 video</title>
 
360
<para>
 
361
MPEG-1 and MPEG-2 are decoded by the multiplatform native <systemitem
 
362
class="library">libmpeg2</systemitem> library, whose source code is
 
363
included in <application>MPlayer</application>.  We handle buggy MPEG-1/2
 
364
video files by catching <systemitem>Signal 11</systemitem>
 
365
(<systemitem>segmentation fault</systemitem>), and quickly
 
366
reinitializing the codec, continuing exactly from where the failure
 
367
occurred.  This recovery technique has no measurable speed penalty.
 
368
</para>
 
369
</sect2>
 
370
 
 
371
 
 
372
<sect2 id="avicodecs">
 
373
<title>MS Video1, Cinepak CVID, and other older codecs</title>
 
374
<para>
 
375
<application>MPlayer</application> is able to play most of the older codecs
 
376
used in AVI and MOV files.
 
377
In the past they were decoded with binary Win32 codecs, but now we have
 
378
<emphasis role="bold">native codecs</emphasis> for most of them using
 
379
<link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>.
 
380
</para>
 
381
</sect2>
 
382
 
 
383
 
 
384
<sect2 id="realvideo">
 
385
<title>RealVideo</title>
 
386
 
 
387
<para>
 
388
<application>MPlayer</application> supports decoding all versions of
 
389
RealVideo:
 
390
 
 
391
<itemizedlist>
 
392
<listitem><simpara>
 
393
  RealVideo 1.0, 2.0 (fourcc RV10, RV20) - en/decoding supported by
 
394
  <systemitem class="library">libavcodec</systemitem>
 
395
  </simpara></listitem>
 
396
<listitem><simpara>
 
397
  RealVideo 3.0, 4.0 (fourcc RV30, RV40) - decoding supported by
 
398
  <emphasis role="bold">RealPlayer libraries</emphasis>
 
399
  </simpara></listitem>
 
400
</itemizedlist>
 
401
</para>
 
402
 
 
403
<para>
 
404
Download Real codecs from
 
405
<ulink url="http://www.mplayerhq.hu/MPlayer/releases/codecs/">http://www.mplayerhq.hu/MPlayer/releases/codecs/</ulink>
 
406
and extract them to the
 
407
<filename class="directory">/usr/local/lib/codecs</filename> directory.
 
408
If you want to store them in a different location, pass the
 
409
<option>--with-reallibdir</option> option to <command>configure</command>.
 
410
</para>
 
411
 
 
412
<note><para>
 
413
<application>RealPlayer</application> libraries currently
 
414
<emphasis role="bold">only work with Linux, FreeBSD, NetBSD and Cygwin on the x86,
 
415
Alpha and PowerPC (Linux/Alpha and Linux/PowerPC have been tested) platforms and with Mac OS X</emphasis>.
 
416
</para></note>
 
417
</sect2>
 
418
 
 
419
 
 
420
<sect2 id="xvid">
 
421
<title>XviD</title>
 
422
 
 
423
<para>
 
424
<ulink url="http://www.xvid.org">XviD</ulink> is a free software MPEG-4 ASP
 
425
compliant video codec, which features two pass encoding and full MPEG-4 ASP
 
426
support, making it a lot more efficient than the well-known DivX codec.
 
427
It yields very good video quality and good performance due to CPU
 
428
optimizations for most modern processors.
 
429
</para>
 
430
<para>
 
431
It began as a forked development of the OpenDivX codec.
 
432
This happened when ProjectMayo changed OpenDivX to closed source
 
433
DivX4 (now DivX5), and the non-ProjectMayo people working on OpenDivX got angry,
 
434
then started XviD. So both projects have the same origin.
 
435
</para>
 
436
 
 
437
<procedure>
 
438
<title>Installing <systemitem class="library">XviD</systemitem></title>
 
439
<para>
 
440
  Like most open source software, it is available in two flavors:
 
441
  <ulink url="http://www.xvid.org/downloads.html">official releases</ulink>
 
442
  and the CVS version.
 
443
  The CVS version is usually stable enough to use, as most of the time it
 
444
  features fixes for bugs that exist in releases.
 
445
  Here is what to do to make <systemitem class="library">XviD</systemitem>
 
446
  CVS work with <application>MEncoder</application> (you need at least
 
447
  <application>autoconf</application> 2.50,
 
448
  <application>automake</application> and <application>libtool</application>):
 
449
</para>
 
450
<step><para>
 
451
  <screen>cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid login</screen>
 
452
  </para></step>
 
453
<step><para>
 
454
  <screen>cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid co xvidcore</screen>
 
455
</para></step>
 
456
<step><para>
 
457
  <screen>cd xvidcore/build/generic</screen>
 
458
  </para></step>
 
459
<step><para>
 
460
  <screen>./bootstrap.sh</screen>
 
461
  </para></step>
 
462
<step><para>
 
463
  <screen>./configure</screen>
 
464
  You may have to add some options (examine the output of
 
465
  <command>./configure --help</command>).
 
466
  </para></step>
 
467
<step><para>
 
468
  <screen>make &amp;&amp; make install</screen>
 
469
  </para></step>
 
470
<step><para>
 
471
  If you specified <option>--enable-divxcompat</option>,
 
472
  copy <filename>../../src/divx4.h</filename> to
 
473
  <filename class="directory">/usr/local/include/</filename>.
 
474
  </para></step>
 
475
<step><para>
 
476
  Recompile <application>MPlayer</application> with
 
477
  <option>--with-xvidlibdir=<replaceable>/path/to/</replaceable>libxvidcore.a</option>
 
478
  <option>--with-xvidincdir=<replaceable>/path/to/</replaceable>xvid.h</option>
 
479
  </para></step>
 
480
</procedure>
 
481
</sect2>
 
482
 
 
483
 
 
484
<sect2 id="sorenson">
 
485
<title>Sorenson</title>
 
486
 
 
487
<para>
 
488
Sorenson is a video codec developed by Sorenson Media and licensed to Apple who
 
489
distribute it with their <application>QuickTime Player</application>. We are
 
490
currently able to decode all version of Sorenson video files with the following
 
491
decoders:
 
492
</para>
 
493
 
 
494
<itemizedlist>
 
495
<listitem><simpara>
 
496
  Sorenson Video v1 (fourcc <emphasis>SVQ1</emphasis>) - decoding supported
 
497
  by <emphasis role="bold">native codec</emphasis>
 
498
  (<link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>)
 
499
  </simpara></listitem>
 
500
<listitem><simpara>
 
501
  Sorenson Video v3 (fourcc <emphasis>SVQ3</emphasis>) - decoding supported by
 
502
  <emphasis role="bold">native codec</emphasis>
 
503
  (<link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>)
 
504
  </simpara></listitem>
 
505
</itemizedlist>
 
506
 
 
507
<procedure>
 
508
<title>COMPILING MPLAYER WITH QUICKTIME LIBRARIES SUPPORT</title>
 
509
<note><para>Currently only 32-bit Intel platforms are supported.</para></note>
 
510
<step><para>download <application>MPlayer</application> CVS</para></step>
 
511
<step><para>download QuickTime DLL pack from
 
512
<ulink url="http://www.mplayerhq.hu/MPlayer/releases/codecs/"/>
 
513
</para></step>
 
514
<step><para>extract QuickTime DLL pack to your Win32 codecs directory
 
515
(default: <filename class="directory">/usr/local/lib/codecs/</filename>)
 
516
</para></step>
 
517
<step><para>compile <application>MPlayer</application></para></step>
 
518
</procedure>
 
519
 
 
520
</sect2>
 
521
 
 
522
<sect2 id="codec-x264">
 
523
<title>x264</title>
 
524
 
 
525
<sect3 id="codec-x264-whatis">
 
526
<title>What is x264?</title>
 
527
<para>
 
528
  <systemitem class="library">x264</systemitem> is a library for
 
529
  creating H.264 video streams.
 
530
  It is not 100% complete, but currently it has at least some kind
 
531
  of support for most of the H.264 features which impact quality.
 
532
  There are also many advanced features in the H.264 specification
 
533
  which have nothing to do with video quality per se; many of these
 
534
  are not yet implemented in
 
535
  <systemitem class="library">x264</systemitem>.
 
536
</para>
 
537
 
 
538
<itemizedlist>
 
539
<title>Encoder features</title>
 
540
  <listitem><para>CAVLC/CABAC</para></listitem>
 
541
  <listitem><para>Multi-references</para></listitem>
 
542
  <listitem><para>Intra: all macroblock types (16x16, 8x8, and 4x4 with
 
543
    all predictions)</para></listitem>
 
544
  <listitem><para>Inter P: all partitions (from 16x16 down to
 
545
    4x4)</para></listitem>
 
546
  <listitem><para>Inter B: partitions from 16x16 down to 8x8
 
547
    (including SKIP/DIRECT)</para></listitem>
 
548
  <listitem><para>Ratecontrol: constant quantizer, constant bitrate,
 
549
    single or multipass ABR, optional VBV</para></listitem>
 
550
  <listitem><para>Scene cut detection</para></listitem>
 
551
  <listitem><para>Adaptive B-frame placement</para></listitem>
 
552
  <listitem><para>B-frames as references / arbitrary frame
 
553
    order</para></listitem>
 
554
  <listitem><para>8x8 and 4x4 adaptive spatial transform</para></listitem>
 
555
  <listitem><para>Lossless mode</para></listitem>
 
556
  <listitem><para>Custom quantization matrices</para></listitem>
 
557
  <listitem><para>Parallel encoding of multiple slices</para></listitem>
 
558
</itemizedlist>
 
559
 
 
560
</sect3>
 
561
 
 
562
<sect3 id="codec-h264-whatis">
 
563
<title>What is H.264?</title>
 
564
<para>
 
565
  H.264 is one name for a new digital video codec jointly developed
 
566
  by the ITU and MPEG.
 
567
  It can also be correctly referred to by the cumbersome names of
 
568
  "ISO/IEC 14496-10" or "MPEG-4 Part 10".
 
569
  More frequently, it is referred to as "MPEG-4 AVC" or just "AVC".
 
570
</para>
 
571
<para>
 
572
  Whatever you call it, H.264 may be worth trying because it can
 
573
  typically match the quality of MPEG-4 ASP with 5%-30% less
 
574
  bitrate.
 
575
  Actual results will depend on both the source material and the
 
576
  encoder.
 
577
  The gains from using H.264 do not come for free: Decoding H.264
 
578
  streams seems to have steep CPU and memory requirements.
 
579
  For instance, on a 1733 MHz Athlon, a DVD-resolution 1500kbps H.264
 
580
  video requires around 35% CPU to decode.
 
581
  By comparison, decoding a DVD-resolution 1500kbps MPEG-4 ASP stream
 
582
  requires around 10% CPU.
 
583
  This means that decoding high-definition streams is almost out of
 
584
  the question for most users.
 
585
  It also means that even a decent DVD rip may sometimes stutter on
 
586
  processors slower than 2.0 GHz or so.
 
587
</para>
 
588
<para>
 
589
  At least with <systemitem class="library">x264</systemitem>,
 
590
  encoding requirements are not much worse than what you are used to
 
591
  with MPEG-4 ASP.
 
592
  For instance, on a 1733 MHz Athlon a typical DVD encode would run
 
593
  at 5-15fps.
 
594
</para>
 
595
<para>
 
596
  This document is not intended to explain the details of H.264,
 
597
  but if you are interested in a brief overview, you may want to read
 
598
  <ulink url="http://www.cdt.luth.se/~peppar/kurs/smd151/spie04-h264OverviewPaper.pdf">The H.264/AVC Advanced Video Coding Standard: Overview and Introduction to the Fidelity Range Extensions</ulink>.
 
599
</para>
 
600
</sect3>
 
601
 
 
602
<sect3 id="codec-x264-playback">
 
603
<title>How can I play H.264 videos with <application>MPlayer</application>?</title>
 
604
<para>
 
605
  <application>MPlayer</application> uses
 
606
  <systemitem class="library">libavcodec</systemitem>'s H.264
 
607
  decoder.
 
608
  <systemitem class="library">libavcodec</systemitem> has had at
 
609
  least minimally usable H.264 decoding since around July 2004,
 
610
  however major changes and improvements have been implemented since
 
611
  that time, both in terms of more functionalities supported and in
 
612
  terms of improved CPU usage.
 
613
  Just to be certain, it is always a good idea to use a recent CVS
 
614
  checkout.
 
615
</para>
 
616
<para>
 
617
  If you want a quick and easy way to know whether there have been
 
618
  recent changes to <systemitem class="library">libavcodec</systemitem>'s
 
619
  H.264 decoding, you might keep an eye on 
 
620
  <ulink url="http://mplayerhq.hu/cgi-bin/cvsweb.cgi/ffmpeg/libavcodec/h264.c?cvsroot=FFMpeg">FFmpeg CVS repository's web interface</ulink>.
 
621
</para>
 
622
</sect3>
 
623
 
 
624
<sect3 id="codec-x264-encode">
 
625
<title>How can I encode videos using <application>MEncoder</application> and <systemitem class="library">x264</systemitem>?</title>
 
626
<para>
 
627
  If you have the subversion client installed, the latest x264
 
628
  sources can be gotten with this command:
 
629
  <screen>
 
630
    svn co svn://svn.videolan.org/x264/trunk x264<!--
 
631
  --></screen>
 
632
  <application>MPlayer</application> sources are updated whenever
 
633
  an <systemitem class="library">x264</systemitem> API change
 
634
  occurs, so it is always suggested to use CVS
 
635
  <application>MPlayer</application> as well.
 
636
  Perhaps this situation will change when and if an
 
637
  <systemitem class="library">x264</systemitem> "release" occurs.
 
638
  Meanwhile, <systemitem class="library">x264</systemitem> should
 
639
  be considered very unstable, in the sense that its programming
 
640
  interface is subject to change.
 
641
</para>
 
642
<para>
 
643
  <systemitem class="library">x264</systemitem> is built and
 
644
  installed in the standard way:
 
645
  <screen>
 
646
    ./configure &amp;&amp; make &amp;&amp; sudo make install<!--
 
647
  --></screen>
 
648
  This installs libx264.a in /usr/local/lib and x264.h is placed in
 
649
  /usr/local/include.
 
650
 
 
651
  With the <systemitem class="library">x264</systemitem> library
 
652
  and header placed in the standard locations, building
 
653
  <application>MPlayer</application> with
 
654
  <systemitem class="library">x264</systemitem> support is easy.
 
655
  Just run the standard:
 
656
  <screen>./configure &amp;&amp; make &amp;&amp; sudo make install</screen>
 
657
  The configure script will autodetect that you have satisfied the
 
658
  requirements for <systemitem class="library">x264</systemitem>.
 
659
</para>
 
660
</sect3>
 
661
</sect2>
 
662
</sect1>
 
663
 
 
664
<!-- ********** -->
 
665
 
 
666
<sect1 id="audio-codecs">
 
667
<title>Audio codecs</title>
 
668
 
 
669
<itemizedlist>
 
670
<title>The most important audio codecs above all:</title>
 
671
<listitem><simpara>
 
672
  MPEG layer 1/2/3 (MP1/2/3) audio (<emphasis role="bold">native</emphasis>
 
673
  code, with MMX/SSE/3DNow! optimization)
 
674
  </simpara></listitem>
 
675
<listitem><simpara>
 
676
  Windows Media Audio 7 and 8 (AKA WMAv1 and WMAv2) (<emphasis role="bold">native</emphasis> code, with
 
677
  <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>)
 
678
  </simpara></listitem>
 
679
<listitem><simpara>
 
680
  Windows Media Audio 9 (WMAv3) (using DMO DLL)
 
681
  </simpara></listitem>
 
682
<listitem><simpara>
 
683
  AC3 Dolby audio (<emphasis role="bold">native</emphasis> code, with
 
684
  MMX/SSE/3DNow! optimization)
 
685
  </simpara></listitem>
 
686
<listitem><simpara>
 
687
  AC3 passing through sound card hardware
 
688
  </simpara></listitem>
 
689
<listitem><simpara>
 
690
  AAC
 
691
  </simpara></listitem>
 
692
<listitem><simpara>
 
693
  Ogg Vorbis audio codec (<emphasis role="bold">native</emphasis> library)
 
694
  </simpara></listitem>
 
695
<listitem><simpara>
 
696
  RealAudio: DNET (low bitrate AC3), Cook, Sipro and ATRAC3
 
697
  </simpara></listitem>
 
698
<listitem><simpara>
 
699
  QuickTime: Qualcomm and QDesign audio codecs
 
700
  </simpara></listitem>
 
701
<listitem><simpara>
 
702
  VIVO audio (g723, Vivo Siren)
 
703
  </simpara></listitem>
 
704
<listitem><simpara>
 
705
  Voxware audio (using DirectShow DLL)
 
706
  </simpara></listitem>
 
707
<listitem><simpara>
 
708
  alaw and ulaw, various gsm, adpcm and pcm formats and other simple old
 
709
  audio codecs
 
710
  </simpara></listitem>
 
711
</itemizedlist>
 
712
 
 
713
 
 
714
<sect2 id="swac3">
 
715
<title>Software AC3 decoding</title>
 
716
 
 
717
<para>
 
718
This is the default decoder used for files with AC3 audio.
 
719
</para>
 
720
 
 
721
<para>
 
722
The AC3 decoder can create audio output mixes for 2, 4, or 6 speakers.
 
723
When configured for 6 speakers, this decoder provides separate output of
 
724
all the AC3 channels to the sound driver, allowing for full "surround
 
725
sound" experience without the external AC3 decoder required to use the
 
726
hwac3 codec.
 
727
</para>
 
728
 
 
729
<para>
 
730
Use the <option>-channels</option> option to select the number of output
 
731
channels.  Use <option>-channels 2</option> for a stereo downmix.  For a 4
 
732
channel downmix (Left Front, Right Front, Left Surround and Right Surround
 
733
outputs), use <option>-channels 4</option>.  In this case, any center
 
734
channel will be mixed equally to the front channels.  <option>-channels
 
735
6</option> will output all the AC3 channels as they are encoded - in the
 
736
order Left, Right, Left Surround, Right Surround, Center and LFE.
 
737
</para>
 
738
 
 
739
<para>
 
740
The default number of output channels is 2.
 
741
</para>
 
742
 
 
743
<para>
 
744
To use more than 2 output channels, you will need to use OSS, and have a
 
745
sound card that supports the appropriate number of output channels via the
 
746
SNDCTL_DSP_CHANNELS ioctl.  An example of a suitable driver is emu10k1
 
747
(used by Soundblaster Live! cards) from August 2001 or newer (ALSA CVS is
 
748
also supposed to work).
 
749
</para>
 
750
</sect2>
 
751
 
 
752
 
 
753
<sect2 id="hwac3">
 
754
<title>Hardware AC3 decoding</title>
 
755
<para>
 
756
You need an AC3 capable sound card, with digital out (S/PDIF). The card's
 
757
driver must properly support the AFMT_AC3 format (C-Media does).  Connect
 
758
your AC3 decoder to the S/PDIF output, and use the <option>-ac
 
759
hwac3</option> option. It is experimental but known to work with C-Media
 
760
cards and Soundblaster Live! + ALSA (but not OSS) drivers and DXR3/Hollywood+
 
761
MPEG decoder cards.
 
762
</para>
 
763
</sect2>
 
764
 
 
765
 
 
766
<sect2 id="libmad">
 
767
<title>libmad support</title>
 
768
 
 
769
<para>
 
770
<ulink url="http://www.underbit.com/products/mad/">libmad</ulink> is a multiplatform,
 
771
integer (internally 24bit PCM) only
 
772
MPEG audio decoding library. It does not handle broken files well, and it
 
773
sometimes has problems with seeking, but it may perform better on FPU-less
 
774
(such as <link linkend="arm">ARM</link>) platform than mp3lib.
 
775
</para>
 
776
 
 
777
<para>
 
778
To enable support, compile with the <option>--enable-mad</option> configure
 
779
option.
 
780
</para>
 
781
</sect2>
 
782
 
 
783
 
 
784
<sect2 id="vivo-audio">
 
785
<title>VIVO audio</title>
 
786
<para>
 
787
The audio codec used in VIVO files depends on whether it is a VIVO/1.0 or
 
788
VIVO/2.0 file. VIVO/1.0 files have <emphasis role="bold">g.723</emphasis> audio,
 
789
and VIVO/2.0 files have <emphasis role="bold">Vivo Siren</emphasis> audio. Both are
 
790
supported.
 
791
</para>
 
792
</sect2>
 
793
 
 
794
 
 
795
<sect2 id="realaudio">
 
796
<title>RealAudio</title>
 
797
 
 
798
<para>
 
799
<application>MPlayer</application> supports decoding nearly all versions of
 
800
RealAudio:
 
801
</para>
 
802
 
 
803
<itemizedlist>
 
804
<listitem><simpara>
 
805
  RealAudio DNET - decoding supported by
 
806
  <systemitem class="library">liba52</systemitem>
 
807
  </simpara></listitem>
 
808
<listitem><simpara>
 
809
  RealAudio Cook/Sipro/ATRAC3 - decoding supported by
 
810
  <emphasis role="bold">RealPlayer libraries</emphasis>
 
811
  </simpara></listitem>
 
812
</itemizedlist>
 
813
 
 
814
<para>
 
815
Instructions on how to install the RealPlayer libraries are in the
 
816
<link linkend="realvideo">RealVideo</link> section.
 
817
</para>
 
818
</sect2>
 
819
 
 
820
<sect2 id="qdesign">
 
821
<title>QDesign codecs</title>
 
822
<para>
 
823
QDesign audio streams (fourcc:<emphasis>QDMC, QDM2</emphasis>) are found
 
824
in MOV/QT files. Both versions of this codec can be decoded with QuickTime
 
825
libraries. For installation instructions please see the
 
826
<link linkend="sorenson">Sorenson video codec</link> section.
 
827
</para>
 
828
</sect2>
 
829
 
 
830
<sect2 id="qualcomm">
 
831
<title>Qualcomm codecs</title>
 
832
<para>
 
833
Qualcomm audio streams (fourcc:<emphasis>Qclp</emphasis>) is found
 
834
in MOV/QT files. It can be decoded with QuickTime
 
835
libraries. For installation instructions please see the
 
836
<link linkend="sorenson">Sorenson video codec</link> section.
 
837
</para>
 
838
</sect2>
 
839
 
 
840
<sect2 id="aac">
 
841
<title>AAC codec</title>
 
842
<para>
 
843
AAC (Advanced Audio Coding) is an audio codec sometimes found in MOV and MP4
 
844
files. An open source decoder called FAAD is available from
 
845
<ulink url="http://www.audiocoding.com"/>.
 
846
<application>MPlayer</application> includes a CVS snapshot of libfaad 2.1
 
847
beta, so you do not need to get it separately.
 
848
</para>
 
849
 
 
850
<para>
 
851
If you use gcc 3.2 which fails to compile our internal FAAD or want to use
 
852
the external library for some other reason, download the library from the
 
853
<ulink url="http://www.audiocoding.com/modules/mydownloads/">download page</ulink>
 
854
and pass <option>--enable-external-faad</option> to <filename>configure</filename>.
 
855
You do not need all of faad2 to decode AAC files, libfaad is enough. Build
 
856
it like this:
 
857
<screen>
 
858
cd faad2/
 
859
sh bootstrap
 
860
./configure
 
861
cd libfaad
 
862
make
 
863
make install
 
864
</screen>
 
865
Binaries are not available from audiocoding.com, but you can (apt-)get Debian
 
866
packages from <ulink url="http://hpisi.nerim.net">Christian Marillat's homepage</ulink>,
 
867
Mandrake/Mandriva RPMs from the <ulink url="http://plf.zarb.org">P.L.F</ulink> and RedHat RPMs
 
868
from <ulink url="http://greysector.rangers.eu.org/">Grey Sector</ulink>.
 
869
</para>
 
870
</sect2>
 
871
 
 
872
</sect1>
 
873
 
 
874
<!-- ********** -->
 
875
 
 
876
<sect1 id="codec-importing">
 
877
<title>Win32 codecs importing HOWTO</title>
 
878
 
 
879
<!-- TODO: a short paragraph of text would be nice here... -->
 
880
 
 
881
<sect2 id="vfw-codecs">
 
882
<title>VFW codecs</title>
 
883
 
 
884
<para>
 
885
VFW (Video for Windows) is the old Video API for Windows. Its codecs have
 
886
the <filename>.DLL</filename> or (rarely) <filename>.DRV</filename>
 
887
extension.  If <application>MPlayer</application> fails at playing your AVI
 
888
with this kind of message:
 
889
<screen>UNKNOWN video codec: HFYU (0x55594648)</screen>
 
890
</para>
 
891
 
 
892
<para>
 
893
It means your AVI is encoded with a codec which has the HFYU fourcc (HFYU =
 
894
HuffYUV codec, DIV3 = DivX Low Motion, etc.). Now that you know this, you
 
895
have to find out which DLL Windows loads in order to play this file. In our
 
896
case, the <filename>system.ini</filename> contains this information in a
 
897
line that reads:
 
898
<programlisting>VIDC.HFYU=huffyuv.dll</programlisting>
 
899
</para>
 
900
 
 
901
<para>
 
902
So you need the <filename>huffyuv.dll</filename> file. Note that the audio
 
903
codecs are specified by the MSACM prefix:
 
904
<programlisting>msacm.l3acm=L3codeca.acm</programlisting>
 
905
</para>
 
906
 
 
907
<para>
 
908
This is the MP3 codec.  Now that you have all the necessary information
 
909
(fourcc, codec file, sample AVI), submit your codec support request by
 
910
mail, and upload these files to the FTP site:
 
911
<systemitem role="url">
 
912
ftp://ftp.mplayerhq.hu/MPlayer/incoming/[codecname]/
 
913
</systemitem>
 
914
</para>
 
915
 
 
916
<note><para>On Windows NT/2000/XP search for this info in the registry,
 
917
e.g. search for &quot;VIDC.HFYU&quot;. To find out how to do this, look at
 
918
the old DirectShow method below.
 
919
</para></note>
 
920
</sect2>
 
921
 
 
922
 
 
923
<sect2 id="dshow-codecs">
 
924
<title>DirectShow codecs</title>
 
925
 
 
926
<para>
 
927
DirectShow is the newer Video API, which is even worse than its predecessor.
 
928
Things are harder with DirectShow, since
 
929
<itemizedlist>
 
930
<listitem><simpara>
 
931
  <filename>system.ini</filename> does not contain the needed information,
 
932
  instead it is stored in the registry and
 
933
  </simpara></listitem>
 
934
<listitem><simpara>
 
935
  we need the GUID of the codec.
 
936
  </simpara></listitem>
 
937
</itemizedlist>
 
938
</para>
 
939
 
 
940
<procedure>
 
941
<title>New Method:</title>
 
942
<para>
 
943
Using <application>Microsoft GraphEdit</application> (fast)
 
944
</para>
 
945
<step><para>
 
946
  Get <application>GraphEdit</application> from either DirectX SDK or
 
947
  <ulink url="http://doom9.net">doom9</ulink>
 
948
  </para></step>
 
949
<step><para>
 
950
  Start <command>graphedit.exe</command>.
 
951
  </para></step>
 
952
<step><para>
 
953
  From the menu select Graph -> Insert Filters.
 
954
  </para></step>
 
955
<step><para>
 
956
  Expand item <systemitem>DirectShow Filters</systemitem>
 
957
  </para></step>
 
958
<step><para>
 
959
  Select the right codec name and expand item.
 
960
  </para></step>
 
961
<step><para>
 
962
  In the entry <systemitem>DisplayName</systemitem> look at the text in
 
963
  winged brackets after the backslash and write it down (five dash-delimited
 
964
  blocks, the GUID).
 
965
  </para></step>
 
966
<step><para>
 
967
  The codec binary is the file specified in the <systemitem>Filename</systemitem>
 
968
  entry.
 
969
  </para></step>
 
970
</procedure>
 
971
 
 
972
<note>
 
973
<para>
 
974
If there is no <systemitem>Filename</systemitem> and
 
975
<systemitem>DisplayName</systemitem> contains something like
 
976
<systemitem>device:dmo</systemitem>, then it is a DMO-Codec.
 
977
</para>
 
978
</note>
 
979
 
 
980
<procedure>
 
981
<title>Old Method:</title>
 
982
<para>
 
983
Take a deep breath and start searching the registry...
 
984
</para>
 
985
<step><para>
 
986
  Start <command>regedit</command>.
 
987
  </para></step>
 
988
<step><para>
 
989
  Press <keycap>Ctrl</keycap>+<keycap>F</keycap>, disable the first two
 
990
  checkboxes, and enable the third. Type in the fourcc of the codec (e.g.
 
991
  <userinput>TM20</userinput>).
 
992
  </para></step>
 
993
<step><para>
 
994
  You should see a field which contains the path and the filename (e.g.
 
995
  <filename>C:\WINDOWS\SYSTEM\TM20DEC.AX</filename>).
 
996
  </para></step>
 
997
<step><para>
 
998
  Now that you have the file, we need the GUID. Try searching again, but
 
999
  now search for the codec's name, not the fourcc. Its name can be acquired
 
1000
  when Media Player is playing the file, by checking
 
1001
  <guimenu>File</guimenu> -&gt; <guisubmenu>Properties</guisubmenu> -&gt;
 
1002
  <guimenuitem>Advanced</guimenuitem>.
 
1003
  If not, you are out of luck. Try guessing (e.g. search for TrueMotion).
 
1004
  </para></step>
 
1005
<step><para>
 
1006
  If the GUID is found you should see a <guilabel>FriendlyName</guilabel>
 
1007
  and a <guilabel>CLSID</guilabel> field. Write down the 16 byte CLSID,
 
1008
  this is the GUID we need.
 
1009
  </para></step>
 
1010
</procedure>
 
1011
 
 
1012
<note>
 
1013
<para>
 
1014
If searching fails, try enabling all the checkboxes. You may have
 
1015
false hits, but you may get lucky...
 
1016
</para>
 
1017
</note>
 
1018
 
 
1019
<para>
 
1020
Now that you have all the necessary information (fourcc, GUID, codec file,
 
1021
sample AVI), submit your codec support request by mail, and upload these files
 
1022
to the FTP site:
 
1023
<systemitem
 
1024
role="url">ftp://ftp.mplayerhq.hu/MPlayer/incoming/[codecname]/
 
1025
</systemitem>
 
1026
</para>
 
1027
 
 
1028
<para>
 
1029
If you want to add a codec yourself, read
 
1030
<ulink url="http://www.mplayerhq.hu/MPlayer/DOCS/tech/codecs.conf.txt">DOCS/tech/codecs.conf.txt</ulink>.
 
1031
</para>
 
1032
 
 
1033
</sect2>
 
1034
</sect1>
 
1035
 
 
1036
</chapter>