aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/books
diff options
context:
space:
mode:
authorJim Mock <jim@FreeBSD.org>2002-07-24 04:22:50 +0000
committerJim Mock <jim@FreeBSD.org>2002-07-24 04:22:50 +0000
commite7db2f9364406332ad36a2713d53e09345252bc4 (patch)
tree33e2b5d19dc8d3a3c565f9745cfd2bf69e832967 /en_US.ISO8859-1/books
parent4c1576daddd34e93da9e21daadc7ac8e2b854e35 (diff)
downloaddoc-e7db2f9364406332ad36a2713d53e09345252bc4.tar.gz
doc-e7db2f9364406332ad36a2713d53e09345252bc4.zip
Say hello to the beginnings of a new multimedia chapter (after a
repo-copy from sound). This is based on the old sound chapter, but includes video and other multimedia related bits. More will be added to it shortly and various parts will be cleaned up, but I wanted to get this in the tree before I do anything else to it. The sound chapter has been removed from the build, but I haven't cvs rm'd it yet (though I will in about 24 hrs time). Mostly submitted by: Ross Lippert <ripper@eskimo.com>
Notes
Notes: svn path=/head/; revision=13693
Diffstat (limited to 'en_US.ISO8859-1/books')
-rw-r--r--en_US.ISO8859-1/books/handbook/Makefile2
-rw-r--r--en_US.ISO8859-1/books/handbook/book.sgml4
-rw-r--r--en_US.ISO8859-1/books/handbook/chapters.ent2
-rw-r--r--en_US.ISO8859-1/books/handbook/multimedia/Makefile2
-rw-r--r--en_US.ISO8859-1/books/handbook/multimedia/chapter.sgml926
5 files changed, 872 insertions, 64 deletions
diff --git a/en_US.ISO8859-1/books/handbook/Makefile b/en_US.ISO8859-1/books/handbook/Makefile
index 8118ae69d2..b88bbd7361 100644
--- a/en_US.ISO8859-1/books/handbook/Makefile
+++ b/en_US.ISO8859-1/books/handbook/Makefile
@@ -138,12 +138,12 @@ SRCS+= l10n/chapter.sgml
SRCS+= linuxemu/chapter.sgml
SRCS+= mail/chapter.sgml
SRCS+= mirrors/chapter.sgml
+SRCS+= multimedia/chapter.sgml
SRCS+= pgpkeys/chapter.sgml
SRCS+= ppp-and-slip/chapter.sgml
SRCS+= printing/chapter.sgml
SRCS+= security/chapter.sgml
SRCS+= serialcomms/chapter.sgml
-SRCS+= sound/chapter.sgml
SRCS+= users/chapter.sgml
SRCS+= x11/chapter.sgml
SRCS+= ports/chapter.sgml
diff --git a/en_US.ISO8859-1/books/handbook/book.sgml b/en_US.ISO8859-1/books/handbook/book.sgml
index 5db33b399d..02d4d49172 100644
--- a/en_US.ISO8859-1/books/handbook/book.sgml
+++ b/en_US.ISO8859-1/books/handbook/book.sgml
@@ -37,7 +37,7 @@
<!ENTITY % chap.backups "IGNORE">
<!ENTITY % chap.x11 "IGNORE">
<!ENTITY % chap.l10n "IGNORE">
-<!ENTITY % chap.sound "IGNORE">
+<!ENTITY % chap.multimedia "IGNORE">
<!ENTITY % chap.serialcomms "IGNORE">
<!ENTITY % chap.ppp-and-slip "IGNORE">
<!ENTITY % chap.advanced-networking "IGNORE">
@@ -171,7 +171,7 @@
<![ %chap.printing; [ &chap.printing; ]]>
<![ %chap.disks; [ &chap.disks; ]]>
<![ %chap.l10n; [ &chap.l10n; ]]>
- <![ %chap.sound; [ &chap.sound; ]]>
+ <![ %chap.multimedia; [ &chap.multimedia; ]]>
<![ %chap.serialcomms; [ &chap.serialcomms; ]]>
<![ %chap.ppp-and-slip; [ &chap.ppp-and-slip; ]]>
<![ %chap.advanced-networking; [ &chap.advanced-networking; ]]>
diff --git a/en_US.ISO8859-1/books/handbook/chapters.ent b/en_US.ISO8859-1/books/handbook/chapters.ent
index ba3cafcfe9..111e5b8351 100644
--- a/en_US.ISO8859-1/books/handbook/chapters.ent
+++ b/en_US.ISO8859-1/books/handbook/chapters.ent
@@ -27,7 +27,7 @@
<!ENTITY chap.disks SYSTEM "disks/chapter.sgml">
<!ENTITY chap.x11 SYSTEM "x11/chapter.sgml">
<!ENTITY chap.l10n SYSTEM "l10n/chapter.sgml">
-<!ENTITY chap.sound SYSTEM "sound/chapter.sgml">
+<!ENTITY chap.multimedia SYSTEM "multimedia/chapter.sgml">
<!ENTITY chap.serialcomms SYSTEM "serialcomms/chapter.sgml">
<!ENTITY chap.ppp-and-slip SYSTEM "ppp-and-slip/chapter.sgml">
<!ENTITY chap.advanced-networking SYSTEM "advanced-networking/chapter.sgml">
diff --git a/en_US.ISO8859-1/books/handbook/multimedia/Makefile b/en_US.ISO8859-1/books/handbook/multimedia/Makefile
index 0ea7f84352..f90e1cd2b0 100644
--- a/en_US.ISO8859-1/books/handbook/multimedia/Makefile
+++ b/en_US.ISO8859-1/books/handbook/multimedia/Makefile
@@ -4,7 +4,7 @@
# $FreeBSD$
#
-CHAPTERS= sound/chapter.sgml
+CHAPTERS= multimedia/chapter.sgml
VPATH= ..
diff --git a/en_US.ISO8859-1/books/handbook/multimedia/chapter.sgml b/en_US.ISO8859-1/books/handbook/multimedia/chapter.sgml
index fc05ff119d..bf114601d7 100644
--- a/en_US.ISO8859-1/books/handbook/multimedia/chapter.sgml
+++ b/en_US.ISO8859-1/books/handbook/multimedia/chapter.sgml
@@ -4,22 +4,20 @@
$FreeBSD$
-->
-<chapter id="sound">
- <chapterinfo>
- <authorgroup>
- <author>
- <firstname>Moses</firstname>
- <surname>Moore</surname>
- <contrib>Contributed by </contrib>
- </author>
- </authorgroup>
- <!-- 20 November 2000 -->
- </chapterinfo>
-
- <title>Sound</title>
-
- <sect1 id="sound-synopsis">
- <title>Synopsis</title>
+<chapter id="multimedia">
+ <chapterinfo>
+ <authorgroup>
+ <author>
+ <firstname>Ross</firstname>
+ <surname>Lippert</surname>
+ <contrib>Edited by </contrib>
+ </author>
+ </authorgroup>
+ </chapterinfo>
+
+ <title>Multimedia</title>
+ <sect1 id="multimedia-synopsis">
+ <title>Synopsis</title>
<para>FreeBSD supports a wide variety of sound cards, allowing you
to enjoy high fidelity output from your computer. This includes
@@ -29,16 +27,58 @@
applications allowing you to edit your recorded audio, add sound
effects, and control attached MIDI devices.</para>
- <para>After reading this chapter, you will know:</para>
+ <para>With some willingness to experiment, FreeBSD can support
+ playback of video files and DVD's. The number of applications
+ to encode, convert, and playback various video media is more
+ limited than the number of sound applications. For example as
+ of this writing, there is no good re-encoding application in the
+ FreeBSD Ports Collection, which could be use to interconvert
+ between formats, as there is with <filename
+ role="package">audio/sox</filename>. However, the software
+ landscape in this area is changing rapidly.</para>
+
+ <para>This chapter will describe the necessary steps to configure
+ your sound card. The configuration and installation of XFree86
+ (<xref linkend="x11">) has already taken care of the
+ hardware issues for your video card, though there may be some
+ tweaks to apply for better playback.</para>
+
+ <para>After reading this section, you will know:</para>
+
<itemizedlist>
- <listitem><para>How to locate your sound card.</para></listitem>
- <listitem><para>How to configure your system so that your sound card is
- recognized.</para></listitem>
- <listitem><para>Methods to test that your card is working using
- sample applications.</para></listitem>
- <listitem><para>How to troubleshoot your sound setup.</para></listitem>
- <listitem><para>How to playback and encode MP3s.</para></listitem>
- <listitem><para>How to rip CD audio tracks into data files.</para></listitem>
+ <listitem>
+ <para>How to configure your system so that your sound card is
+ recognized.</para>
+ </listitem>
+
+ <listitem>
+ <para>Methods to test that your card is working using
+ sample applications.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to troubleshoot your sound setup.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to playback and encode MP3s and other audio.</para>
+ </listitem>
+
+ <listitem>
+ <para>How video is supported by XFree86.</para>
+ </listitem>
+
+ <listitem>
+ <para>Some video player/encoder ports which give good results.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to playback DVD's, <filename>.mpg</filename> and <filename>.avi</filename> files.</para>
+ </listitem>
+
+ <listitem>
+ <para>How to rip CD and DVD information into files.</para>
+ </listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
@@ -47,9 +87,39 @@
<listitem><para>Know how to configure and install a new kernel (<xref
linkend="kernelconfig">).</para></listitem>
</itemizedlist>
+
+ <para>For the video sections, it is assumed that XFree86 4.X
+ (<filename role='package'>x11/XFree86-4</filename>) has been
+ installed. XFree86 3.X may work, but it has not been tested
+ with what is described in this chapter. If you find that
+ something described here does work with XFree86 3.X please
+ let us know.</para>
+
+ <warning>
+ <para>Trying to mount an audio CD
+ or a video DVD with the <command>mount</command> command will
+ result in an error, at least, and a <emphasis>kernel
+ panic</emphasis>, at worst. These media have specialized
+ encodings which differ from the usual ISO-filesystem.</para>
+ </warning>
+
</sect1>
- <sect1 id="sound-device">
+ <sect1 id="sound-setup">
+ <sect1info>
+ <authorgroup>
+ <author>
+ <firstname>Moses</firstname>
+ <surname>Moore</surname>
+ <contrib>Contributed by </contrib>
+ <!-- 20 November 2000 -->
+ </author>
+ </authorgroup>
+ </sect1info>
+
+ <title>Setting Up The Sound Card</title>
+
+ <sect2 id="sound-device">
<title>Locating the Correct Device</title>
<indexterm><primary>PCI</primary></indexterm>
@@ -127,7 +197,7 @@
recompiling your kernel, please see <xref
linkend="kernelconfig">.</para>
- <sect2>
+ <sect3>
<title>Creative, Advance, and ESS Sound Cards</title>
<para>If you have one of the above cards, you will need to
@@ -156,9 +226,9 @@ device sbc0 at isa? port 0x220 irq 5 drq 1 flags 0x15</programlisting>
recommended that you update to the latest -STABLE before
trying to use this card.</para>
</note>
- </sect2>
+ </sect3>
- <sect2>
+ <sect3>
<title>Gravis UltraSound Cards</title>
<para>For a PnP ISA card, you will need to add:</para>
@@ -175,9 +245,9 @@ device gus0 at isa? port 0x220 irq 5 drq 1 flags 0x13</programlisting>
<para>to your kernel configuration file. You may need to change
the IRQ or the other settings to match your card. See the
&man.gusc.4; manual page for more information.</para>
- </sect2>
+ </sect3>
- <sect2>
+ <sect3>
<title>Crystal Sound Cards</title>
<para>For Crystal cards, you will need to add:</para>
@@ -186,9 +256,9 @@ device gus0 at isa? port 0x220 irq 5 drq 1 flags 0x13</programlisting>
device csa</programlisting>
<para>to your kernel configuration file.</para>
- </sect2>
+ </sect3>
- <sect2>
+ <sect3>
<title>Generic Support</title>
<para>For PnP ISA or PCI cards, you will need to add:</para>
@@ -204,9 +274,9 @@ device csa</programlisting>
<para>to your kernel configuration file. You may need to change
the IRQ or the other settings to match your card.</para>
- </sect2>
+ </sect3>
- <sect2>
+ <sect3>
<title>Onboard Sound</title>
<para>Some systems with built-in motherboard sound devices may
@@ -214,10 +284,10 @@ device csa</programlisting>
configuration:</para>
<programlisting>options PNPBIOS</programlisting>
- </sect2>
- </sect1>
+ </sect3>
+ </sect2>
- <sect1 id="sound-devicenodes">
+ <sect2 id="sound-devicenodes">
<title>Creating and Testing the Device Nodes</title>
<indexterm><primary>device nodes</primary></indexterm>
@@ -231,8 +301,8 @@ pcm0: &lt;SB16 DSP 4.11&gt; on sbc0</screen>
<devicename>pcm</devicename> devices show up, something went
wrong earlier. If that happens, go through your kernel
configuration file again and make sure you chose the correct
- device. Consult the troubleshooting section for additional
- options.</para>
+ device. Common problems are listed in <xref
+ linkend="troubleshooting">.</para>
<para>If the previous command returned
<devicename>pcm0</devicename>, you will have to run the
@@ -309,10 +379,19 @@ pcm0: &lt;SB16 DSP 4.11&gt; on sbc0</screen>
</informaltable>
<para>If all goes well, you should now have a functioning sound
- card. You may want to install an application such as
- <filename role="package">audio/mpg123</filename> to listen to audio files.</para>
+ card. If your CD-ROM or DVD-ROM drive is properly coupled to
+ your soundcard, you can put a CD in the drive and play it
+ with &man.cdcontrol.1;.</para>
- <sect2>
+ <screen>&prompt.user; cdcontrol -f /dev/acd0c play 1</screen>
+
+ <para>Various applications, such as <filename
+ role="package">audio/workman</filename> offer a better
+ interface. You may want to install an application such as
+ <filename role="package">audio/mpg123</filename> to listen to
+ MP3 audio files.</para>
+
+ <sect3 id="troubleshooting">
<title>Common Problems</title>
<informaltable>
@@ -346,8 +425,7 @@ pcm0: &lt;SB16 DSP 4.11&gt; on sbc0</screen>
</row>
<row>
- <entry><errorname>xxx: gus pcm not attached, out of
- memory</errorname></entry>
+ <entry><errorname>xxx: gus pcm not attached, out of memory</errorname></entry>
<entry><para>There is not enough available memory to use
the device.</para></entry>
</row>
@@ -357,13 +435,61 @@ pcm0: &lt;SB16 DSP 4.11&gt; on sbc0</screen>
<entry><errorname>xxx: can't open /dev/dsp!</errorname></entry>
<entry><para>Check with <command>fstat | grep dsp</command>
if another application is holding the device open.
- Noteworthy troublemakers are <application>esound</application> and <application>KDE</application>'s sound
+ Noteworthy troublemakers are esound and KDE's sound
support.</para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
- </sect2>
+ </sect3>
+ </sect2>
+
+ <sect2>
+ <sect2info>
+ <authorgroup>
+ <author>
+ <firstname>Munish</firstname>
+ <surname>Chopra</surname>
+ <contrib>Contributed by</contrib>
+ </author>
+ </authorgroup>
+ </sect2info>
+ <title>Utilizing Multiple Sound Sources</title>
+
+ <para>It is often desirable to have multiple sources of sound that
+ are able to play simultaneously, such as when
+ <application>esound</application> or
+ <application>artsd</application> do not support sharing of the
+ sound device with a certain application.</para>
+
+ <para>FreeBSD lets you do this through <emphasis>Virtual Sound
+ Channels</emphasis>, which can be set with the &man.sysctl.8;
+ facility. Virtual channels allow you to multiplex your sound
+ card's playback channels by mixing sound in the kernel.</para>
+
+ <para>To set the number of virtual channels, there are two sysctl
+ knobs which, if you are the <username>root</username> user, can
+ be set like this:</para>
+ <screen>&prompt.root; sysctl hw.snd.pcm0.vchans=4
+&prompt.root; sysctl hw.snd.maxautovchans=4</screen>
+
+ <para><literal>hw.snd.pcm0.vchans</literal> is the number of
+ vchans <devicename>pcm0</devicename> has, and is configurable
+ once a device has been attached.
+ <literal>hw.snd.maxautovchans</literal> is the number of vchans
+ a new audio device is given when it is attached using
+ &man.kldload.8;. Since the <devicename>pcm</devicename> module
+ can be loaded independently of the hardware drivers,
+ <literal>hw.snd.maxautovchans</literal> can store how many
+ vchans any devices which are attached later will be
+ given.</para>
+
+ <para>If you are not using &man.devfs.5;, you will have to point
+ your applications at <devicename>/dev/dsp0</devicename>.x, where
+ 'x' is 0 to 3 if <literal>hw.snd.pcm.0.vchans</literal> is set
+ to 4. On a system using &man.devfs.5, the above will automatically be
+ allocated to the user transparently.</para>
+ </sect2>
</sect1>
<sect1 id="sound-mp3">
@@ -439,9 +565,9 @@ MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
files.</para>
<para>The <command>cdda2wav</command> tool, which is a part of
- the <filename role="package">sysutils/cdrtools</filename> suite, is used for ripping
- audio information of CDs and the information associated with
- it.</para>
+ the <filename role="package">sysutils/cdrtools</filename>
+ suite, is used for ripping audio information from CDs and the
+ information associated with them.</para>
<para>With the audio CD in the drive, the following command can
be issued (as <username>root</username>) to rip an entire CD
@@ -449,6 +575,13 @@ MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
<screen>&prompt.root; cdda2wav -D <replaceable>0,1,0</replaceable> -B</screen>
+ <para><application>cdda2wav</application> will support
+ ATAPI (IDE) CDROM drives. To rip from an IDE drive, specify
+ the device name in place of the SCSI unit numbers. For
+ example, to rip track 7 from an IDE drive:</para>
+
+ <screen>&prompt.root; cdda2wav -D <replaceable>/dev/acd0a</replaceable> -t 7</screen>
+
<para>The <option>-D <replaceable>0,1,0</replaceable></option>
indicates the SCSI device <devicename>0,1,0</devicename>,
which corresponds to the output of <command>cdrecord
@@ -465,13 +598,6 @@ MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
<screen>&prompt.root; cdda2wav -D <replaceable>0,1,0</replaceable> -t 1+7</screen>
- <para><application>cdda2wav</application> will also support
- ATAPI (IDE) CDROM drives. To rip from an IDE drive, specify
- the device name in place of the SCSI unit numbers. For
- example, to rip track 7 from an IDE drive:</para>
-
- <screen>&prompt.root; cdda2wav -D <replaceable>/dev/acd0a</replaceable> -t 7</screen>
-
</sect2>
<sect2 id="mp3-encoding">
@@ -504,7 +630,7 @@ MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
<option>--t</option> indicate ID3 tags, which usually contain
song information, to be embedded within the MP3 file.
Additional encoding options can be found by consulting the
- lame manual page.</para>
+ lame man page.</para>
</sect2>
<sect2 id="mp3-decoding">
@@ -585,5 +711,687 @@ MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
<para>Read <xref linkend="creating-cds"> for more information on using a
CD burner in FreeBSD.</para>
</sect2>
- </sect1>
+ </sect1>
+
+ <sect1 id="video-playback">
+ <sect1info>
+ <authorgroup>
+ <author>
+ <firstname>Ross</firstname>
+ <surname>Lippert</surname>
+ <contrib>Contributed by </contrib>
+ </author>
+ </authorgroup>
+ <!-- 5 June 2002 -->
+ </sect1info>
+
+ <title>Video Playback</title>
+
+ <para>Video playback is a very new and rapidly developing application
+ area. Be patient. Not everything is going to work as smoothly as
+ it did with sound.</para>
+
+ <para>Before you begin, you should know the model of the video
+ card you have and the chip it uses. While XFree86 supports a
+ wide variety of video cards, fewer give good playback
+ performance. To obtain a list of extensions supported by the
+ X-server using your card use the command &man.xdpyinfo.1; while
+ X11 is running.</para>
+
+ <para>It is a good idea to have a short MPEG file which can be
+ treated as a test file for evaluating various players and
+ options. Since some DVD players will look for DVD media in
+ <filename>/dev/dvd</filename> by default, or have this device
+ name hardcoded in them, you might find it useful to make
+ symbolic links to the proper devices:</para>
+
+ <screen>&prompt.root; ln -sf /dev/acd0c /dev/dvd
+&prompt.root; ln -sf /dev/racd0c /dev/rdvd</screen>
+
+ <para>On FreeBSD-5.X, which uses <filename>devfs</filename> there
+ is a slightly different set of recommended links:</para>
+
+ <screen>&prompt.root; ln -sf /dev/acd0c /dev/dvd
+&prompt.root; ln -sf /dev/acd0c /dev/rdvd</screen>
+
+ <para>Additionally, DVD decryption, which requires invoking
+ special DVD-ROM functions, requires write permission on the DVD
+ devices.</para>
+
+ <para>Some of the ports discussed rely on the following kernel
+ options to build correctly. Before attempting to build, add
+ these options to the kernel and reboot:</para>
+
+ <programlisting>option CPU_ENABLE_SSE
+option USER_LDT</programlisting>
+
+ <para>To enhance the shared memory X11 interface, it is
+ recommended that the values of some &man.sysctl.8; variables
+ should be increased:</para>
+
+ <programlisting>kern.ipc.shmmax=67108864
+kern.ipc.shmall=32768</programlisting>
+
+ <sect2 id="video-interface">
+ <title>Determining Video capabilities</title>
+
+ <indexterm><primary>Xvideo</primary></indexterm>
+ <indexterm><primary>SDL</primary></indexterm>
+ <indexterm><primary>DGA</primary></indexterm>
+ <indexterm>
+ <primary>kernel configuration</primary>
+ <secondary>options CPU_ENABLE_SSE</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>kernel configuration</primary>
+ <secondary>options USER_LDT</secondary>
+ </indexterm>
+
+ <para>There are several possible ways to display video under X11.
+ What will really work is largely hardware dependent. Each
+ method described below will have varying quality across
+ different hardware. Secondly, the rendering of video in X11 is
+ a topic receiving a lot of attention lately, and with each
+ version of XFree86 there may be significant improvement.</para>
+
+ <para>A list of common video interfaces:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>X11: normal X11 output using shared memory</para>
+ </listitem>
+ <listitem>
+ <para>XVideo: an extension to the X11
+ interface which supports video in any X11 drawable.</para>
+ </listitem>
+ <listitem>
+ <para>SDL: the Simple Directmedia Layer</para>
+ </listitem>
+ <listitem>
+ <para>DGA: the Direct Graphics Access</para>
+ </listitem>
+ <listitem>
+ <para>SVGAlib: low level console graphics layer</para>
+ </listitem>
+ </orderedlist>
+
+ <sect3 id="video-interface-xvideo">
+ <title>XVideo</title>
+
+ <para>XFree86 4.X has an extension called
+ <emphasis>XVideo</emphasis> (aka Xvideo, aka Xv, aka xv) which
+ allows video to be directly displayed in drawable objects
+ through a special acceleration. This extension provides very
+ good quality playback even on low-end machines (for example my
+ PIII 400Mhz laptop). Unfortunately, the list of cards in which
+ this feature is supported <quote>out of the box</quote> is
+ currently:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>3DFX Voodoo 3</para>
+ </listitem>
+ <listitem>
+ <para>Intel i810 and i815</para>
+ </listitem>
+ <listitem>
+ <para>some S3 chips (such as Savage/IX and Savage/MX)</para>
+ </listitem>
+ </orderedlist>
+
+ <para>If your card is not one of these, do not be disappointed yet.
+ XFree86 4.X adds new xv capabilities with each release
+ <footnote>
+ <para>A popular familiar graphics card with generally very good
+ XFree86 performance, nVidia, has yet to release the specifications
+ on their XVideo support to the XFree86 team. It may be some time
+ before XFree86 fully support XVideo for these cards.</para>
+ </footnote>.
+ To check whether the extension is running,
+ use <command>xvinfo</command>:</para>
+
+ <screen>&prompt.user; xvinfo</screen>
+
+ <para>XVideo is supported for your card if the result looks like:</para>
+<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
+ "XV_COLORKEY" (range 0 to 16777215)
+ client settable attribute
+ client gettable attribute (current value is 2110)
+ "XV_BRIGHTNESS" (range -128 to 127)
+ client settable attribute
+ client gettable attribute (current value is 0)
+ "XV_CONTRAST" (range 0 to 255)
+ client settable attribute
+ client gettable attribute (current value is 128)
+ "XV_SATURATION" (range 0 to 255)
+ client settable attribute
+ client gettable attribute (current value is 128)
+ "XV_HUE" (range -180 to 180)
+ client settable attribute
+ client gettable attribute (current value is 0)
+ maximum XvImage size: 1024 x 1024
+ 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)
+ id: 0x30323449 (I420)
+ guid: 49343230-0000-0010-8000-00aa00389b71
+ bits per pixel: 12
+ number of planes: 3
+ type: YUV (planar)
+ id: 0x36315652 (RV16)
+ guid: 52563135-0000-0000-0000-000000000000
+ bits per pixel: 16
+ number of planes: 1
+ type: RGB (packed)
+ depth: 0
+ red, green, blue masks: 0x1f, 0x3e0, 0x7c00
+ id: 0x35315652 (RV15)
+ guid: 52563136-0000-0000-0000-000000000000
+ bits per pixel: 16
+ number of planes: 1
+ type: RGB (packed)
+ depth: 0
+ red, green, blue masks: 0x1f, 0x7e0, 0xf800
+ id: 0x31313259 (Y211)
+ guid: 59323131-0000-0010-8000-00aa00389b71
+ bits per pixel: 6
+ number of planes: 3
+ type: YUV (packed)
+ id: 0x0
+ guid: 00000000-0000-0000-0000-000000000000
+ bits per pixel: 0
+ number of planes: 0
+ type: RGB (packed)
+ depth: 1
+ red, green, blue masks: 0x0, 0x0, 0x0</screen>
+
+ <para>Also note that the formats listed (YUV2, YUV12, etc) are not
+ present with every implementation of Xvideo and their absense may
+ hinder some players.</para>
+
+ <para>If the result looks like:</para>
+<screen>X-Video Extension version 2.2
+screen #0
+no adaptors present</screen>
+
+ <para>Then XVideo is probably not supported for your card.</para>
+
+ <para>If XVideo is not supported for your card, this only means
+ that it will be more difficult for your display to meet the
+ computational demands of rendering video. Depending on your
+ video card and processor, though, you might still be able to
+ have a satisfying experience. You should probably read about
+ ways of improving performance in the advanced reading <xref
+ linkend="video-further-reading">.</para>
+
+ </sect3>
+
+ <sect3 id="video-interface-SDL">
+ <title>Simple Directmedia Layer</title>
+
+ <para>The Simple Directmedia Layer, SDL, was intended to be a
+ porting layers between Microsoft Windows, BeOS, and Unix,
+ allowing cross-platform applications to be developed which made
+ efficient use of sound and graphics. The SDL layer provides a
+ low-level abstraction to the hardware which can sometimes be
+ more efficient than the X11 interface.</para>
+
+ <para>The SDL can be found at <filename role="package">devel/sdl12</filename></para>
+
+ </sect3>
+
+ <sect3 id="video-interface-DGA">
+ <title>Direct Graphics Access</title>
+
+ <para>Direct Graphics Access is an XFree86 extension which allows
+ a program to bypass the X-server and directly alter the
+ framebuffer. Because it relies on a low level memory mapping to
+ effect this sharing, programs using it must must be run as
+ <username>root</username></para>
+
+ <para>The DGA extension can be tested and benchmarked by
+ &man.dga.1;. When <command>dga</command> is running, it
+ changes the colors of the display whenever a key is pressed. To
+ quit, use <keycap>q</keycap>.</para>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="video-ports">
+ <title>Ports and Packages Dealing with Video</title>
+
+ <indexterm><primary>video ports</primary></indexterm>
+ <indexterm><primary>video packages</primary></indexterm>
+
+ <para>This section discusses the software available from the
+ FreeBSD Ports Collection which can be used for video playback.
+ Video playback is a very active area of software development,
+ and the capabilities of various applications are bound to
+ diverge somewhat from the descriptions given here.</para>
+
+ <para>Firstly, it is important to know that most of the video
+ applications which run on FreeBSD were developed as Linux
+ applications, originating in the past year. For this reason,
+ they are both very experimental and riddled with
+ Linux-isms which might prevent them from working at full
+ efficiency on FreeBSD.</para>
+
+ <para>By <quote>experimental</quote>, I mean that you should expect
+ re-encoders, players, and DVD decrypters to have some major
+ bugs, or interoperability problems with other programs. Here is
+ a short list of the sort of things I mean:</para>
+
+ <orderedlist>
+
+ <listitem>
+ <para>An application cannot playback a file which another
+ application produced.</para>
+ </listitem>
+
+ <listitem>
+ <para>An application cannot playback a file which the
+ application itself produced.</para>
+ </listitem>
+
+ <listitem>
+ <para>The same application on two different machines,
+ rebuilt on each machine for that machine, plays back the same
+ file differently.</para>
+ </listitem>
+
+ <listitem>
+ <para>A seemingly trivial filter like rescaling of the image
+ size results in very bad artifacts from a buggy rescaling
+ routine.</para>
+ </listitem>
+
+ <listitem>
+ <para>An application always dumping core.</para>
+ </listitem>
+
+ <listitem>
+ <para>Documentation is not installed with the port and can be
+ found either on the web or under
+ <filename><replaceable>PORTPATH</replaceable>/work/
+ </filename>.</para>
+ </listitem>
+
+ </orderedlist>
+
+ <para>By <quote>Linux-isms</quote>, I mean that there are some
+ issues resulting from the way some standard libraries are
+ implemented in the Linux distributions, or some features of the
+ Linux kernel which have been assumed by the authors of the
+ applications, because that is where the authors are primarily
+ developing. These issues may not be noticed and worked around
+ by the port maintainers which can lead to some problems like
+ these:</para>
+
+ <orderedlist>
+
+ <listitem>
+ <para>The use of <filename>/proc/cpuinfo</filename> to detect
+ processor characteristics.</para>
+ </listitem>
+
+ <listitem>
+ <para>A misuse of threads which causes a program to hang upon
+ completion instead of truly terminating.</para>
+ </listitem>
+
+ <listitem>
+ <para>Software not yet in the FreeBSD Ports Collection
+ which is commonly used in conjunction with the application.</para>
+ </listitem>
+
+ </orderedlist>
+
+ <para>So far, these application developers have been cooperative with
+ port maintainers to minimize the work-arounds needed for
+ port-ing.</para>
+
+ <sect3 id="video-mplayer">
+ <title>MPlayer</title>
+
+ <para>MPlayer is a recently developed and rapidly developing
+ video player. The goals of the MPlayer team are speed and
+ flexibility on Linux and other Unices. The project was
+ started when the team founder got fed up with bad playback
+ performance on then available players. Some would say that
+ interface has been sacrificed for streamlined design, but once
+ you get used to the command line options and the key-stroke
+ controls, it works very well.</para>
+
+ <sect4 id="video-mplayer-building">
+ <title>Building MPlayer</title>
+ <indexterm><primary>mplayer</primary>
+ <secondary>making</secondary></indexterm>
+
+ <para>MPlayer resides in <filename
+ role="package">graphics/mplayer</filename>. MPlayer
+ performs a variety of hardware checks during the build
+ process, resulting in a binary which will not be portable
+ from one system to another. Thus it is important to build
+ it from ports and not to use a binary package.
+ Additionally, a number of options can be specified in the
+ <command>make</command> which echo at the start of the
+ build.</para>
+
+ <screen>&prompt.root; cd /usr/ports/graphics/mplayer
+&prompt.root; make
+You can enable additional compilation optimizations
+by defining WITH_OPTIMIZED_CFLAGS
+You can enable GTK GUI by defining WITH_GUI.
+You can enable DVD support by defining WITH_DVD.
+You can enable SVGALIB support by defining WITH_SVGALIB.
+You can enable VORBIS sound support by defining WITH_VORBIS.
+You can enable XAnim DLL support by defining WITH_XANIM.
+</screen>
+
+ <para>If you have <filename
+ role="package">x11-toolkits/gtk12</filename> installed, then
+ you might as well enable the GUI. Otherwise, it is not
+ worth the effort. If you intend to play (possibly CSS
+ encoded) DVD's with MPlayer you must enable the DVD support
+ option here <footnote><para>Unauthorized DVD playback is a
+ serious criminal act in some countries. Check local laws
+ before enabling this option.</para> </footnote>. Some
+ reasonable options are:</para>
+
+ <screen>&prompt.root; make WITH_DVD=yes WITH_SVGALIB=yes</screen>
+
+ <para>As of this writing, the MPlayer port will build its HTML
+ documentation and one executable,
+ <command>mplayer</command>. It can also be made to build an
+ encoder, <command>mencoder</command>, which is a tool for
+ re-encoding video. A modification to the
+ <filename>Makefile</filename> can enable it. It may be
+ enabled by default in subsequent versions of the port.</para>
+
+ <para>The HTML documentation to MPlayer is very informative.
+ If the reader finds the information on video hardware and
+ interfaces in the chapter lacking, the MPlayer documentation
+ is a very thorough alternative. You should definitely take
+ the time to read the documentation of
+ <application>MPlayer</application>, if you are looking for
+ information about video support in UNIX.</para>
+
+ </sect4>
+
+ <sect4 id="video-mplayer-using">
+ <title>Using mplayer</title>
+ <indexterm><primary>mplayer</primary>
+ <secondary>use</secondary></indexterm>
+
+ <para>Any user of mplayer must set up a
+ <filename>.mplayer</filename> subdirectory directory of her
+ home directory. To create this necessary subdirectory,
+ you can do the following:</para>
+
+<screen>&prompt.user; cd /usr/ports/graphics/mplayer
+&prompt.user; make install-user</screen>
+
+ <para>The command options for <command>mplayer</command> are
+ listed in the manual page. For even more detail there is HTML
+ documentation. In this section, we will give some of the
+ common use cases.</para>
+
+ <para>To play from file, such as
+ <filename>testfile.avi</filename> through one of the various
+ video interfaces set the <option>-vo</option>:
+
+ <screen>&prompt.user; mplayer -vo xv testfile.avi</screen>
+ <screen>&prompt.user; mplayer -vo sdl testfile.avi</screen>
+ <screen>&prompt.user; mplayer -vo x11 testfile.avi</screen>
+ <screen>&prompt.root; mplayer -vo dga testfile.avi</screen>
+ <screen>&prompt.root; mplayer -vo 'sdl:dga' testfile.avi</screen>
+
+ <para>It is worth trying all of these options, as their relative
+ performance depends on many factors and will vary significantly
+ with hardware.</para>
+
+ <para>To play from a DVD, replace the
+ <filename>testfile.avi</filename> with <option>-dvd &lt;N&gt;
+ <replaceable>DEVICE</replaceable></option> where &lt;N&gt; is
+ the title number to play and
+ <filename><replaceable>DEVICE</replaceable></filename> is the
+ device file for the DVD-ROM. For example, to play title 3
+ from <filename>/dev/dvd</filename>:</para>
+
+ <screen>&prompt.root; mplayer -vo dga -dvd 2 /dev/dvd</screen>
+
+ <para>To stop, pause, advance and so on, consult the
+ keybindings, which are output by running <command>mplayer
+ -h</command> or read the manual page.</para>
+
+ <para>Additional important options for playback are:
+ <option>-fs -zoom</option> which engages the fullscreen mode
+ and <option>-framedrop</option> which helps performance.</para>
+
+ <para>In order for the mplayer command line to not become too
+ large, the user can create a file
+ <filename>.mplayer/config</filename> and set default options
+ there:</para>
+<programlisting>vo=xv
+fs=yes
+zoom=yes</programlisting>
+
+ <para>Finally, <command>mplayer</command> can be used to rip a
+ DVD title into a .vob file. To dump out title 2 from a DVD:</para>
+
+ <screen>&prompt.root; mplayer -dumpstream -dumpfile out.vob -dvd 2 /dev/dvd</screen>
+
+ <para>The output file, <filename>out.vob</filename>, will be
+ MPEG and can be manipulated by the other packages described
+ in this section.</para>
+
+ </sect4>
+ <sect4 id="video-mencoder">
+ <title>mencoder</title>
+ <indexterm>
+ <primary>mencoder</primary>
+ </indexterm>
+
+ <para>If you opt to install <command>mencoder</command> when
+ you build, be forewarned that it is still quite
+ experimental.</para>
+
+ <para>To use <command>mencoder</command> it is a good idea to
+ familiarize yourself with the options from the HTML
+ documentation. There is a manual page, but it is not very
+ useful without the HTML. There are innummerable ways to
+ improve quality, lower bitrate, and change formats, and some
+ of these tricks may make the difference between good
+ or bad performance. Here are a couple of examples to get
+ you going. First a simple copy:</para>
+
+ <screen>&prompt.user; mencoder input.avi -oac copy -ovc copy -o output.avi</screen>
+
+ <para>It is easy to find examples where the output is
+ unplayable even by <command>mplayer</command>. Thus, if you
+ just want to rip to a file, stick to the <option>-dumpfile</option>
+ in <command>mplayer</command>.</para>
+
+ <para>To convert <filename>input.avi</filename> to the MPEG4
+ codec with MPEG3 audio encoding (<filename role="package">audio/lame</filename> is required):</para>
+
+ <screen>&prompt.user; mencoder input.avi -oac mp3lame -lameopts br=192 \
+ -ovc lavc -lavcopts vcodec=mpeg4:vhq -o output.avi</screen>
+
+ <para>This has produced output playable by <command>mplayer</command>
+ and <command>Xine</command>.</para>
+
+ <para><filename>input.avi</filename> can be replaced with
+ <option>-dvd 1 /dev/dvd</option> and run as
+ <username>root</username> to re-encode a DVD title
+ directly. Since you are likely to be dissatisfied with
+ your results the first time around, it is recommended you
+ dump the title to a file and work on the file.</para>
+
+ </sect3>
+
+ <sect3 id="video-xine">
+ <title>Xine</title>
+
+ <para>Xine is a project of wide scope aiming not only at being an
+ all in one video solution, but also in producing a reusable base
+ library and a modular executable which can be extended with
+ plugins. It comes both as a package and as a port, <filename
+ role="package">graphics/xine</filename>.</para>
+
+ <para>The good news is that the above is pretty much true. Xine
+ is still very rough around the edges, but it is clearly off to a
+ good start. In practice, Xine requires either a fast CPU with a
+ fast video card, or support for the XVideo extension. The GUI is
+ usable, but a bit clumsy.</para>
+
+ <para>As of this writing, there is no input module shipped with
+ Xine which will play CSS encoded DVD's. There are third party
+ builds which do have modules for this built in them, but none
+ of these are in the FreeBSD Ports Collection.</para>
+
+ <para>Compared to MPlayer, Xine does more for the user, but at the
+ same time, takes some of the more fine-grained control away from
+ the user. Xine also may perform much worse on the non-XVideo
+ interfaces and has very few good alternatives to it. The Xine
+ FAQ highly recommends that you have a video card which supports
+ it.</para>
+
+ <para>Xine can be started by itself:</para>
+
+ <screen>&prompt.user; xine</screen>
+
+ <para>The menus can then be used to open a file, or it can be
+ started to play a file immediately without the GUI
+ with the command:</para>
+
+ <screen>&prompt.user; xine -g -p mymovie.avi</screen>
+
+ </sect3>
+
+ <sect3 id="video-ports-transcode">
+ <title>Transcode</title>
+
+ <para>Transcode is not a player, but a suite of tools for
+ re-encoding <filename>.avi</filename> and <filename>.mpg</filename> files. With Transcode, one has the
+ ability to merge video files, repair broken files, using command
+ line tools with <filename>stdin/stdout</filename> stream
+ interfaces.</para>
+
+ <para>Like MPlayer, Transcode is very experimental software which
+ must be build from the port <filename
+ role="package">graphics/transcode</filename>. Using a great
+ many options to the <command>make</command> command. I
+ recommend:</para>
+
+ <screen>&prompt.root; make WITH_LIBMPEG2=yes</screen>
+
+ <para>If you plan to install <filename
+ role="package">graphics/avifile</filename>, then add the
+ <literal>WITH_AVIFILE</literal> option to your
+ <command>make</command> command line, as shown here:</para>
+
+ <screen>&prompt.root; make WITH_AVIFILE=yes WITH_LIBMPEG2=yes</screen>
+
+ <para>Here are two examples of using <command>transcode</command>
+ for video conversion which produce rescaled output. The first
+ encodes the output to an openDIVX AVI file, while the second
+ encodes to the much more portable MPEG format.</para>
+
+ <screen>&prompt.user; transcode -i input.vob -x vob -V -Z 320x240 \
+-y opendivx -N 0x55 -o output.avi</screen>
+
+ <screen>&prompt.user; transcode -i input.vob -x vob -V -Z 320x240 \
+-y mpeg -N 0x55 -o output.tmp
+&prompt.user; tcmplex -o output.mpg -i output.tmp.m1v -p output.tmp.mpa -m 1</screen>
+
+ <para>There is a manual page for <command>transcode</command>, but
+ for the various <command>tc*</command> utilities (such as
+ <command>tcmplex</command>) which are also installed, there is
+ only a curt <option>-h</option> output.</para>
+
+ <para>In comparison, <command>transcode</command> runs
+ significantly slower than <command>mencoder</command>, but it
+ has a better chance of producing a more widely playable file. I
+ can play <command>transcode</command> MPEGs on older copies of
+ Windows Media Player and Apple's Quicktime, for example.</para>
+
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="video-further-reading">
+ <title>Further Reading</title>
+
+ <para>I have no doubt that within a year, much that is in this
+ chapter will be out of date. Video will probably be much less
+ problematic to get working well and a port will be in the
+ collection which turns a FreeBSD system into a DVD-playing, PVR,
+ and virtual A/V studio. Until that day arrives, those who
+ want to get the very most out of FreeBSD's A/V capabilities will
+ have to cobble together knowledge from several FAQs and tutorials
+ and use a few different applications.</para>
+
+ <para>This section exists to give the reader some links to learn
+ more in case this chapter was just helpful enough.</para>
+
+ <para>The
+ <ulink url="http://www.mplayerhq.hu/DOCS/">MPlayer documentation</ulink>
+ is very technically informative.
+ These documents should probably be consulted by anyone wishing
+ to obtain a high level of expertise with Unix video. The
+ MPlayer mailing list is hostile to anyone who has not bothered
+ to read the documentation, so if you plan on making bug reports
+ to them, RTFM.</para>
+
+ <para>The
+ <ulink url="http://dvd.sourceforge.net/xine-howto/en_GB/html/howto.html"> Xine HOWTO</ulink>
+ contains a chapter on performance improvement
+ which is general to all players.</para>
+
+ <para>Finally, there are some other promising applications which
+ the reader may try:</para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para><ulink
+ url="http://avifile.sourceforge.net/">AVIFile</ulink> which
+ is also a port <filename
+ role='package'>graphics/avifile</filename>.</para>
+ </listitem>
+
+ <listitem>
+ <para><ulink
+ url="http://www.dtek.chalmers.se/groups/dvd/">Ogle</ulink>
+ which is also a port <filename
+ role='package'>graphics/ogle</filename>.</para>
+ </listitem>
+
+ <listitem>
+ <para><ulink url="http://xtheater.sourceforge.net/">XTheater</ulink></para>
+ </listitem>
+
+ </itemizedlist>
+
+ </sect2>
+ </sect1>
</chapter>