<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter id="video">
<title>Video output devices</title>

<sect1 id="xv">
<title>Xv</title>

<para>
Under XFree86 4.0.2 or newer, you can use your card's hardware YUV routines
using the XVideo extension. This is what the option
<option>-vo xv</option> uses. Also, this driver supports adjusting
brightness/contrast/hue/etc. (unless you use the old, slow DirectShow DivX
codec, which supports it everywhere), see the man page.
</para>

<para>
In order to make this work, be sure to check the following:

<orderedlist>
<listitem><para>
  You have to use XFree86 4.0.2 or newer (former versions don't have XVideo)
</para></listitem>
<listitem><para>
  Your card actually supports hardware acceleration (modern cards do)
</para></listitem>
<listitem><para>
  X loads the XVideo extension, it's something like this:
  <programlisting>(II) Loading extension XVideo</programlisting>
  in <filename>/var/log/XFree86.0.log</filename>
  <note><para>
   This loads only the XFree86's extension. In a good install, this is
   always loaded, and doesn't mean that the
   <emphasis role="bold">card's</emphasis> XVideo support is loaded!
  </para></note>
</para></listitem>
<listitem><para>
  Your card has Xv support under Linux. To check, try
  <command>xvinfo</command>, it is the part of the XFree86 distribution. It
  should display a long text, similar to this:
  <screen>
X-Video Extension version 2.2
screen #0
  Adaptor #0: "Savage Streams Engine"
    number of ports: 1
    port base: 43
    operations supported: PutImage
    supported visuals:
      depth 16, visualID 0x22
      depth 16, visualID 0x23
    number of attributes: 5
(...)
    Number of image formats: 7
      id: 0x32595559 (YUY2)
        guid: 59555932-0000-0010-8000-00aa00389b71
        bits per pixel: 16
        number of planes: 1
        type: YUV (packed)
      id: 0x32315659 (YV12)
        guid: 59563132-0000-0010-8000-00aa00389b71
        bits per pixel: 12
        number of planes: 3
        type: YUV (planar)
(...etc...)<!--
--></screen>
  It must support YUY2 packed, and YV12 planar pixel formats to be usable
  with <application>MPlayer</application>.
</para></listitem>
<listitem><para>
  And finally, check if <application>MPlayer</application> was compiled
  with 'xv' support. Do a <command>mplayer -vo help | grep xv </command>.
  If 'xv' support was built a line similar to this should appear:
  <screen>  xv      X11/Xv</screen>
</para></listitem>
</orderedlist>
</para>
</sect1>

<!-- ********** -->

<sect1 id="dga">
<title>DGA</title>

<formalpara>
<title>PREAMBLE</title>
<para>
This document tries to explain in some words what DGA is in general and
what the DGA video output driver for <application>MPlayer</application>
can do (and what it can't).
</para>
</formalpara>

<formalpara>
<title>WHAT IS DGA</title>
<para>
<acronym>DGA</acronym> is short for <emphasis>Direct Graphics
Access</emphasis> and is a means for a program to bypass the X server and
directly modifying the framebuffer memory. Technically spoken this happens
by mapping the framebuffer memory into the memory range of your process.
This is allowed by the kernel only if you have superuser privileges. You
can get these either by logging in as <systemitem
class="username">root</systemitem> or by setting the SUID bit on the
<application>MPlayer</application> executable (<emphasis role="bold">not
recommended</emphasis>).
</para>
</formalpara>
<para>
There are two versions of DGA: DGA1 is used by XFree 3.x.x and DGA2 was
introduced with XFree 4.0.1.
</para>

<para>
DGA1 provides only direct framebuffer access as described above. For
switching the resolution of the video signal you have to rely on the
XVidMode extension.
</para>

<para>
DGA2 incorporates the features of XVidMode extension and also allows
switching the depth of the display. So you may, although basically
running a 32 bit depth X server, switch to a depth of 15 bits and vice
versa.
</para>

<para>
However DGA has some drawbacks. It seems it is somewhat dependent on the
graphics chip you use and on the implementation of the X server's video
driver that controls this chip. So it does not work on every system...
</para>

<formalpara>
<title>INSTALLING DGA SUPPORT FOR MPLAYER</title>

<para>
First make sure X loads the DGA extension, see in
<filename>/var/log/XFree86.0.log</filename>:

<programlisting>(II) Loading extension XFree86-DGA</programlisting>

See, XFree86 4.0.x or greater is
<emphasis role="bold">highly recommended</emphasis>!
<application>MPlayer</application>'s DGA driver is autodetected by
<filename>./configure</filename>, or you can force it
with <option>--enable-dga</option>.
</para>
</formalpara>

<para>
If the driver couldn't switch to a smaller resolution, experiment with
options <option>-vm</option> (only with X 3.3.x), <option>-fs</option>,
<option>-bpp</option>, <option>-zoom</option> to find a video mode that
the movie fits in. There is no converter right now :(
</para>

<para>
Become <systemitem class="username">root</systemitem>. DGA needs root
access to be able to write directly video memory. If you want to run it as
user, then install <application>MPlayer</application> SUID root:

<screen>
chown root <replaceable>/usr/local/bin/mplayer</replaceable>
chmod 750 <replaceable>/usr/local/bin/mplayer</replaceable>
chmod +s <replaceable>/usr/local/bin/mplayer</replaceable>
</screen>

Now it works as a simple user, too.
</para>

<caution>
<title>Security risk</title>
<para>
This is a <emphasis role="bold">big</emphasis> security risk!
<emphasis role="bold">Never</emphasis> do this on a server or on a computer
that can be accessed by other people because they can gain root privileges
through SUID root <application>MPlayer</application>.
</para>
</caution>

<para>
Now use <option>-vo dga</option> option, and there you go! (hope so:) You
should also try if the <option>-vo sdl:driver=dga</option> option works for you!
It's much faster!
</para>


<formalpara id="dga-modelines">
<title>RESOLUTION SWITCHING</title>

<para>
The DGA driver allows for switching the resolution of the output signal.
This avoids the need for doing (slow) software scaling and at the same time
provides a fullscreen image. Ideally it would switch to the exact
resolution (except for honoring aspect ratio) of the video data, but the X
server only allows switching to resolutions predefined in
<filename>/etc/X11/XF86Config</filename>
(<filename>/etc/X11/XF86Config-4</filename> for XFree 4.X.X respectively).
Those are defined by so-called modelines and depend on
the capabilities of your video hardware. The X server scans this config
file on startup and disables the modelines not suitable for your hardware.
You can find out which modes survive with the X11 log file. It can be found
at: <filename>/var/log/XFree86.0.log</filename>.
</para>
</formalpara>

<para>
These entries are known to work fine with a Riva128 chip, using the nv.o X
server driver module.
</para>

<para><programlisting>
Section "Modes"
  Identifier "Modes[0]"
  Modeline "800x600"  40     800 840 968 1056  600 601 605 628
  Modeline "712x600"  35.0   712 740 850 900   400 410 412 425
  Modeline "640x480"  25.175 640 664 760 800   480 491 493 525
  Modeline "400x300"  20     400 416 480 528   300 301 303 314 Doublescan
  Modeline "352x288"  25.10  352 368 416 432   288 296 290 310
  Modeline "352x240"  15.750 352 368 416 432   240 244 246 262 Doublescan
  Modeline "320x240"  12.588 320 336 384 400   240 245 246 262 Doublescan
EndSection
</programlisting></para>


<formalpara>
<title>DGA &amp; MPLAYER</title>
<para>
DGA is used in two places with <application>MPlayer</application>: The SDL
driver can be made to make use of it (<option>-vo sdl:driver=dga</option>) and
within the DGA driver (<option>-vo dga</option>). The above said is true
for both; in the following sections I'll explain how the DGA driver for
<application>MPlayer</application> works.
</para>
</formalpara>


<formalpara>
<title>FEATURES</title>

<para>
The DGA driver is invoked by specifying <option>-vo dga</option> at the
command line. The default behavior is to switch to a resolution matching
the original resolution of the video as close as possible. It deliberately
ignores the <option>-vm</option> and <option>-fs</option> options
(enabling of video mode switching and fullscreen) - it always tries to
cover as much area of your screen as possible by switching the video mode,
thus refraining from using additional cycles of your CPU to scale the
image. If you don't like the mode it chooses you may force it to choose
the mode matching closest the resolution you specify by <option>-x</option>
and <option>-y</option>. By providing the <option>-v</option> option, the
DGA driver will print, among a lot of other things, a list of all
resolutions supported by your current <filename>XF86Config</filename> file.
Having DGA2 you may also force it to use a certain depth by using the
<option>-bpp</option> option. Valid depths are 15, 16, 24 and 32. It
depends on your hardware whether these depths are natively supported or if
a (possibly slow) conversion has to be done.
</para>
</formalpara>
<para>
If you should be lucky enough to have enough offscreen memory left to
put a whole image there, the DGA driver will use double buffering, which
results in much smoother movie playback. It will tell you whether
double buffering is enabled or not.
</para>

<para>
Double buffering means that the next frame of your video is being drawn in
some offscreen memory while the current frame is being displayed. When the
next frame is ready, the graphics chip is just told the location in memory
of the new frame and simply fetches the data to be displayed from there.
In the meantime the other buffer in memory will be filled again with new
video data.
</para>

<para>
Double buffering may be switched on by using the option
<option>-double</option> and may be disabled with
<option>-nodouble</option>. Current default option is to disable
double buffering. When using the DGA driver, onscreen display (OSD) only
works with double buffering enabled. However, enabling double buffering may
result in a big speed penalty (on my K6-II+ 525 it used an additional 20%
of CPU time!) depending on the implementation of DGA for your hardware.
</para>


<formalpara>
<title>SPEED ISSUES</title>

<para>
Generally spoken, DGA framebuffer access should be at least as fast as
using the X11 driver with the additional benefit of getting a fullscreen
image. The percentage speed values printed by
<application>MPlayer</application> have to be interpreted with some care,
as for example, with the X11 driver they do not include the time used by
the X server needed for the actual drawing. Hook a terminal to a serial
line of your box and start <command>top</command> to see what is really
going on in your box.
</para>
</formalpara>

<para>
Generally spoken, the speedup done by using DGA against 'normal' use of X11
highly depends on your graphics card and how well the X server module for it
is optimized.
</para>

<para>
If you have a slow system, better use 15 or 16 bit depth since they require
only half the memory bandwidth of a 32 bit display.
</para>

<para>
Using a depth of 24 bit is a good idea even if your card natively just supports
32 bit depth since it transfers 25% less data compared to the 32/32 mode.
</para>

<para>
I've seen some AVI files be played back on a Pentium MMX 266. AMD K6-2
CPUs might work at 400 MHZ and above.
</para>


<formalpara>
<title>KNOWN BUGS</title>

<para>
Well, according to some developers of XFree, DGA is quite a beast. They
tell you better not to use it. Its implementation is not always flawless
with every chipset driver for XFree out there.
</para>
</formalpara>

<itemizedlist>
<listitem><para>
  With XFree 4.0.3 and <filename>nv.o</filename> there is a bug resulting
  in strange colors.
</para></listitem>
<listitem><para>
  ATI driver requires to switch mode back more than once after finishing
  using of DGA.
</para></listitem>
<listitem><para>
  Some drivers simply fail to switch back to normal resolution (use
  <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Keypad +</keycap></keycombo>
  and
  <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Keypad -</keycap></keycombo>
  to switch back manually).
</para></listitem>
<listitem><para>
  Some drivers simply display strange colors.
</para></listitem>
<listitem><para>
  Some drivers lie about the amount of memory they map into the process's
  address space, thus vo_dga won't use double buffering (SIS?).
</para></listitem>
<listitem><para>
  Some drivers seem to fail to report even a single valid mode. In this
  case the DGA driver will crash telling you about a nonsense mode of
  100000x100000 or something like that.
</para></listitem>
<listitem><para>
  OSD only works with double buffering enabled (else it flickers).
</para></listitem>
</itemizedlist>

</sect1>

<!-- ********** -->

<sect1 id="svgalib">
<title>SVGAlib</title>

<formalpara>
<title>INSTALLATION</title>
<para>
You'll have to install svgalib and its development package in order for
<application>MPlayer</application> build its SVGAlib driver (autodetected,
but can be forced), and don't forget to edit
<filename>/etc/vga/libvga.config</filename> to suit your card and monitor.
</para>
</formalpara>

<note><para>
Be sure not to use the <option>-fs</option> switch, since it toggles the
usage of the software scaler, and it's slow. If you really need it, use the
<option>-sws 4</option> option which will produce bad quality, but is
somewhat faster.
</para></note>

<formalpara>
<title>EGA (4BPP) SUPPORT</title>
<para>
SVGAlib incorporates EGAlib, and <application>MPlayer</application> has the
possibility to display any movie in 16 colors, thus usable in the following
sets:
</para>
</formalpara>

<itemizedlist>
<listitem><para>
  EGA card with EGA monitor: 320x200x4bpp, 640x200x4bpp, 640x350x4bpp
</para></listitem>
<listitem><para>
  EGA card with CGA monitor: 320x200x4bpp, 640x200x4bpp
</para></listitem>
</itemizedlist>

<para>
The bpp (bits per pixel) value must be set to 4 by hand:
<option>-bpp 4</option>
</para>

<para>
The movie probably must be scaled down to fit in EGA mode:
<screen>-vf scale=640:350</screen>
or
<screen>-vf scale=320:200</screen>
</para>

<para>
For that we need fast but bad quality scaling routine:
<screen>-sws 4</screen>
</para>

<para>
Maybe automatic aspect correction has to be shut off:
<screen>-noaspect</screen>
</para>

<note><para>
According to my experience the best image quality on
EGA screens can be achieved by decreasing the brightness a bit:
<option>-vf eq=-20:0</option>. I also needed to lower the audio
samplerate on my box, because the sound was broken on 44kHz:
<option>-srate 22050</option>.
</para></note>

<para>
You can turn on OSD and subtitles only with the <option>expand</option>
filter, see the man page for exact parameters.
</para>
</sect1>

<!-- ********** -->

<sect1 id="fbdev">
<title>Framebuffer output (FBdev)</title>

<para>
Whether to build the FBdev target is autodetected during
<filename>./configure</filename>. Read the framebuffer documentation in
the kernel sources (<filename>Documentation/fb/*</filename>) for more
information.
</para>

<para>
If your card doesn't support VBE 2.0 standard (older ISA/PCI cards, such as
S3 Trio64), only VBE 1.2 (or older?): Well, VESAfb is still available, but
you'll have to load SciTech Display Doctor (formerly UniVBE) before booting
Linux. Use a DOS boot disk or whatever. And don't forget to register your
UniVBE ;))
</para>

<para>
The FBdev output takes some additional parameters above the others:
</para>

<variablelist>
<varlistentry>
  <term><option>-fb</option></term>
  <listitem><para>
    specify the framebuffer device to use (default: <filename>/dev/fb0</filename>)
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-fbmode</option></term>
  <listitem><para>
    mode name to use (according to <filename>/etc/fb.modes</filename>)
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-fbmodeconfig</option></term>
  <listitem><para>
    config file of modes (default: <filename>/etc/fb.modes</filename>)
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-monitor-hfreq</option></term>
  <term><option>-monitor-vfreq</option></term>
  <term><option>-monitor-dotclock</option></term>
  <listitem><para>
    <emphasis role="bold">important</emphasis> values, see
    <filename>example.conf</filename>
  </para></listitem>
</varlistentry>
</variablelist>

<para>
If you want to change to a specific mode, then use
<screen>
mplayer -vm -fbmode <replaceable>name_of_mode</replaceable> <replaceable>filename</replaceable>
</screen>
</para>

<itemizedlist>
<listitem><para>
  <option>-vm</option> alone will choose the most suitable mode from
  <filename>/etc/fb.modes</filename>. Can be used together with
  <option>-x</option> and <option>-y</option> options too. The
  <option>-flip</option> option is supported only if the movie's pixel
  format matches the video mode's pixel format. Pay attention to the bpp
  value, fbdev driver tries to use the current, or if you specify the
  <option>-bpp</option> option, then that.
</para></listitem>
<listitem><para>
  <option>-zoom</option> option isn't supported
  (use <option>-vf scale</option>). You can't use 8bpp (or less) modes.
</para></listitem>
<listitem><para>
  You possibly want to turn the cursor off:
  <screen>echo -e '\033[?25l'</screen>
  or
  <screen>setterm -cursor off</screen>
  and the screen saver:
  <screen>setterm -blank 0</screen>
  To turn the cursor back on:
  <screen>echo -e '\033[?25h'</screen>
  or
  <screen>setterm -cursor on</screen>
</para></listitem>
</itemizedlist>

<note><para>
FBdev video mode changing <emphasis>does not work</emphasis> with the VESA
framebuffer, and don't ask for it, since it's not an
<application>MPlayer</application> limitation.
</para></note>
</sect1>

<!-- ********** -->

<sect1 id="mga_vid">
<title>Matrox framebuffer (mga_vid)</title>

<para>
<systemitem>mga_vid</systemitem> is a combination of a video output driver and
a Linux kernel module that utilizes the Matrox G200/G400/G450/G550 video
scaler/overlay unit to perform YUV->RGB colorspace conversion and arbitrary
video scaling.
<systemitem>mga_vid</systemitem> has hardware VSYNC support with triple
buffering. It works on both a framebuffer console and under X, but only
with Linux 2.4.x.
</para>

<para>
For a Linux 2.6.x version of this driver check out
<ulink url="http://attila.kinali.ch/mga/"/> or have a look at the external
Subversion repository of mga_vid which can be checked out via

<screen>
svn checkout svn://svn.mplayerhq.hu/mga_vid
</screen>
</para>

<procedure>
<title>Installation:</title>
<step><para>
  To use it, you first have to compile <filename>drivers/mga_vid.o</filename>:
  <screen>
make drivers<!--
--></screen>
</para></step>
<step><para>
  Then run (as <systemitem class="username">root</systemitem>)
  <screen>make install-drivers</screen>
  which should install the module and create the device node for you.
  Load the driver with
  <screen>insmod mga_vid.o</screen>
</para></step>
<step><para>
  You should verify the memory size detection using the
  <command>dmesg</command> command. If it's bad, use the
  <option>mga_ram_size</option> option
  (<command>rmmod mga_vid</command> first),
  specify card's memory size in MB:
  <screen>insmod mga_vid.o mga_ram_size=16</screen>
</para></step>
<step><para>
  To make it load/unload automatically when needed, first insert the
  following line at the end of <filename>/etc/modules.conf</filename>:

  <programlisting>alias char-major-178 mga_vid</programlisting>
</para></step>
<step><para>
  Now you have to (re)compile <application>MPlayer</application>,
  <command>./configure</command> will detect
  <filename>/dev/mga_vid</filename> and build the 'mga' driver. Using it
  from <application>MPlayer</application> goes by <option>-vo mga</option>
  if you have matroxfb console, or <option>-vo xmga</option> under XFree86
  3.x.x or 4.x.x.
</para></step>
</procedure>

<para>
The mga_vid driver cooperates with Xv.
</para>

<para>
The <filename>/dev/mga_vid</filename> device file can be read for some
info, for example by
<screen>cat /dev/mga_vid</screen>
and can be written for brightness change:
<screen>echo "brightness=120" &gt; /dev/mga_vid</screen>
</para>

<para>
There is a test application called <command>mga_vid_test</command> in the same
directory. It should draw 256x256 images on the screen if all is working well.
</para>

</sect1>

<!-- ********** -->

<sect1 id="tdfxfb" xreflabel="3Dfx YUV support (tdfxfb)">
<title>3Dfx YUV support</title>

<para>
This driver uses the kernel's tdfx framebuffer driver to play movies with
YUV acceleration. You'll need a kernel with tdfxfb support, and recompile
with
<screen>./configure --enable-tdfxfb</screen>
</para>
</sect1>

<!-- ********** -->

<sect1 id="tdfx_vid">
<title>tdfx_vid</title>

<para>
This is a combination of a Linux kernel module and a video output
driver, similar to <link linkend="mga_vid">mga_vid</link>.
You'll need a 2.4.x kernel with the <systemitem>agpgart</systemitem>
driver since <systemitem>tdfx_vid</systemitem> uses AGP.
Pass <option>--enable-tdfxfb</option> to <command>configure</command>
to build the video output driver and build the kernel module with
the following instructions.
</para>

<procedure>
<title>Installing the tdfx_vid.o kernel module:</title>
<step><para>
  Compile <filename>drivers/tdfx_vid.o</filename>:
  <screen>
make drivers</screen>
</para></step>
<step><para>
  Then run (as <systemitem class="username">root</systemitem>)
  <screen>make install-drivers</screen>
  which should install the module and create the device node for you.
  Load the driver with
  <screen>insmod tdfx_vid.o</screen>
</para></step>
<step><para>
  To make it load/unload automatically when needed, first insert the
  following line at the end of <filename>/etc/modules.conf</filename>:

  <programlisting>alias char-major-178 tdfx_vid</programlisting>
</para></step>
</procedure>

<para>
There is a test application called <command>tdfx_vid_test</command> in the same
directory. It should print out some useful information if all is working well.
</para>

</sect1>

<!-- ********** -->

<sect1 id="opengl">
<title>OpenGL output</title>

<para>
<application>MPlayer</application> supports displaying movies using OpenGL,
but if your platform/driver supports xv as should be the case on a PC with
Linux, use xv instead, OpenGL performance is considerably worse. If you
have an X11 implementation without xv support, OpenGL is a viable
alternative.
</para>

<para>
Unfortunately not all drivers support this feature. The Utah-GLX drivers
(for XFree86 3.3.6) support it for all cards.
See <ulink url="http://utah-glx.sf.net"/> for details about how to
install it.
</para>

<para>
XFree86(DRI) 4.0.3 or later supports OpenGL with Matrox and Radeon cards,
4.2.0 or later supports Rage128.
See <ulink url="http://dri.sf.net"/> for download and installation
instructions.
</para>

<para>
A hint from one of our users: the GL video output can be used to get
vsynced TV output. You'll have to set an environment variable (at
least on nVidia):
</para>

<para>
<command>export __GL_SYNC_TO_VBLANK=1</command>
</para>
</sect1>

<!-- ********** -->

<sect1 id="aalib">
<title>AAlib &ndash; text mode displaying</title>

<para>
AAlib is a library for displaying graphics in text mode, using powerful
ASCII renderer. There are <emphasis>lots</emphasis> of programs already
supporting it, like Doom, Quake, etc. <application>MPlayer</application>
contains a very usable driver for it. If <filename>./configure</filename>
detects aalib installed, the aalib libvo driver will be built.
</para>

<para>
You can use some keys in the AA Window to change rendering options:
</para>

<informaltable>
<tgroup cols="2">
<thead>
  <row><entry>Key</entry><entry>Action</entry></row>
</thead>
<tbody>
<row><entry><keycap>1</keycap></entry><entry>
  decrease contrast
</entry></row>
<row><entry><keycap>2</keycap></entry><entry>
  increase contrast
</entry></row>
<row><entry><keycap>3</keycap></entry><entry>
  decrease brightness
</entry></row>
<row><entry><keycap>4</keycap></entry><entry>
  increase brightness
</entry></row>
<row><entry><keycap>5</keycap></entry><entry>
  switch fast rendering on/off
</entry></row>
<row><entry><keycap>6</keycap></entry><entry>
  set dithering mode (none, error distribution, Floyd Steinberg)
</entry></row>
<row><entry><keycap>7</keycap></entry><entry>
  invert image
</entry></row>
<row><entry><keycap>8</keycap></entry><entry>
  toggles between aa and <application>MPlayer</application> control
</entry></row>
</tbody>
</tgroup>
</informaltable>

<variablelist>
<title>The following command line options can be used:</title>
<varlistentry>
  <term><option>-aaosdcolor=<replaceable>V</replaceable></option></term>
  <listitem><para>
    change OSD color
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-aasubcolor=<replaceable>V</replaceable></option></term>
  <listitem><para>
    Change subtitle color
    </para><para>
    where <replaceable>V</replaceable> can be:
    <literal>0</literal> (normal),
    <literal>1</literal> (dark),
    <literal>2</literal> (bold),
    <literal>3</literal> (bold font),
    <literal>4</literal> (reverse),
    <literal>5</literal> (special).
  </para></listitem>
</varlistentry>
</variablelist>

<variablelist>
<title>AAlib itself provides a large sum of options. Here are some
important:</title>
<varlistentry>
  <term><option>-aadriver</option></term>
  <listitem><para>
    Set recommended aa driver (X11, curses, Linux).
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-aaextended</option></term>
  <listitem><para>
    Use all 256 characters.
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-aaeight</option></term>
  <listitem><para>
    Use eight bit ASCII.
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-aahelp</option></term>
  <listitem><para>
    Prints out all aalib options.
  </para></listitem>
</varlistentry>
</variablelist>

<note><para>
The rendering is very CPU intensive, especially when using AA-on-X
(using aalib on X), and it's least CPU intensive on standard,
non-framebuffer console. Use SVGATextMode to set up a big textmode,
then enjoy! (secondary head Hercules cards rock :)) (but IMHO you
can use <option>-vf 1bpp</option> option to get graphics on hgafb:)
</para></note>

<para>
Use the <option>-framedrop</option> option if your computer isn't fast
enough to render all frames!
</para>

<para>
Playing on terminal you'll get better speed and quality using the Linux
driver, not curses (<option>-aadriver linux</option>). But therefore you
need write access on
<filename>/dev/vcsa<replaceable>&lt;terminal&gt;</replaceable></filename>!
That isn't autodetected by aalib, but vo_aa tries to find the best mode.
See <ulink url="http://aa-project.sf.net/tune"/> for further
tuning issues.
</para>
</sect1>

<!-- ********** -->

<sect1 id="caca">
<title>
<systemitem class="library">libcaca</systemitem> &ndash; Color ASCII Art library
</title>

<para>
The <ulink url="http://sam.zoy.org/projects/libcaca/"><systemitem class="library">libcaca</systemitem></ulink>
library is a graphics library that outputs text instead of pixels, so that it
can work on older video cards or text terminals. It is not unlike the famous
<systemitem class="library">AAlib</systemitem> library.
<systemitem class="library">libcaca</systemitem> needs a terminal to work, thus
it should work on all Unix systems (including Mac OS X) using either the
<systemitem class="library">slang</systemitem> library or the
<systemitem class="library">ncurses</systemitem> library, on DOS using the
<systemitem class="library">conio.h</systemitem> library, and on Windows systems
using either <systemitem class="library">slang</systemitem> or
<systemitem class="library">ncurses</systemitem> (through Cygwin emulation) or
<systemitem class="library">conio.h</systemitem>. If
<filename>./configure</filename>
detects <systemitem class="library">libcaca</systemitem>, the caca libvo driver
will be built.
</para>

<itemizedlist>
<title>The differences with <systemitem class="library">AAlib</systemitem> are
  the following:</title>
<listitem><para>
   16 available colors for character output (256 color pairs)
</para></listitem>
<listitem><para>
   color image dithering
</para></listitem>
</itemizedlist>

<itemizedlist>
<title>But <systemitem class="library">libcaca</systemitem> also has the
  following limitations:</title>
<listitem><para>
   no support for brightness, contrast, gamma
</para></listitem>
</itemizedlist>

<para>
You can use some keys in the caca window to change rendering options:
</para>

<informaltable>
<tgroup cols="2">
<thead>
  <row><entry>Key</entry><entry>Action</entry></row>
</thead>
<tbody>
<row><entry><keycap>d</keycap></entry><entry>
  Toggle <systemitem class="library">libcaca</systemitem> dithering methods.
</entry></row>
<row><entry><keycap>a</keycap></entry><entry>
  Toggle <systemitem class="library">libcaca</systemitem> antialiasing.
</entry></row>
<row><entry><keycap>b</keycap></entry><entry>
  Toggle <systemitem class="library">libcaca</systemitem> background.
</entry></row>
</tbody>
</tgroup>
</informaltable>

<variablelist>
<title><systemitem class="library">libcaca</systemitem> will also look for
  certain environment variables:</title>
<varlistentry>
  <term><option>CACA_DRIVER</option></term>
  <listitem><para>
    Set recommended caca driver. e.g. ncurses, slang, x11.
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>CACA_GEOMETRY (X11 only)</option></term>
  <listitem><para>
    Specifies the number of rows and columns. e.g. 128x50.
  </para></listitem>
</varlistentry>
<varlistentry>
  <term><option>CACA_FONT (X11 only)</option></term>
  <listitem><para>
    Specifies the font to use. e.g. fixed, nexus.
  </para></listitem>
</varlistentry>
</variablelist>

<para>
Use the <option>-framedrop</option> option if your computer is not fast
enough to render all frames.
</para>

</sect1>

<!-- ********** -->

<sect1 id="vesa">
<title>VESA - output to VESA BIOS</title>

<para>
This driver was designed and introduced as a <emphasis role="bold">generic
driver</emphasis> for any video card which has VESA VBE 2.0 compatible
BIOS. Another advantage of this driver is that it tries to force TV output
on.
<citetitle>VESA BIOS EXTENSION (VBE) Version 3.0 Date: September 16,
1998</citetitle> (Page 70) says:
</para>

<blockquote>
<formalpara><title>Dual-Controller Designs</title>
<para>
VBE 3.0 supports the dual-controller design by assuming that since both
controllers are typically provided by the same OEM, under control of a
single BIOS ROM on the same graphics card, it is possible to hide the fact
that two controllers are indeed present from the application. This has the
limitation of preventing simultaneous use of the independent controllers,
but allows applications released before VBE 3.0 to operate normally. The
VBE Function 00h (Return Controller Information) returns the combined
information of both controllers, including the combined list of available
modes. When the application selects a mode, the appropriate controller is
activated. Each of the remaining VBE functions then operates on the active
controller.
</para>
</formalpara>
</blockquote>

<para>
So you have chances to get working TV-out by using this driver.
(I guess that TV-out frequently is standalone head or standalone output
at least.)
</para>

<itemizedlist spacing="compact">
<title>ADVANTAGES</title>
<listitem><para>
  You have chances to watch movies <emphasis role="bold">if Linux even doesn't
  know</emphasis> your video hardware.
</para></listitem>
<listitem><para>
  You don't need to have installed any graphics' related things on your
  Linux (like X11 (AKA XFree86), fbdev and so on). This driver can be run
  from <emphasis role="bold">text-mode</emphasis>.
</para></listitem>
<listitem><para>
  You have chances to get <emphasis role="bold">working TV-out</emphasis>.
  (It's known at least for ATI's cards).
</para></listitem>
<listitem><para>
  This driver calls <function>int 10h</function> handler thus it's not
  an emulator - it calls <emphasis role="bold">real</emphasis> things of
  <emphasis>real</emphasis> BIOS in <emphasis>real-mode</emphasis>
  (actually in vm86 mode).
</para></listitem>
<listitem><para>
  You can use VIDIX with it, thus getting accelerated video display
  <emphasis role="bold">and</emphasis> TV output at the same time!
  (Recommended for ATI cards.)
  </para></listitem>
<listitem><para>
  If you have VESA VBE 3.0+, and you had specified
  <option>monitor-hfreq, monitor-vfreq, monitor-dotclock</option> somewhere
  (config file, or command line) you will get the highest possible refresh rate.
  (Using General Timing Formula). To enable this feature you have to specify
  <emphasis role="bold">all</emphasis> your monitor options.
</para></listitem>
</itemizedlist>

<itemizedlist spacing="compact">
<title>DISADVANTAGES</title>
<listitem><para>
   It works only on <emphasis role="bold">x86 systems</emphasis>.
</para></listitem>
<listitem><para>
  It can be used only by <systemitem class="username">root</systemitem>.
</para></listitem>
<listitem><para>
  Currently it's available only for <emphasis role="bold">Linux</emphasis>.
</para></listitem>
</itemizedlist>

<variablelist>
<title>COMMAND LINE OPTIONS AVAILABLE FOR VESA</title>
<varlistentry>
  <term><option>-vo vesa:<replaceable>opts</replaceable></option></term>
  <listitem><para>
    currently recognized: <literal>dga</literal> to force dga mode and
    <literal>nodga</literal> to disable dga mode. In dga mode you can enable
    double buffering via the <option>-double</option> option. Note: you may omit
    these parameters to enable <emphasis role="bold">autodetection</emphasis> of
    dga mode.
  </para></listitem>
</varlistentry>
</variablelist>

<itemizedlist spacing="compact">
<title>KNOWN PROBLEMS AND WORKAROUNDS</title>
<listitem><para>
  If you have installed <emphasis role="bold">NLS</emphasis> font on your
  Linux box and run VESA driver from text-mode then after terminating
  <application>MPlayer</application> you will have
  <emphasis role="bold">ROM font</emphasis> loaded instead of national.
  You can load national font again by using <command>setsysfont</command>
  utility from the Mandrake/Mandriva distribution for example.
  (<emphasis role="bold">Hint</emphasis>: The same utility is used for
  localization of fbdev).
</para></listitem>
<listitem><para>
  Some <emphasis role="bold">Linux graphics drivers</emphasis> don't update
  active <emphasis role="bold">BIOS mode</emphasis> in DOS memory.
  So if you have such problem - always use VESA driver only from
  <emphasis role="bold">text-mode</emphasis>. Otherwise text-mode (#03) will
  be activated anyway and you will need restart your computer.
</para></listitem>
<listitem><para>
  Often after terminating VESA driver you get
  <emphasis role="bold">black</emphasis> screen. To return your screen to
  original state - simply switch to other console (by pressing
  <keycombo><keycap>Alt</keycap><keycap>F&lt;x&gt;</keycap></keycombo>)
  then switch to your previous console by the same way.
</para></listitem>
<listitem><para>
  To get <emphasis role="bold">working TV-out</emphasis> you need have plugged
  TV-connector in before booting your PC since video BIOS initializes
  itself only once during POST procedure.
</para></listitem>
</itemizedlist>
</sect1>

<!-- ********** -->

<sect1 id="x11">
<title>X11</title>

<para>
Avoid if possible. Outputs to X11 (uses shared memory extension), with no
hardware acceleration at all. Supports (MMX/3DNow/SSE accelerated, but
still slow) software scaling, use the options <option>-fs -zoom</option>.
Most cards have hardware scaling support, use the <option>-vo xv</option>
output for them, or <option>-vo xmga</option> for Matrox cards.
</para>

<para>
The problem is that most cards' driver doesn't support hardware
acceleration on the second head/TV. In those cases, you see green/blue
colored window instead of the movie. This is where this driver comes in
handy, but you need powerful CPU to use software scaling. Don't use the SDL
driver's software output+scaler, it has worse image quality!
</para>

<para>
Software scaling is very slow, you better try changing video modes instead.
It's very simple. See the <link linkend="dga-modelines">DGA section's
modelines</link>, and insert them into your <filename>XF86Config</filename>.

<itemizedlist spacing="compact">
<listitem><para>
  If you have XFree86 4.x.x: use the <option>-vm</option> option. It will
  change to a resolution your movie fits in. If it doesn't:
</para></listitem>
<listitem><para>
  With XFree86 3.x.x: you have to cycle through available resolutions
  with the
  <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Keypad +</keycap></keycombo>
  and
  <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Keypad -</keycap></keycombo>
  keys.
</para></listitem>
</itemizedlist>
</para>

<para>
If you can't find the modes you inserted, browse XFree86's output. Some
drivers can't use low pixelclocks that are needed for low resolution
video modes.
</para>
</sect1>

<!-- ********** -->

<sect1 id="vidix">
<title>VIDIX</title>

<formalpara><title>PREAMBLE</title>
<para>
<acronym>VIDIX</acronym> is the abbreviation for
<emphasis role="bold">VID</emphasis>eo
<emphasis role="bold">I</emphasis>nterface
for *ni<emphasis role="bold">X</emphasis>.
VIDIX was designed and introduced as an interface for fast user-space drivers
providing such video performance as mga_vid does for Matrox cards. It's also
very portable.
</para>
</formalpara>

<para>
This interface was designed as an attempt to fit existing video
acceleration interfaces (known as mga_vid, rage128_vid, radeon_vid,
pm3_vid) into a fixed scheme. It provides a high level interface to chips
which are known as BES (BackEnd scalers) or OV (Video Overlays). It doesn't
provide low level interface to things which are known as graphics servers.
(I don't want to compete with X11 team in graphics mode switching). I.e.
main goal of this interface is to maximize the speed of video playback.
</para>

<itemizedlist spacing="compact">
<title>USAGE</title>
<listitem><para>
  You can use standalone video output driver: <option>-vo xvidix</option>.
  This driver was developed as X11's front end to VIDIX technology. It
  requires X server and can work only under X server. Note that, as it directly
  accesses the hardware and circumvents the X driver, pixmaps cached in the
  graphics card's memory may be corrupted. You can prevent this by limiting
  the amount of video memory used by X with the XF86Config option "VideoRam"
  in the device section. You should set this to the amount of memory installed
  on your card minus 4MB. If you have less than 8MB of video ram, you can use
  the option "XaaNoPixmapCache" in the screen section instead.
</para></listitem>
<listitem>
  <para>
  There is a console VIDIX driver: <option>-vo cvidix</option>.
  This requires a working and initialized framebuffer for most cards (or else
  you'll just mess up the screen), and you'll have a similar effect as with
  <option>-vo mga</option> or <option>-vo fbdev</option>. nVidia cards however
  are able to output truly graphical video on a real text console. See the
  <link linkend="vidix-nvidia">nvidia_vid</link> section for more information.
  To get rid of text on the borders and the blinking cursor, try something like
  </para>

  <screen>setterm -cursor off > /dev/tty9</screen>

  <para>
  (assuming <systemitem>tty9</systemitem> is unused so far) and then
  switch to <systemitem>tty9</systemitem>.
  On the other hand, <option>-colorkey 0</option> should give you a video
  running in the "background", though this depends on the colorkey
  functionality to work right.
  </para>
</listitem>
<listitem><para>
  You can use VIDIX subdevice which was applied to several video output
  drivers, such as: <option>-vo vesa:vidix</option>
  (<emphasis role="bold">Linux only</emphasis>) and
  <option>-vo fbdev:vidix</option>.
</para></listitem>
</itemizedlist>

<para>
Indeed it doesn't matter which video output driver is used with
<emphasis role="bold">VIDIX</emphasis>.
</para>

<itemizedlist spacing="compact">
<title>REQUIREMENTS</title>
<listitem><para>
  Video card should be in graphics mode (except nVidia cards with the
  <option>-vo cvidix</option> output driver).
</para></listitem>
<listitem><para>
  <application>MPlayer</application>'s video output driver should know
  active video mode and be able to tell to VIDIX subdevice some video
  characteristics of server.
</para></listitem>
</itemizedlist>

<formalpara><title>USAGE METHODS</title>
<para>
When VIDIX is used as <emphasis role="bold">subdevice</emphasis> (<option>-vo
vesa:vidix</option>) then video mode configuration is performed by video
output device (<emphasis role="bold">vo_server</emphasis> in short). Therefore you can
pass into command line of <application>MPlayer</application> the same keys
as for vo_server. In addition it understands <option>-double</option> key
as globally visible parameter. (I recommend using this key with VIDIX at
least for ATI's card). As for <option>-vo xvidix</option>, currently it
recognizes the following options: <option>-fs -zoom -x -y -double</option>.
</para>
</formalpara>

<para>
Also you can specify VIDIX's driver directly as third subargument in
command line:
<screen>
mplayer -vo xvidix:mga_vid.so -fs -zoom -double <replaceable>file.avi</replaceable>
</screen>
or
<screen>
mplayer -vo vesa:vidix:radeon_vid.so -fs -zoom -double -bpp 32 <replaceable>file.avi</replaceable>
</screen>
But it's dangerous, and you shouldn't do that. In this case given driver
will be forced and result is unpredictable (it may
<emphasis role="bold">freeze</emphasis> your computer). You should do that
ONLY if you are absolutely sure it will work, and
<application>MPlayer</application> doesn't do it automatically. Please tell
about it to the developers. The right way is to use VIDIX without arguments
to enable driver autodetection.
</para>


<sect2 id="svgalib_helper">
<title>svgalib_helper</title>

<para>
Since VIDIX requires direct hardware access you can either run it as root
or set the SUID bit on the <application>MPlayer</application> binary
(<emphasis role="bold">Warning: This is a security risk!</emphasis>).
Alternatively, you can use a special kernel module, like this:
</para>

<procedure>
<step><para>
  Download the
  <ulink url="http://www.arava.co.il/matan/svgalib/">development version</ulink>
  of svgalib (1.9.x).
</para></step>
<step><para>
  Compile the module in the
  <filename class="directory">svgalib_helper</filename> directory (it can be
  found inside the
  <filename class="directory">svgalib-1.9.17/kernel/</filename> directory if
  you've downloaded the source from the svgalib site) and insmod it.
</para></step>
<step><para>
  To create the necessary devices in the
  <filename class="directory">/dev</filename> directory, do a
  <screen>make device</screen> in the
  <filename class="directory">svgalib_helper</filename> dir, as root.
</para></step>
<step><para>
  Then run <filename>configure</filename> again and pass the parameter
  <option>--enable-svgalib_helper</option> as well as
  <option>--extra-cflags=<replaceable>/path/to/svgalib_helper/sources/</replaceable>kernel/svgalib_helper</option>,
  where <replaceable>/path/to/svgalib_helper/sources/</replaceable> has to be
  adjusted to wherever you extracted svgalib_helper sources.
</para></step>
<step><para>
  Recompile.
</para></step>
</procedure>
</sect2>


<sect2 id="vidix-ati">
<title>ATI cards</title>

<para>
Currently most ATI cards are supported natively, from Mach64 to the
newest Radeons.
</para>

<para>
There are two compiled binaries: <filename>radeon_vid</filename> for Radeon and
<filename>rage128_vid</filename> for Rage 128 cards. You may force one or let
the VIDIX system autoprobe all available drivers.
</para>
</sect2>


<sect2 id="vidix-mga">
<title>Matrox cards</title>

<para>
Matrox G200, G400, G450 and G550 have been reported to work.
</para>

<para>
The driver supports video equalizers and should be nearly as fast as the
<link linkend="mga_vid">Matrox framebuffer</link>
</para>
</sect2>


<sect2 id="vidix-trident">
<title>Trident cards</title>

<para>
There is a driver available for the Trident Cyberblade/i1 chipset, which
can be found on VIA Epia motherboards.
</para>

<para>
The driver was written and is maintained by
<ulink url="http://www.blackfiveservices.co.uk/EPIAVidix.shtml">Alastair M. Robinson</ulink>.
</para>
</sect2>


<sect2 id="vidix-3dlabs">
<title>3DLabs cards</title>

<para>
Although there is a driver for the 3DLabs GLINT R3 and Permedia3 chips, no one
has tested it, so reports are welcome.
</para>
</sect2>


<sect2 id="vidix-nvidia">
<title>nVidia cards</title>

<para>
An unique feature of the nvidia_vid driver is its ability to display video on
<emphasis role="bold">plain, pure, text-only console</emphasis> - with no
framebuffer or X magic whatsoever. For this purpose, we'll have to use the
<option>cvidix</option> video output, as the following example shows:
<screen>mplayer -vo cvidix <replaceable>example.avi</replaceable></screen>
</para>
</sect2>


<sect2 id="vidix-sis">
<title>SiS cards</title>

<para>
This is very experimental code, just like nvidia_vid.
</para>

<para>
It's been tested on SiS 650/651/740 (the most common chipsets used in the
SiS versions of the "Shuttle XPC" barebones boxes out there)
</para>

<para>
Reports awaited!
</para>
</sect2>
</sect1>

<!-- ********** -->

<sect1 id="directfb">
<title>DirectFB</title>

<blockquote><para>
"DirectFB is a graphics library which was designed with embedded systems
in mind. It offers maximum hardware accelerated performance at a minimum
of resource usage and overhead." - quoted from
<ulink url="http://www.directfb.org"/>
</para></blockquote>

<para>I'll exclude DirectFB features from this section.</para>

<para>
Though <application>MPlayer</application> is not supported as a "video
provider" in DirectFB, this output driver will enable video playback
through DirectFB. It will - of course - be accelerated, on my Matrox G400
DirectFB's speed was the same as XVideo.
</para>

<para>
Always try to use the newest version of DirectFB. You can use DirectFB options
on the command line, using the <option>-dfbopts</option> option. Layer
selection can be done by the subdevice method, e.g.:
<option>-vo directfb:2</option> (layer -1 is default: autodetect)
</para>
</sect1>

<!-- ********** -->

<sect1 id="dfbmga">
<title>DirectFB/Matrox (dfbmga)</title>

<para>
Please read the <link linkend="directfb">main DirectFB</link> section for
general information.
</para>

<para>
This video output driver will enable CRTC2 (on the second head) on Matrox
G400/G450/G550 cards, displaying video
<emphasis role="bold">independent</emphasis> of the first head.
</para>

<para>
Ville Syrjala's has a
<ulink url="http://www.sci.fi/~syrjala/directfb/Matrox_TV-out_README.txt">README</ulink>
and a
<ulink url="http://www.sci.fi/~syrjala/directfb/matrox-tv-out-howto">HOWTO</ulink>
on his homepage that explain how to make DirectFB TV output run on Matrox cards.
</para>

<note><para>
the first DirectFB version with which we could get this working was
0.9.17 (it's buggy, needs that <systemitem>surfacemanager</systemitem>
patch from the URL above). Porting the CRTC2 code to
<link linkend="mga_vid">mga_vid</link> has been planned for years,
<ulink url="../../tech/patches.txt">patches</ulink> are welcome.
</para></note>
</sect1>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<sect1 id="mpeg_decoders">
<title>MPEG decoders</title>

<sect2 id="dvb">
<title>DVB output and input</title>

<para>
<application>MPlayer</application> supports cards with the Siemens DVB chipset
from vendors like Siemens, Technotrend, Galaxis or Hauppauge. The latest DVB
drivers are available from the
<ulink url="http://www.linuxtv.org">Linux TV site</ulink>.
If you want to do software transcoding you should have at least a 1GHz CPU.
</para>

<para>
Configure should detect your DVB card. If it did not, force detection with
<screen>./configure --enable-dvb</screen>
Then compile and install as usual.</para>

<formalpara><title>USAGE</title>
<para>
Hardware decoding of streams containing MPEG-1/2 video and/or MPEG audio can be done with this
command:
<screen>
mplayer -ao mpegpes -vo mpegpes <replaceable>file.mpg|vob</replaceable>
</screen>
</para>
</formalpara>

<para>
Decoding of any other type of video stream requires transcoding to MPEG-1, thus it's slow
and may not be worth the trouble, especially if your computer is slow.
It can be achieved using a command like this:
<screen>
mplayer -ao mpegpes -vo mpegpes <replaceable>yourfile.ext</replaceable>
mplayer -ao mpegpes -vo mpegpes -vf expand <replaceable>yourfile.ext</replaceable>
</screen></para>

<para>
Note that DVB cards only support heights 288 and 576 for PAL or 240 and 480 for
NTSC. You <emphasis role="bold">must</emphasis> rescale for other heights by
adding <option>scale=width:height</option> with the width and height you want
to the <option>-vf</option> option. DVB cards accept various widths, like 720,
704, 640, 512, 480, 352 etc. and do hardware scaling in horizontal direction,
so you do not need to scale horizontally in most cases.
For a 512x384 (aspect 4:3) MPEG-4 (DivX) try:
<screen>mplayer -ao mpegpes -vo mpegpes -vf scale=512:576</screen>
</para>

<para>
If you have a widescreen movie and you do not want to scale it to full height,
you can use the <option>expand=w:h</option> filter to add black bands. To view a
640x384 MPEG-4 (DivX), try:
<screen>
mplayer -ao mpegpes -vo mpegpes -vf expand=640:576 <replaceable>file.avi</replaceable>
</screen>
</para>

<para>
If your CPU is too slow for a full size 720x576 MPEG-4 (DivX), try downscaling:
<screen>
mplayer -ao mpegpes -vo mpegpes -vf scale=352:576 <replaceable>file.avi</replaceable>
</screen>
</para>

<para>If speed does not improve, try vertical downscaling, too:
<screen>
mplayer -ao mpegpes -vo mpegpes -vf scale=352:288 <replaceable>file.avi</replaceable>
</screen>
</para>

<para>
For OSD and subtitles use the OSD feature of the expand filter. So, instead of
<option>expand=w:h</option> or <option>expand=w:h:x:y</option>, use
<option>expand=w:h:x:y:1</option> (the 5th parameter <option>:1</option>
at the end will enable OSD rendering). You may want to move the image up a bit
to get a bigger black zone for subtitles. You may also want to move subtitles
up, if they are outside your TV screen, use the
<option>-subpos &lt;0-100&gt;</option>
option to adjust this (<option>-subpos 80</option> is a good choice).
</para>

<para>
In order to play non-25fps movies on a PAL TV or with a slow CPU, add the
<option>-framedrop</option> option.
</para>

<para>
To keep the aspect ratio of MPEG-4 (DivX) files and get the optimal scaling
parameters (hardware horizontal scaling and software vertical scaling
while keeping the right aspect ratio), use the new dvbscale filter:
<screen>
for a  4:3 TV: -vf dvbscale,scale=-1:0,expand=-1:576:-1:-1:1
for a 16:9 TV: -vf dvbscale=1024,scale=-1:0,expand=-1:576:-1:-1:1
</screen>
</para>

<formalpara><title>Digital TV (DVB input module)</title>
<para>You can use your DVB card for watching Digital TV.</para>
</formalpara>

<para>
You should have the programs <command>scan</command> and
<command>szap/tzap/czap/azap</command> installed; they are all included in
the drivers package.
</para>

<para>
Verify that your drivers are working properly with a program such as
<ulink url="http://sf.net/projects/dvbtools/"><command>dvbstream</command></ulink>
(that is the base of the DVB input module).
</para>

<para>
Now you should compile a <filename>~/.mplayer/channels.conf</filename>
file, with the syntax accepted by <command>szap/tzap/czap/azap</command>, or
have <command>scan</command> compile it for you.
</para>

<para>
If you have more than one card type (e.g. Satellite, Terrestrial, Cable and ATSC)
you can save your channels files as
<filename>~/.mplayer/channels.conf.sat</filename>,
<filename>~/.mplayer/channels.conf.ter</filename>,
<filename>~/.mplayer/channels.conf.cbl</filename>,
and <filename>~/.mplayer/channels.conf.atsc</filename>,
respectively, so as to implicitly hint <application>MPlayer</application>
to use these files rather than <filename>~/.mplayer/channels.conf</filename>,
and you only need to specify which card to use.
</para>

<para>
Make sure that you have <emphasis>only</emphasis> Free to Air
channels in your <filename>channels.conf</filename> file, or
<application>MPlayer</application> will wait for an unencrypted transmission.
</para>

<para>
In your audio and video fields you can use an extended syntax:
<option>...:pid[+pid]:...</option> (for a maximum of 6 pids each);
in this case <application>MPlayer</application> will include in the
stream all the indicated pids, plus pid 0 (that contains the PAT).
You should always include in each row the PMT and PCR pids for the
corresponding channel (if you know them).
You can also specify 8192, this will select all pids on this frequency
and you can then switch between the programs with TAB.
This might need more bandwidth, though cheap cards always transfer all
channels at least to the kernel so it does not make much of a difference
for these.
Other possible uses are: televideo pid, second audio track, etc.
</para>

<para>
If <application>MPlayer</application> complains frequently about
<screen>Too many video/audio packets in the buffer</screen> or
if you notice a growing desynchronization between audio and
video verify the presence of the PCR pid in your stream
(needed to comply with the buffering model of the transmitter)
and/or try to use the libavformat MPEG-TS demuxer by adding
<option>-demuxer lavf -lavfdopts probesize=128</option>
to your command line.
</para>

<para>
To show the first of the channels present in your list, run
<screen>mplayer dvb://</screen>
</para>

<para>
If you want to watch a specific channel, such as R1, run
<screen>mplayer dvb://<replaceable>R1</replaceable></screen>
</para>

<para>
If you have more than one card you also need to specify the number of the card
where the channel is visible (e.g. 2) with the syntax:
<screen>mplayer dvb://<replaceable>2@R1</replaceable></screen>
</para>

<para>
To change channels press the <keycap>h</keycap> (next) and
<keycap>k</keycap> (previous) keys, or use the
<link linkend="osdmenu">OSD menu</link>.
</para>

<para>
To temporarily disable the audio or the video stream copy the
following to <filename>~/.mplayer/input.conf</filename>:
<screen>
% set_property  switch_video -2
&amp; step_property switch_video
? set_property  switch_audio -2
^ step_property switch_audio
</screen>
(Overriding the action keys as preferred.) When pressing the key
corresponding to switch_x -2 the associated stream will be closed;
when pressing the key corresponding to step_x the stream will be reopened.
Notice that this switching mechanism will not work as expected when there
are multiple audio and video streams in the multiplex.
</para>

<para>
During playback (not during recording), in order to prevent stuttering
and error messages such as 'Your system is too slow' it is advisable to add
<screen>
-mc 10 -speed 0.97 -af scaletempo
</screen>
to your command line, adjusting the scaletempo parameters as preferred.
</para>

<para>
If your <filename>~/.mplayer/menu.conf</filename> contains a
<literal>&lt;dvbsel&gt;</literal> entry, such as the one in the example
file <filename>etc/dvb-menu.conf</filename> (that you can use to overwrite
<filename>~/.mplayer/menu.conf</filename>), the main menu will show a
sub-menu entry that will permit you to choose one of the channels present
in your <filename>channels.conf</filename>, possibly preceded by a menu
with the list of cards available if more than one is usable by
<application>MPlayer</application>.
</para>

<para>
If you want to save a program to disk you can use
<screen>
mplayer -dumpfile <replaceable>r1.ts</replaceable> -dumpstream dvb://<replaceable>R1</replaceable>
</screen>
</para>

<para>
If you want to record it in a different format (re-encoding it) instead
you can run a command such as
<screen>
mencoder -o <replaceable>r1.avi</replaceable> -ovc xvid -xvidencopts bitrate=800 \
    -oac mp3lame -lameopts cbr:br=128 -pp=ci dvb://<replaceable>R1</replaceable>
</screen>
</para>

<para>
Read the man page for a list of options that you can pass to the
DVB input module.
</para>

<formalpara><title>FUTURE</title>
<para>
If you have questions or want to hear feature announcements and take part in
discussions on this subject, join our
<ulink url="http://lists.mplayerhq.hu/mailman/listinfo/mplayer-dvb">MPlayer-DVB</ulink>
mailing list. Please remember that the list language is English.
</para>
</formalpara>

<para>
In the future you may expect the ability to display OSD and subtitles using
the native OSD feature of DVB cards.
</para>
</sect2>

<!-- ********** -->

<sect2 id="dxr2">
<title>DXR2</title>

<para>
<application>MPlayer</application> supports hardware accelerated playback
with the Creative DXR2 card.
</para>

<para>
First of all you will need properly installed DXR2 drivers. You can find
the drivers and installation instructions at the
<ulink url="http://dxr2.sf.net/">DXR2 Resource Center</ulink> site.
</para>

<variablelist><title>USAGE</title>
<varlistentry>
  <term><option>-vo dxr2</option></term>
  <listitem><para>Enable TV output.</para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-vo dxr2:x11</option> or <option>-vo dxr2:xv</option></term>
  <listitem><para>Enable Overlay output in X11.</para></listitem>
</varlistentry>
<varlistentry>
  <term><option>-dxr2 &lt;option1:option2:...&gt;</option></term>
  <listitem><para>
  This option is used to control the DXR2 driver.
  </para></listitem>
</varlistentry>
</variablelist>

<para>
The overlay chipset used on the DXR2 is of pretty bad quality but the
default settings should work for everybody. The OSD may be usable with the
overlay (not on TV) by drawing it in the colorkey. With the default colorkey
settings you may get variable results, usually you will see the colorkey
around the characters or some other funny effect. But if you properly adjust
the colorkey settings you should be able to get acceptable results.
</para>

<para>Please see the man page for available options.</para>
</sect2>

<!-- ********** -->

<sect2 id="dxr3">
<title>DXR3/Hollywood+</title>

<para>
<application>MPlayer</application> supports hardware accelerated playback
with the Creative DXR3 and Sigma Designs Hollywood Plus cards. These cards
both use the em8300 MPEG decoder chip from Sigma Designs.
</para>

<para>
First of all you will need properly installed DXR3/H+ drivers, version 0.12.0
or later. You can find the drivers and installation instructions at the
<ulink url="http://dxr3.sf.net/">DXR3 &amp; Hollywood Plus for Linux</ulink>
site. <filename>configure</filename> should detect your card automatically,
compilation should go without problems.
</para>

<!-- FIXME: find a more clear presentation -->
<variablelist>
<title>USAGE</title>
<varlistentry>
<term><option>-vo dxr3:prebuf:sync:norm=x:<replaceable>device</replaceable></option></term>
<listitem><para>
<option>overlay</option> activates the overlay instead of TV-out. It requires
that you have a properly configured overlay setup to work right. The easiest
way to configure the overlay is to first run autocal. Then run mplayer with
dxr3 output and without overlay turned on, run dxr3view. In dxr3view you can
tweak the overlay settings and see the effects in realtime, perhaps this feature
will be supported by the <application>MPlayer</application> GUI in the future.
When overlay is properly set up you will no longer need to use dxr3view.
<option>prebuf</option> turns on prebuffering. Prebuffering is a feature of the
em8300 chip that enables it to hold more than one frame of video at a time.
This means that when you are running with prebuffering
<application>MPlayer</application> will try to keep the video buffer filled
with data at all times.
If you are on a slow machine <application>MPlayer</application> will probably
use close to, or precisely 100% of CPU.
This is especially common if you play pure MPEG streams
(like DVDs, SVCDs a.s.o.) since <application>MPlayer</application> will not have
to reencode it to MPEG it will fill the buffer very fast.
With prebuffering video playback is <emphasis role="bold">much</emphasis>
less sensitive to other programs hogging the CPU, it will not drop frames unless
applications hog the CPU for a long time.
When running without prebuffering the em8300 is much more sensitive to CPU load,
so it is highly suggested that you turn on <application>MPlayer</application>'s
<option>-framedrop</option> option to avoid further loss of sync.
<option>sync</option> will turn on the new sync-engine. This is currently an
experimental feature. With the sync feature turned on the em8300's internal
clock will be monitored at all times, if it starts to deviate from
<application>MPlayer</application>'s clock it will be reset causing the em8300
to drop any frames that are lagging behind.
<option>norm=x</option> will set the TV norm of the DXR3 card without the need
for external tools like em8300setup. Valid norms are 5 = NTSC, 4 = PAL-60,
3 = PAL. Special norms are 2 (auto-adjust using PAL/PAL-60) and 1 (auto-adjust
using PAL/NTSC) because they decide which norm to use by looking at the frame
rate of the movie. norm = 0 (default) does not change the current norm.
<option><replaceable>device</replaceable></option> = device number to use if
you have more than one em8300 card. Any of these options may be left out.
<option>:prebuf:sync</option> seems to work great when playing MPEG-4 (DivX)
movies. People have reported problems using the prebuf option when playing
MPEG-1/2 files.
You might want to try running without any options first, if you have sync
problems, or DVD subtitle problems, give <option>:sync</option> a try.
</para></listitem>
</varlistentry>

<varlistentry>
  <term><option>-ao oss:/dev/em8300_ma-<replaceable>X</replaceable></option></term>
  <listitem><para>
  For audio output, where <replaceable>X</replaceable> is the device number
  (0 if one card).
  </para></listitem>
</varlistentry>

<varlistentry>
  <term><option>-af resample=<replaceable>xxxxx</replaceable></option></term>
  <listitem><para>
  The em8300 cannot play back samplerates lower than 44100Hz. If the sample
  rate is below 44100Hz select either 44100Hz or 48000Hz depending on which
  one matches closest. I.e. if the movie uses 22050Hz use 44100Hz as
  44100 / 2 = 22050, if it is 24000Hz use 48000Hz as 48000 / 2 = 24000
  and so on.
  This does not work with digital audio output (<option>-ac hwac3</option>).
  </para></listitem>
</varlistentry>

<varlistentry>
  <term><option>-vf lavc</option></term>
  <listitem><para>
  To watch non-MPEG content on the em8300 (i.e. MPEG-4 (DivX) or RealVideo)
  you have to specify an MPEG-1 video filter such as
  <systemitem class="library">libavcodec</systemitem> (lavc).
  See the man page for further info about <option>-vf lavc</option>.
  Currently there is no way of setting the fps of the em8300 which means that
  it is fixed to 30000/1001 fps.
  Because of this it is highly recommended that you use
  <option>-vf lavc=<replaceable>quality</replaceable>:25</option>
  especially if you are using prebuffering. Then why 25 and not 30000/1001?
  Well, the thing is that when you use 30000/1001 the picture becomes a bit
  jumpy.
  The reason for this is unknown to us.
  If you set it to somewhere between 25 and 27 the picture becomes stable.
  For now all we can do is accept this for a fact.
  </para></listitem>
</varlistentry>

<varlistentry>
  <term><option>-vf expand=-1:-1:-1:-1:1</option></term>
  <listitem><para>
  Although the DXR3 driver can put some OSD onto the MPEG-1/2/4 video, it has
  much lower quality than <application>MPlayer</application>'s traditional OSD,
  and has several refresh problems as well. The command line above will firstly
  convert the input video to MPEG-4 (this is mandatory, sorry), then apply an
  expand filter which won't expand anything (-1: default), but apply the normal
  OSD onto the picture (that's what the "1" at the end does).
  </para></listitem>
</varlistentry>

<varlistentry>
  <term><option>-ac hwac3</option></term>
  <listitem><para>
  The em8300 supports playing back AC-3 audio (surround sound) through the
  digital audio output of the card. See the <option>-ao oss</option> option
  above, it must be used to specify the DXR3's output instead of a sound card.
  </para></listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<sect1 id="zr">
<title>Zr</title>

<para>
This is a display-driver (<option>-vo zr</option>) for a number of MJPEG
capture/playback cards (tested for DC10+ and Buz, and it should work for the
LML33, the DC10). The driver works by encoding the frame to JPEG and then
sending it to the card. For the JPEG encoding
<systemitem class="library">libavcodec</systemitem>
is used, and required. With the special <emphasis>cinerama</emphasis> mode,
you can watch movies in true wide screen provided that you have two beamers
and two MJPEG cards. Depending on resolution and quality settings, this driver
may require a lot of CPU power, remember to specify <option>-framedrop</option>
if your machine is too slow. Note: My AMD K6-2 350MHz is (with
<option>-framedrop</option>) quite adequate for watching VCD sized material and
downscaled movies.
</para>

<para>
This driver talks to the kernel driver available at
<ulink url="http://mjpeg.sf.net"/>, so
you must get it working first. The presence of an MJPEG card is autodetected by
the <filename>configure</filename> script, if autodetection fails, force
detection with
<screen>./configure --enable-zr</screen>
</para>

<para>
The output can be controlled by several options, a long description of the
options can be found in the man page, a short list of options can be viewed
by running
<screen>mplayer -zrhelp</screen>
</para>

<para>
Things like scaling and the OSD (on screen display) are not handled by
this driver but can be done using the video filters. For example, suppose
that you have a movie with a resolution of 512x272 and you want to view it
fullscreen on your DC10+. There are three main possibilities, you may scale
the movie to a width of 768, 384 or 192. For performance and quality reasons,
I would choose to scale the movie to 384x204 using the fast bilinear software
scaler. The command line is
<screen>
mplayer -vo zr -sws 0 -vf scale=384:204 <replaceable>movie.avi</replaceable>
</screen>
</para>

<para>
Cropping can be done by the <option>crop</option> filter and by this
driver itself. Suppose that a movie is too wide for display on your Buz and
that you want to use <option>-zrcrop</option> to make the movie less wide,
then you would issue the following command
<screen>
mplayer -vo zr -zrcrop 720x320+80+0 <replaceable>benhur.avi</replaceable>
</screen>
</para>

<para>
if you want to use the <option>crop</option> filter, you would do
<screen>
mplayer -vo zr -vf crop=720:320:80:0 <replaceable>benhur.avi</replaceable>
</screen>
</para>

<para>
Extra occurrences of <option>-zrcrop</option> invoke
<emphasis>cinerama</emphasis> mode, i.e. you can distribute the movie over
several TVs or beamers to create a larger screen.
Suppose you have two beamers. The left one is connected to your
Buz at <filename>/dev/video1</filename> and the right one is connected to
your DC10+ at <filename>/dev/video0</filename>. The movie has a resolution
of 704x288. Suppose also that you want the right beamer in black and white and
that the left beamer should have JPEG frames at quality 10, then you would
issue the following command
<screen>
mplayer -vo zr -zrdev /dev/video0 -zrcrop 352x288+352+0 -zrxdoff 0 -zrbw \
    -zrcrop 352x288+0+0 -zrdev /dev/video1 -zrquality 10 \
        <replaceable>movie.avi</replaceable>
</screen>
</para>

<para>
You see that the options appearing before the second <option>-zrcrop</option>
only apply to the DC10+ and that the options after the second
<option>-zrcrop</option> apply to the Buz. The maximum number of MJPEG cards
participating in <emphasis>cinerama</emphasis> is four, so you can build a
2x2 vidiwall.
</para>

<para>
Finally an important remark: Do not start or stop XawTV on the playback device
during playback, it will crash your computer. It is, however, fine to
<emphasis role="bold">FIRST</emphasis> start XawTV,
<emphasis role="bold">THEN</emphasis> start <application>MPlayer</application>,
wait for <application>MPlayer</application>
to finish and <emphasis role="bold">THEN</emphasis> stop XawTV.
</para>
</sect1>

<!-- ********** -->

<sect1 id="blinkenlights">
<title>Blinkenlights</title>

<para>
This driver is capable of playback using the Blinkenlights UDP protocol. If you
don't know what <ulink url="http://www.blinkenlights.de/">Blinkenlights</ulink>
or its successor
<ulink url="http://www.blinkenlights.de/arcade/">Arcade</ulink>
are, find it out. Although this is most probably the least used video output
driver, without a doubt it is the coolest <application>MPlayer</application>
has to offer. Just watch some of the
<ulink url="http://www.blinkenlights.de/video.en.html">Blinkenlights documentation videos</ulink>.
On the Arcade video you can see the Blinkenlights output driver in
action at 00:07:50.
</para>
</sect1>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<sect1 id="tvout">
<title>TV-out support</title>

<sect2 id="tvout-mga-g400">
<title>Matrox G400 cards</title>

<para>
Under Linux you have two methods to get G400 TV out working:
</para>

<important>
<para>
for Matrox G450/G550 TV-out instructions, please see the next section!
</para>
</important>

<variablelist>
<varlistentry>
  <term>XFree86</term>
  <listitem>
    <para>
    Using the driver and the HAL module, available from the <ulink
    url="http://www.matrox.com">Matrox site</ulink>. This will give you X
    on the TV.
    </para>
    <para>
    <emphasis role="bold">This method doesn't give you accelerated playback</emphasis>
    as under Windows! The second head has only YUV framebuffer, the
    <emphasis>BES</emphasis> (Back End Scaler, the YUV scaler on
    G200/G400/G450/G550 cards) doesn't work on it! The windows driver somehow
    workarounds this, probably by using the 3D engine to zoom, and the YUV
    framebuffer to display the zoomed image. If you really want to use X, use
    the <option>-vo x11 -fs -zoom</option> options, but it will be
    <emphasis role="bold">SLOW</emphasis>, and has
    <emphasis role="bold">Macrovision</emphasis> copy protection enabled
    (you can "workaround" Macrovision using this
    <ulink url="http://avifile.sf.net/mgamacro.pl">Perl script</ulink>).
    </para>
  </listitem>
</varlistentry>
<varlistentry>
  <term>Framebuffer</term>
  <listitem>
    <para>
    Using the <emphasis role="bold">matroxfb modules</emphasis> in the 2.4
    kernels. 2.2 kernels don't have the TV-out feature in them, thus unusable
    for this. You have to enable ALL matroxfb-specific features during
    compilation (except MultiHead), and compile them into
    <emphasis role="bold">modules</emphasis>!
    You'll also need to enable I2C and put the tools
    <application>matroxset</application>, <application>fbset</application>
    and <application>con2fb</application> in your path.
    </para>

    <procedure>
    <step><para>
      Then load the <systemitem>matroxfb_Ti3026, matroxfb_maven, i2c-matroxfb,
      matroxfb_crtc2</systemitem> modules into your kernel. Your text-mode
      console will enter into framebuffer mode (no way back!).
    </para></step>
    <step><para>
      Next, set up your monitor and TV to your liking using the above tools.
    </para></step>
    <step><para>
      Yoh. Next task is to make the cursor on tty1 (or whatever) to
      disappear, and turn off screen blanking. Execute the following
      commands:

      <screen>
echo -e '\033[?25l'
setterm -blank 0<!--
   --></screen>
      or
      <screen>
setterm -cursor off
setterm -blank 0<!--
   --></screen>

      You possibly want to put the above into a script, and also clear the
      screen. To turn the cursor back:
      <screen>echo -e '\033[?25h'</screen> or
      <screen>setterm -cursor on</screen>
    </para></step>
    <step><para>
      Yeah kewl. Start movie playing with
      <screen>
mplayer -vo mga -fs -screenw 640 -screenh 512 <replaceable>filename</replaceable><!--
   --></screen>

      (If you use X, now change to matroxfb with for example
      <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>F1</keycap></keycombo>.)
      Change <literal>640</literal> and <literal>512</literal> if you set
      the resolution to other...
    </para></step>
    <step><para>
      <emphasis role="bold">Enjoy the ultra-fast ultra-featured Matrox TV
      output (better than Xv)!</emphasis>
    </para></step>
    </procedure>
  </listitem>
</varlistentry>
</variablelist>
</sect2>

<!-- ********** -->

<sect2 id="tv-out_matrox_g450">
<title>Matrox G450/G550 cards</title>

<para>
TV output support for these cards has only been recently introduced, and is
not yet in the mainstream kernel.
Currently the <emphasis role="bold">mga_vid</emphasis> module can't be used
AFAIK, because the G450/G550 driver works only in one configuration: the first
CRTC chip (with much more features) on the first display (on monitor),
and the second CRTC (no <emphasis role="bold">BES</emphasis> - for
explanation on BES, please see the G400 section above) on TV. So you can only
use <application>MPlayer</application>'s <emphasis>fbdev</emphasis> output
driver at the present.
</para>

<para>
The first CRTC can't be routed to the second head currently. The author of the
kernel matroxfb driver - Petr Vandrovec - will maybe make support for this, by
displaying the first CRTC's output onto both of the heads at once, as currently
recommended for G400, see the section above.
</para>

<para>
The necessary kernel patch and the detailed HOWTO is downloadable from
<ulink url="http://www.bglug.ca/matrox_tvout/"/>
</para>
</sect2>

<!-- ********** -->

<sect2 id="tv-out_matrox_cable">
<title>Building a Matrox TV-out cable</title>
<para>
No one takes any responsibility, nor guarantee for any damage caused
by this documentation.
</para>

<formalpara><title>Cable for G400</title>
<para>
The CRTC2 connector's fourth pin is the composite video signal. The
ground are the sixth, seventh and eighth pins. (info contributed
from Balázs Rácz)
</para>
</formalpara>

<formalpara><title>Cable for G450</title>
<para>
The CRTC2 connector's first pin is the composite video signal. The
ground are the fifth, sixth, seventh, and fifteenth (5, 6, 7, 15)
pins. (info contributed from Balázs Kerekes)
</para>
</formalpara>
</sect2>

<!-- ********** -->

<sect2 id="tvout-ati">
<title>ATI cards</title>

<formalpara><title>PREAMBLE</title>
<para>
Currently ATI doesn't want to support any of its TV-out chips under Linux,
because of their licensed Macrovision technology.
</para>
</formalpara>

<itemizedlist>
<title>ATI CARDS TV-OUT STATUS ON LINUX</title>
<listitem><para>
  <emphasis role="bold">ATI Mach64</emphasis>:
  supported by <ulink url="http://gatos.sf.net">GATOS</ulink>.
</para></listitem>
<listitem><para>
  <emphasis role="bold">ASIC Radeon VIVO</emphasis>:
  supported by <ulink url="http://gatos.sf.net">GATOS</ulink>.
</para></listitem>
<listitem><para>
  <emphasis role="bold">Radeon</emphasis> and <emphasis role="bold">Rage128</emphasis>:
  supported by <application>MPlayer</application>!
  Check <link linkend="vesa">VESA driver</link> and
  <link linkend="vidix">VIDIX</link> sections.
</para></listitem>
<listitem><para>
  <emphasis role="bold">Rage Mobility P/M, Radeon, Rage 128, Mobility M3/M4</emphasis>:
  supported by
  <ulink url="http://www.stud.uni-hamburg.de/users/lennart/projects/atitvout/">atitvout</ulink>.
</para></listitem>
</itemizedlist>

<para>
On other cards, just use the <link linkend="vesa">VESA</link> driver,
without VIDIX. Powerful CPU is needed, though.
</para>

<para>
Only thing you need to do - <emphasis role="bold">Have the TV connector
plugged in before booting your PC</emphasis> since video BIOS initializes
itself only once during POST procedure.
</para>
</sect2>

<!-- ********** -->

<sect2 id="tvout-nvidia">
<title>nVidia</title>

<para>
First, you MUST download the closed-source drivers from
<ulink url="http://nvidia.com"/>.
I will not describe the installation and configuration process because it does
not cover the scope of this documentation.
</para>

<para>
After XFree86, XVideo, and 3D acceleration is properly working, edit your
card's Device section in the <filename>XF86Config</filename> file, according
to the following example (adapt for your card/TV):

<programlisting>
Section "Device"
        Identifier      "GeForce"
        VendorName      "ASUS"
        BoardName       "nVidia GeForce2/MX 400"
        Driver          "nvidia"
        #Option         "NvAGP" "1"
        Option          "NoLogo"
        Option          "CursorShadow"  "on"

        Option          "TwinView"
        Option          "TwinViewOrientation" "Clone"
        Option          "MetaModes" "1024x768,640x480"
        Option          "ConnectedMonitor" "CRT, TV"
        Option          "TVStandard" "PAL-B"
        Option          "TVOutFormat" "Composite"
EndSection
</programlisting>
</para>

<para>
Of course the important thing is the TwinView part.
</para>
</sect2>

<!-- ********** -->

<sect2 id="tvout-neomagic">
<title>NeoMagic</title>

<para>
The NeoMagic chip is found in a variety of laptops, some of them are equipped
with a simple analog TV encoder, some have a more advanced one.
<itemizedlist>
<listitem><para>
  <emphasis role="bold">Analog encoder chip</emphasis>:
  It has been reported that reliable TV out can be obtained by using
  <option>-vo fbdev</option> or <option>-vo fbdev2</option>.
  You need to have vesafb compiled in your kernel and pass
  the following parameters on the kernel command line:
  <option>append="video=vesafb:ywrap,mtrr" vga=791</option>.
  You should start <application>X</application>, then switch to console mode
  with e.g.
  <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>F1</keycap></keycombo>.
  If you fail to start <application>X</application> before running
  <application>MPlayer</application> from the console, the video
  becomes slow and choppy (explanations are welcome).
  Login to your console, then initiate the following command:

  <screen>clear; mplayer -vo fbdev -zoom -cache 8192 dvd://</screen>

  Now you should see the movie running in console mode filling up about
  half your laptop's LCD screen. To switch to TV hit
  <keycombo><keycap>Fn</keycap><keycap>F5</keycap></keycombo> three times.
  Tested on a Tecra 8000, 2.6.15 kernel with vesafb, ALSA v1.0.10.
</para></listitem>
<listitem>
  <para>
  <emphasis role="bold">Chrontel 70xx encoder chip</emphasis>:
  Found in IBM Thinkpad 390E and possibly other Thinkpads or notebooks.
  </para><para>
  You must use <option>-vo vesa:neotv_pal</option> for PAL or
  <option>-vo vesa:neotv_ntsc</option> for NTSC.
  It will provide TV output function in the following 16 bpp and 8 bpp modes:
  </para>
  <itemizedlist>
    <listitem><para>NTSC 320x240, 640x480 and maybe 800x600 too.</para></listitem>
    <listitem><para>PAL  320x240, 400x300, 640x480, 800x600.</para></listitem>
  </itemizedlist>
  <para>Mode 512x384 is not supported in BIOS. You must scale the image
  to a different resolution to activate TV out. If you can see an image on the
  screen in 640x480 or in 800x600 but not in 320x240 or other smaller
  resolution you need to replace two tables in <filename>vbelib.c</filename>.
  See the vbeSetTV function for details. Please contact the author in this case.
  </para>
  <para>
  Known issues: VESA-only, no other controls such as brightness, contrast,
  blacklevel, flickfilter are implemented.
  </para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>

</chapter>
