input: avoid printing --input=cmdlist/keylist output twice
[mplayer.git] / DOCS / xml / en / usage.xml
blobaa59f05004d0576d15acd91755e504283dfd5d89
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- $Revision$ -->
3 <chapter id="usage">
4 <title>Usage</title>
6 <sect1 id="commandline">
7 <title>Command line</title>
9 <para>
10 <application>MPlayer</application> utilizes a complex playtree. Options passed
11 on the command line can apply to all files/URLs or just to specific ones
12 depending on their position. For example
13 <screen>mplayer -vfm ffmpeg movie1.avi movie2.avi</screen>
14 will use FFmpeg decoders for both files, but
15 <screen>
16 mplayer -vfm ffmpeg <replaceable>movie1.avi</replaceable> <replaceable>movie2.avi</replaceable> -vfm dmo
17 </screen>
18 will play the second file with a DMO decoder.
19 </para>
21 <para>
22 You can group filenames/URLs together using <literal>{</literal> and
23 <literal>}</literal>. It is useful with option <option>-loop</option>:
24 <screen>mplayer { 1.avi -loop 2 2.avi } -loop 3</screen>
25 The above command will play files in this order: 1, 1, 2, 1, 1, 2, 1, 1, 2.
26 </para>
28 <para>
29 Playing a file:
30 <synopsis>
31 <command>mplayer</command><!--
32 --> [<replaceable>options</replaceable>]<!--
33 --> [<replaceable>path</replaceable>/]<replaceable>filename</replaceable>
34 </synopsis>
35 </para>
37 <para>
38 Another way to play a file:
39 <synopsis>
40 <command>mplayer</command><!--
41 --> [<replaceable>options</replaceable>]<!--
42 --> <replaceable>file:///uri-escaped-path</replaceable>
43 </synopsis>
44 </para>
46 <para>
47 Playing more files:
48 <synopsis>
49 <command>mplayer</command><!--
50 --> [<replaceable>default options</replaceable>]<!--
51 --> [<replaceable>path</replaceable>/]<replaceable>filename1</replaceable><!--
52 --> [<replaceable>options for filename1</replaceable>]<!--
53 --> <replaceable>filename2</replaceable><!--
54 --> [<replaceable>options for filename2</replaceable>] ...
55 </synopsis>
56 </para>
58 <para>
59 Playing VCD:
60 <synopsis>
61 <command>mplayer</command> [<replaceable>options</replaceable>]<!--
62 --> vcd://<replaceable>trackno</replaceable><!--
63 --> [-cdrom-device <replaceable>/dev/cdrom</replaceable>]
64 </synopsis>
65 </para>
67 <para>
68 Playing DVD:
69 <synopsis>
70 <command>mplayer</command> [<replaceable>options</replaceable>]<!--
71 --> dvd://<replaceable>titleno</replaceable><!--
72 --> [-dvd-device <replaceable>/dev/dvd</replaceable>]
73 </synopsis>
74 </para>
76 <para>
77 Playing from the WWW:
78 <synopsis>
79 <command>mplayer</command> [<replaceable>options</replaceable>]<!--
80 --> http://<replaceable>site.com/file.asf</replaceable>
81 </synopsis>
82 (playlists can be used, too)
83 </para>
85 <para>
86 Playing from RTSP:
87 <synopsis>
88 <command>mplayer</command> [<replaceable>options</replaceable>]<!--
89 --> rtsp://<replaceable>server.example.com/streamName</replaceable>
90 </synopsis>
91 </para>
93 <para>
94 Examples:
95 <screen>
96 mplayer -vo x11 <replaceable>/mnt/Films/Contact/contact2.mpg</replaceable>
97 mplayer vcd://<replaceable>2</replaceable> -cdrom-device <replaceable>/dev/hdc</replaceable>
98 mplayer -afm 3 <replaceable>/mnt/DVDtrailers/alien4.vob</replaceable>
99 mplayer dvd://<replaceable>1</replaceable> -dvd-device <replaceable>/dev/hdc</replaceable>
100 mplayer -abs 65536 -delay -0.4 -nobps <replaceable>~/movies/test.avi</replaceable><!--
101 --></screen>
102 </para>
103 </sect1>
106 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
109 <sect1 id="subosd">
110 <title>Subtitles and OSD</title>
112 <para>
113 OUTDATED CONTENT REMOVED
114 </para>
115 </sect1>
118 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
121 <sect1 id="control">
122 <title>Control</title>
124 <para>
125 <application>MPlayer</application> has a fully configurable, command
126 driven, control layer which lets you control
127 <application>MPlayer</application> with keyboard, mouse, joystick or remote
128 control (using LIRC). See the man page for the complete list of keyboard controls.
129 </para>
131 <!-- ********** -->
133 <sect2 id="ctrl-cfg">
134 <title>Controls configuration</title>
136 <para>
137 <application>MPlayer</application> allows you bind any key/button to any
138 <application>MPlayer</application> command using a simple config file.
139 The syntax consist of a key name followed by a command. The default config file location is
140 <filename>$HOME/.mplayer/input.conf</filename> but it can be overridden
141 using the <option>-input <replaceable>conf</replaceable></option> option
142 (relative path are relative to <filename>$HOME/.mplayer</filename>).
143 </para>
145 <para>
146 You can get a full list of supported key names by running
147 <command>mplayer -input keylist</command>
148 and a full list of available commands by running
149 <command>mplayer -input cmdlist</command>.
150 </para>
152 <example id="input_control_file">
153 <title>A simple input control file</title>
154 <programlisting>
156 ## MPlayer input control file
159 RIGHT seek +10
160 LEFT seek -10
161 - audio_delay 0.100
162 + audio_delay -0.100
163 q quit
164 &gt; pt_step 1
165 &lt; pt_step -1
166 ENTER pt_step 1 1<!--
167 --></programlisting>
168 </example>
169 </sect2>
171 <!-- ********** -->
173 <sect2 id="lirc">
174 <title>Control from LIRC</title>
176 <para>
177 Linux Infrared Remote Control - use an easy to build home-brewed IR-receiver,
178 an (almost) arbitrary remote control and control your Linux box with it!
179 More about it on the <ulink url="http://www.lirc.org">LIRC homepage</ulink>.
180 </para>
182 <para>
183 If you have the LIRC package installed, <filename>configure</filename> will
184 autodetect it. If everything went fine, <application>MPlayer</application>
185 will print "<systemitem>Setting up LIRC support...</systemitem>"
186 on startup. If an error occurs it will tell you. If there is no message about
187 LIRC there is no support compiled in. That's it :-)
188 </para>
190 <para>
191 The application name for <application>MPlayer</application> is - surprise -
192 <filename>mplayer</filename>. You can use any <application>MPlayer</application>
193 commands and even pass more than one command by separating them with
194 <literal>\n</literal>.
195 Do not forget to enable the repeat flag in <filename>.lircrc</filename> when
196 it makes sense (seek, volume, etc). Here is an excerpt from a sample
197 <filename>.lircrc</filename>:
198 </para>
200 <programlisting>
201 begin
202      button = VOLUME_PLUS
203      prog = mplayer
204      config = volume 1
205      repeat = 1
208 begin
209     button = VOLUME_MINUS
210     prog = mplayer
211     config = volume -1
212     repeat = 1
215 begin
216     button = CD_PLAY
217     prog = mplayer
218     config = pause
221 begin
222     button = CD_STOP
223     prog = mplayer
224     config = seek 0 1\npause
225 end<!--
226 --></programlisting>
228 <para>
229 If you do not like the standard location for the lirc-config file
230 (<filename>~/.lircrc</filename>) use the <option>-lircconf
231 <replaceable>filename</replaceable></option> switch to specify another
232 file.
233 </para>
234 </sect2>
236 <!-- ********** -->
238 <sect2 id="slave-mode">
239 <title>Slave mode</title>
241 <para>
242 The slave mode allows you to build simple frontends to
243 <application>MPlayer</application>. When run with the
244 <option>-slave</option> option <application>MPlayer</application> will
245 read commands separated by a newline (\n) from stdin.
246 The commands are documented in the
247 <ulink url="../../tech/slave.txt">slave.txt</ulink> file.
248 </para>
249 </sect2>
250 </sect1>
253 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
256 <sect1 id="streaming">
257 <title>Streaming from network or pipes</title>
259 <para>
260 <application>MPlayer</application> can play files from the network, using the
261 HTTP, FTP, MMS or RTSP/RTP protocol.
262 </para>
264 <para>
265 Playing works simply by passing the URL on the command line.
266 <application>MPlayer</application> honors the <envar>http_proxy</envar>
267 environment variable, using a proxy if available. Proxies can also be forced:
268 <screen>
269 mplayer <replaceable>http_proxy://proxy.micorsops.com:3128/http://micorsops.com:80/stream.asf</replaceable>
270 </screen>
271 </para>
273 <para>
274 <application>MPlayer</application> can read from stdin
275 (<emphasis>not</emphasis> named pipes). This can for example be used to
276 play from FTP:
277 <screen>
278 wget <replaceable>ftp://micorsops.com/something.avi</replaceable> -O - | mplayer -
279 </screen>
280 </para>
282 <note><para>
283 It is also recommended to enable <option>-cache</option> when playing
284 from the network:
285 <screen>
286 wget <replaceable>ftp://micorsops.com/something.avi</replaceable> -O - | mplayer -cache 8192 -
287 </screen>
288 </para></note>
290 <!-- ********** -->
292 <sect2 id="streaming-save">
293 <title>Saving streamed content</title>
295 <para>
296 Once you succeed in making <application>MPlayer</application> play
297 your favorite internet stream, you can use the option
298 <option>-dumpstream</option> to save the stream into a file.
299 For example:
300 <screen>
301 mplayer <replaceable>http://217.71.208.37:8006</replaceable> -dumpstream -dumpfile <replaceable>stream.asf</replaceable>
302 </screen>
303 will save the content streamed from
304 <replaceable>http://217.71.208.37:8006</replaceable> into
305 <replaceable>stream.asf</replaceable>.
306 This works with all protocols supported by
307 <application>MPlayer</application>, like MMS, RTSP, and so forth.
308 </para>
309 </sect2>
310 </sect1>
313 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
316 <sect1 id="dvd">
317 <title>DVD playback</title>
319 <para>
320 For the complete list of available options, please read the man page.
321 The syntax to play a standard DVD is as follows:
322 <screen>
323 mplayer dvd://<replaceable>&lt;track&gt;</replaceable> [-dvd-device <replaceable>&lt;device&gt;</replaceable>]
324 </screen>
325 </para>
327 <para>
328 Example:
329 <screen>mplayer dvd://1 -dvd-device /dev/hdc</screen>
330 </para>
332 <para>
333 If you have compiled <application>MPlayer</application> with dvdnav support, the
334 syntax is the same, except that you need to use dvdnav:// instead of dvd://.
335 </para>
337 <para>
338 The default DVD device is <filename>/dev/dvd</filename>. If your setup
339 differs, make a symlink or specify the correct device on the command
340 line with the <option>-dvd-device</option> option.
341 </para>
343 <para>
344 <application>MPlayer</application> uses <systemitem>libdvdread</systemitem> and
345 <systemitem>libdvdcss</systemitem> for DVD playback and decryption. These two
346 libraries are contained in the
347 <application>MPlayer</application> source tree, you do not have
348 to install them separately. You can also use system-wide versions of the two
349 libraries, but this solution is not recommended, as it can result in bugs,
350 library incompatibilities and slower speed.
351 </para>
353 <note><para>
354 In case of DVD decoding problems, try disabling supermount, or any other such
355 facilities. Some RPC-2 drives may also require setting the region code.
356 </para></note>
358 <formalpara>
359 <title>DVD decryption</title>
360 <para>
361 DVD decryption is done by <systemitem>libdvdcss</systemitem>. The method
362 can be specified through the <envar>DVDCSS_METHOD</envar> environment
363 variable, see the manual page for details.
364 </para>
365 </formalpara>
367 <!-- ********** -->
369 <sect2 id="region_code">
370 <title>region code</title>
371 <para>
372 DVD drives nowadays come with a nonsensical restriction labeled
373 <ulink url="http://en.wikipedia.org/wiki/DVD_region_code">region code</ulink>.
374 This is a scheme to force DVD drives to only accept DVDs produced for one of
375 the six different regions into which the world was partitioned. How a group
376 of people can sit around a table, come up with such an idea and expect the
377 world of the 21st century to bow to their will is beyond anyone's guess.
378 </para>
380 <para>
381 Drives that enforce region settings through software only are also known as
382 RPC-1 drives, those that do it in hardware as RPC-2. RPC-2 drives allow
383 changing the region code five times before it remains fixed.
384 Under Linux you can use the
385 <ulink url="http://linvdr.org/projects/regionset/">regionset</ulink> tool
386 to set the region code of your DVD drive.
387 </para>
389 <para>
390 Thankfully, it is possible to convert RPC-2 drives into RPC-1 drives through
391 a firmware upgrade. Feed the model number of your DVD drive into your favorite
392 search engine or have a look at the forum and download sections of
393 <ulink url="http://www.rpc1.org/">"The firmware page"</ulink>.
394 While the usual caveats for firmware upgrades apply, experience with
395 getting rid of region code enforcement is generally positive.
396 </para>
397 </sect2>
398 </sect1>
401 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
404 <sect1 id="vcd">
405 <title>VCD playback</title>
407 <para>
408 For the complete list of available options, please read the man page. The
409 Syntax for a standard Video CD (VCD) is as follows:
410 <screen>mplayer vcd://<replaceable>&lt;track&gt;</replaceable> [-cdrom-device <replaceable>&lt;device&gt;</replaceable>]</screen>
411 Example:
412 <screen>mplayer vcd://2 -cdrom-device /dev/hdc</screen>
413 The default VCD device is <filename>/dev/cdrom</filename>. If your setup
414 differs, make a symlink or specify the correct device on the command line
415 with the <option>-cdrom-device</option> option.
416 </para>
418 <note><para>
419 At least Plextor and some Toshiba SCSI CD-ROM drives have horrible performance
420 reading VCDs. This is because the CDROMREADRAW <systemitem>ioctl</systemitem>
421 is not fully implemented for these drives. If you have some knowledge of SCSI
422 programming, please <ulink url="../../tech/patches.txt">help us</ulink>
423 implement generic SCSI support for VCDs.
424 </para></note>
426 <para>
427 In the meantime you can extract data from VCDs with
428 <ulink url="http://ftp.ntut.edu.tw/ftp/OS/Linux/packages/X/viewers/readvcd/">readvcd</ulink>
429 and play the resulting file with <application>MPlayer</application>.
430 </para>
432 <formalpara>
433 <title>VCD structure</title>
434 <para>
435 A Video CD (VCD) is made up of CD-ROM XA sectors, i.e. CD-ROM mode 2
436 form 1 and 2 tracks:
437 <itemizedlist>
438 <listitem><para>
439   The first track is in mode 2 form 2 format which means it uses L2
440   error correction. The track contains an ISO-9660 file system with 2048
441   bytes/sector. This file system contains VCD metadata information, as
442   well as still frames often used in menus. MPEG segments for menus can
443   also be stored in this first track, but the MPEGs have to be broken up
444   into a series of 150-sector chunks. The ISO-9660 file system may
445   contain other files or programs that are not essential for VCD
446   operation.
447 </para></listitem>
449 <listitem><para>
450   The second and remaining tracks are generally raw 2324 bytes/sector
451   MPEG (movie) tracks, containing one MPEG PS data packet per
452   sector. These are in mode 2 form 1 format, so they store more data per
453   sector at the loss of some error correction. It is also legal to have
454   CD-DA tracks in a VCD after the first track as well.
455   On some operating systems there is some trickery that goes on to make
456   these non-ISO-9660 tracks appear in a file system. On other operating
457   systems like GNU/Linux this is not the case (yet). Here the MPEG data
458   <emphasis role="bold">cannot be mounted</emphasis>. As most movies are
459   inside this kind of track, you should try <option>vcd://2</option>
460   first.
461 </para></listitem>
463 <listitem><para>
464   There exist VCD disks without the first track (single track and no file system
465   at all). They are still playable, but cannot be mounted.
466 </para></listitem>
468 <listitem><para>
469   The definition of the Video CD standard is called the
470   Philips "White Book" and it is not generally available online as it
471   must be purchased from Philips. More detailed information about Video
472   CDs can be found in the
473   <ulink url="http://www.vcdimager.org/pub/vcdimager/manuals/0.7/vcdimager.html#SEC4">vcdimager documentation</ulink>.
474 </para></listitem>
475 </itemizedlist>
476 </para>
477 </formalpara>
479 <formalpara>
480 <title>About .DAT files</title>
481 <para>
482 The ~600 MB file visible on the first track of the mounted VCD is not a real
483 file! It is a so called ISO gateway, created to allow Windows to handle such
484 tracks (Windows does not allow raw device access to applications at all).
485 Under Linux you cannot copy or play such files (they contain garbage). Under
486 Windows it is possible as its iso9660 driver emulates the raw reading of
487 tracks in this file. To play a .DAT file you need the kernel driver which can
488 be found in the Linux version of PowerDVD. It has a modified iso9660 file system
489 (<filename>vcdfs/isofs-2.4.X.o</filename>) driver, which is able to emulate the
490 raw tracks through this shadow .DAT file. If you mount the disc using their
491 driver, you can copy and even play .DAT files with
492 <application>MPlayer</application>. But it will not
493 work with the standard iso9660 driver of the Linux kernel! Use
494 <option>vcd://</option> instead. Alternatives for VCD copying are the
495 new <ulink url="http://www.elis.rug.ac.be/~ronsse/cdfs/">cdfs</ulink> kernel
496 driver (not part of the official kernel) that shows CD sessions as image files
497 and <ulink url="http://cdrdao.sf.net/">cdrdao</ulink>, a bit-by-bit
498 CD grabbing/copying application.
499 </para>
500 </formalpara>
501 </sect1>
504 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
507 <sect1 id="edl" xreflabel="Edit Decision Lists (EDL)">
508 <title>Edit Decision Lists (EDL)</title>
510 <para>
511 The edit decision list (EDL) system allows you to automatically skip
512 or mute sections of videos during playback, based on a movie specific
513 EDL configuration file.
514 </para>
516 <para>
517 This is useful for those who may want to watch a film in "family-friendly"
518 mode. You can cut out any violence, profanity, Jar-Jar Binks .. from a movie
519 according to your own personal preferences. Aside from this, there are other
520 uses, like automatically skipping over commercials in video files you watch.
521 </para>
523 <para>
524 The EDL file format is pretty bare-bones. There is one command per line that
525 indicates what to do (skip/mute) and when to do it (using pts in seconds).
526 </para>
528 <!-- ********** -->
530 <sect2 id="edl_using">
531 <title>Using an EDL file</title>
533 <para>
534 Include the <option>-edl &lt;filename&gt;</option> flag when you run
535 <application>MPlayer</application>, with the name of the EDL file you
536 want applied to the video.
537 </para>
538 </sect2>
540 <!-- ********** -->
542 <sect2 id="edl_making">
543 <title>Making an EDL file</title>
545 <para>
546 The current EDL file format is:
547 <programlisting>[begin second] [end second] [action]</programlisting>
548 Where the seconds are floating-point numbers and the action is either
549 <literal>0</literal> for skip or <literal>1</literal> for mute. Example:
550 <programlisting>
551 5.3   7.1    0
552 15    16.7   1
553 420   422    0
554 </programlisting>
555 This will skip from second 5.3 to second 7.1 of the video, then mute at
556 15 seconds, unmute at 16.7 seconds and skip from second 420 to second 422
557 of the video. These actions will be performed when the playback timer
558 reaches the times given in the file.
559 </para>
561 <para>
562 To create an EDL file to work from, use the <option>-edlout
563 &lt;filename&gt;</option> flag. During playback, just hit <keycap>i</keycap> to
564 mark the beginning and end of a skip block.
565 A corresponding entry will be written to the file for that time.
566 You can then go back and fine-tune the generated EDL file as well as
567 change the default operation which is to skip the block described by each line.
568 </para>
569 </sect2>
570 </sect1>
573 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
576 <sect1 id="advaudio-surround">
577 <title>Surround/Multichannel playback</title>
579 <sect2 id="advaudio-surround-DVD">
580 <title>DVDs</title>
582 <para>
583 Most DVDs and many other files include surround sound.
584 <application>MPlayer</application> supports surround playback but does not
585 enable it by default because stereo equipment is by far more common. To play a
586 file that has more than two channels of audio use <option>-channels</option>.
587 For example, to play a DVD with 5.1 audio:
588 <screen>mplayer dvd://1 -channels 6</screen>
589 Note that despite the name "5.1" there are actually six discrete channels.
590 If you have surround sound equipment it is safe to put the
591 <option>channels</option> option in your <application>MPlayer</application>
592 configuration file <filename>~/.mplayer/config</filename>. For example, to make
593 quadraphonic playback the default, add this line:
594 <programlisting>channels=4</programlisting>
595 <application>MPlayer</application> will then output audio in four channels when
596 all four channels are available.
597 </para>
598 </sect2>
601 <sect2 id="advaudio-surround-stereoinfour">
602 <title>Playing stereo files to four speakers</title>
604 <para>
605 <application>MPlayer</application> does not duplicate any channels by default,
606 and neither do most audio drivers. If you want to do that manually:
607 <screen>mplayer <replaceable>filename</replaceable> -af channels=2:2:0:1:0:0</screen>
608 See the section on
609 <link linkend="advaudio-channels-copying">channel copying</link> for an
610 explanation.
611 </para>
612 </sect2>
615 <sect2 id="advaudio-surround-passthrough">
616 <title>AC-3/DTS Passthrough</title>
618 <para>
619 DVDs usually have surround audio encoded in AC-3 (Dolby Digital) or DTS
620 (Digital Theater System) format. Some modern audio equipment is capable of
621 decoding these formats internally. <application>MPlayer</application> can be
622 configured to relay the audio data without decoding it. This will only work if
623 you have a S/PDIF (Sony/Philips Digital Interface) jack in your sound card, or
624 if you are passing audio over HDMI.
625 </para>
627 <para>
628 If your audio equipment can decode both AC-3 and DTS, you can safely enable
629 passthrough for both formats. Otherwise, enable passthrough for only the format
630 your equipment supports.
631 </para>
633 <itemizedlist>
634 <title>To enable passthrough on the command line:</title>
635 <listitem><para>
636   For AC-3 only, use <option>-ac hwac3</option>
637 </para></listitem>
638 <listitem><para>
639   For DTS only, use <option>-ac hwdts</option>
640 </para></listitem>
641 <listitem><para>
642   For both AC-3 and DTS, use <option>-afm hwac3</option>
643 </para></listitem>
644 </itemizedlist>
646 <itemizedlist>
647 <title>To enable passthrough in the <application>MPlayer</application>
648   configuration file: </title>
649 <listitem><para>
650   For AC-3 only, use <option>ac=hwac3,</option>
651 </para></listitem>
652 <listitem><para>
653   For DTS only, use <option>ac=hwdts,</option>
654 </para></listitem>
655 <listitem><para>
656   For both AC-3 and DTS, use <option>afm=hwac3</option>
657 </para></listitem>
658 </itemizedlist>
660 <para>
661 Note that there is a comma (",") at the end of
662 <option>ac=hwac3,</option> and <option>ac=hwdts,</option>. This will make
663 <application>MPlayer</application> fall back on the codecs it normally uses when
664 playing a file that does not have AC-3 or DTS audio.
665 <option>afm=hwac3</option> does not need a comma;
666 <application>MPlayer</application> will fall back anyway when an audio family
667 is specified.
668 </para>
669 </sect2>
672 <sect2 id="hwmpa-surround-passthrough">
673 <title>MPEG audio Passthrough</title>
675 <para>
676 Digital TV transmissions (such as DVB and ATSC) and some DVDs usually have
677 MPEG audio streams (in particular MP2).
678 Some MPEG hardware decoders such as full-featured DVB cards and DXR2
679 adapters can natively decode this format.
680 <application>MPlayer</application> can be configured to relay the audio data
681 without decoding it.
682 </para>
684 <para>
685 To use this codec:
686 <screen> mplayer -ac hwmpa </screen>
687 </para>
688 </sect2>
691 <sect2 id="advaudio-surround-matrix">
692 <title>Matrix-encoded audio</title>
694 <para>
695 <emphasis>***TODO***</emphasis>
696 </para>
698 <para>
699 This section has yet to be written and cannot be completed until somebody
700 provides sample files for us to test. If you have any matrix-encoded audio
701 files, know where to find some, or have any information that could be helpful,
702 please send a message to the
703 <ulink url="http://lists.mplayerhq.hu/mailman/listinfo/mplayer-docs">MPlayer-DOCS</ulink>
704 mailing list. Put "[matrix-encoded audio]" in the subject line.
705 </para>
707 <para>
708 If no files or further information are forthcoming this section will be dropped.
709 </para>
711 <para>
712 Good links:
713 <itemizedlist>
714 <listitem><para>
715   <ulink url="http://electronics.howstuffworks.com/surround-sound5.htm">http://electronics.howstuffworks.com/surround-sound5.htm</ulink>
716 </para></listitem>
717 <listitem><para>
718   <ulink url="http://www.extremetech.com/article2/0,1697,1016875,00.asp">http://www.extremetech.com/article2/0,1697,1016875,00.asp</ulink>
719 </para></listitem>
720 </itemizedlist>
721 </para>
722 </sect2>
725 <sect2 id="advaudio-surround-hrtf">
726 <title>Surround emulation in headphones</title>
728 <para>
729 <application>MPlayer</application> includes an HRTF (Head Related Transfer
730 Function) filter based on an
731 <ulink url="http://sound.media.mit.edu/KEMAR.html">MIT project</ulink>
732 wherein measurements were taken from microphones mounted on a dummy human head.
733 </para>
735 <para>
736 Although it is not possible to exactly imitate a surround system,
737 <application>MPlayer</application>'s HRTF filter does provide more spatially
738 immersive audio in 2-channel headphones. Regular downmixing simply combines all
739 the channels into two; besides combining the channels, <option>hrtf</option>
740 generates subtle echoes, increases the stereo separation slightly, and alters
741 the volume of some frequencies. Whether HRTF sounds better may be dependent on
742 the source audio and a matter of personal taste, but it is definitely worth
743 trying out.
744 </para>
746 <para>
747 To play a DVD with HRTF:
748 <screen>mplayer dvd://1 -channels 6 -af hrtf</screen>
749 </para>
751 <para>
752 <option>hrtf</option> only works well with 5 or 6 channels. Also,
753 <option>hrtf</option> requires 48 kHz audio. DVD audio is already 48 kHz, but if
754 you have a file with a different sampling rate that you want to play using
755 <option>hrtf</option> you must resample it:
756 <screen>
757 mplayer <replaceable>filename</replaceable> -channels 6 -af resample=48000,hrtf
758 </screen>
759 </para>
760 </sect2>
763 <sect2 id="advaudio-surround-troubleshooting">
764 <title>Troubleshooting</title>
766 <para>
767 If you do not hear any sound out of your surround channels, check your mixer
768 settings with a mixer program such as <application>alsamixer</application>;
769 audio outputs are often muted and set to zero volume by default.
770 </para>
771 </sect2>
772 </sect1>
774 <!-- ********** -->
776 <sect1 id="advaudio-channels">
777 <title>Channel manipulation</title>
779 <sect2 id="advaudio-channels-general">
780 <title>General information</title>
782 <para>
783 Unfortunately, there is no standard for how channels are ordered. The orders
784 listed below are those of AC-3 and are fairly typical; try them and see if your
785 source matches. Channels are numbered starting with 0.
787 <orderedlist spacing="compact">
788 <title>mono</title>
789   <listitem override="0"><para>center</para></listitem>
790 </orderedlist>
792 <orderedlist spacing="compact">
793 <title>stereo</title>
794   <listitem override="0"><para>left</para></listitem>
795   <listitem><para>right</para></listitem>
796 </orderedlist>
798 <orderedlist spacing="compact">
799 <title>quadraphonic</title>
800   <listitem override="0"><para>left front</para></listitem>
801   <listitem><para>right front</para></listitem>
802   <listitem><para>left rear</para></listitem>
803   <listitem><para>right rear</para></listitem>
804 </orderedlist>
806 <orderedlist spacing="compact">
807 <title>surround 4.0</title>
808   <listitem override="0"><para>left front</para></listitem>
809   <listitem><para>right front</para></listitem>
810   <listitem><para>center rear</para></listitem>
811   <listitem><para>center front</para></listitem>
812 </orderedlist>
814 <orderedlist spacing="compact">
815 <title>surround 5.0</title>
816   <listitem override="0"><para>left front</para></listitem>
817   <listitem><para>right front</para></listitem>
818   <listitem><para>left rear</para></listitem>
819   <listitem><para>right rear</para></listitem>
820   <listitem><para>center front</para></listitem>
821 </orderedlist>
823 <orderedlist spacing="compact">
824 <title>surround 5.1</title>
825   <listitem override="0"><para>left front</para></listitem>
826   <listitem><para>right front</para></listitem>
827   <listitem><para>left rear</para></listitem>
828   <listitem><para>right rear</para></listitem>
829   <listitem><para>center front</para></listitem>
830   <listitem><para>subwoofer</para></listitem>
831 </orderedlist>
832 </para>
834 <para>
835 The <option>-channels</option> option is used to request the number of
836 channels from the audio decoder. Some audio codecs use the number of specified
837 channels to decide if downmixing the source is necessary. Note that this does
838 not always affect the number of output channels. For example, using
839 <option>-channels 4</option> to play a stereo MP3 file will still result in
840 2-channel output since the MP3 codec will not produce the extra channels.
841 </para>
843 <para>
844 The <option>channels</option> audio filter can be used to create or remove
845 channels and is useful for controlling the number of channels sent to the sound
846 card. See the following sections for more information on channel manipulation.
847 </para>
848 </sect2>
851 <sect2 id="advaudio-channels-mono">
852 <title>Playing mono with two speakers</title>
854 <para>
855 Mono sounds a lot better when played through two speakers - especially when
856 using headphones. Audio files that truly have one channel are automatically
857 played through two speakers; unfortunately, most files with mono sound are
858 actually encoded as stereo with one channel silent. The easiest and most
859 foolproof way to make both speakers output the same audio is the
860 <option>extrastereo</option> filter:
861 <screen>mplayer <replaceable>filename</replaceable> -af extrastereo=0</screen>
862 </para>
864 <para>
865 This averages both channels, resulting in both channels being half as loud as
866 the original. The next sections have examples of other ways to do this without a
867 volume decrease, but they are more complex and require different options
868 depending on which channel to keep. If you really need to maintain the volume,
869 it may be easier to experiment with the <option>volume</option> filter and find
870 the right value. For example:
871 <screen>
872 mplayer <replaceable>filename</replaceable> -af extrastereo=0,volume=5
873 </screen>
874 </para>
875 </sect2>
878 <sect2 id="advaudio-channels-copying">
879 <title>Channel copying/moving</title>
881 <para>
882 The <option>channels</option> filter can move any or all channels.
883 Setting up all the suboptions for the <option>channels</option>
884 filter can be complicated and takes a little care.
886 <orderedlist spacing="compact">
887 <listitem><para>
888   Decide how many output channels you need. This is the first suboption.
889 </para></listitem>
890 <listitem><para>
891   Count how many channel moves you will do. This is the second suboption. Each
892   channel can be moved to several different channels at the same time, but keep
893   in mind that when a channel is moved (even if to only one destination) the
894   source channel will be empty unless another channel is moved into it. To copy
895   a channel, keeping the source the same, simply move the channel into both the
896   destination and the source. For example:
897   <programlisting>
898 channel 2 --> channel 3
899 channel 2 --> channel 2<!--
900   --></programlisting>
901 </para></listitem>
902 <listitem><para>
903   Write out the channel copies as pairs of suboptions. Note that the first
904   channel is 0, the second is 1, etc. The order of these suboptions does not
905   matter as long as they are properly grouped into
906   <replaceable>source:destination</replaceable> pairs.
907 </para></listitem>
908 </orderedlist>
909 </para>
911 <bridgehead>Example: one channel in two speakers</bridgehead>
912 <para>
913 Here is an example of another way to play one channel in both speakers. Suppose
914 for this example that the left channel should be played and the right channel
915 discarded. Following the steps above:
916 <orderedlist>
917 <listitem><para>
918   In order to provide an output channel for each of the two speakers, the first
919   suboption must be "2".
920 </para></listitem>
921 <listitem><para>
922   The left channel needs to be moved to the right channel, and also must be
923   moved to itself so it won't be empty. This is a total of two moves, making
924   the second suboption "2" as well.
925 </para></listitem>
926 <listitem><para>
927   To move the left channel (channel 0) into the right channel (channel 1), the
928   suboption pair is "0:1", "0:0" moves the left channel onto itself.
929 </para></listitem>
930 </orderedlist>
931 Putting that all together gives:
932 <screen>
933 mplayer <replaceable>filename</replaceable> -af channels=2:2:0:1:0:0
934 </screen>
935 </para>
937 <para>
938 The advantage this example has over <option>extrastereo</option> is that the
939 volume of each output channel is the same as the input channel. The disadvantage
940 is that the suboptions must be changed to "2:2:1:0:1:1" when the desired audio
941 is in the right channel. Also, it is more difficult to remember and type.
942 </para>
944 <bridgehead>Example: left channel in two speakers shortcut</bridgehead>
945 <para>
946 There is actually a much easier way to use the <option>channels</option> filter
947 for playing the left channel in both speakers:
948 <screen>mplayer <replaceable>filename</replaceable> -af channels=1</screen>
949 The second channel is discarded and, with no further suboptions, the single
950 remaining channel is left alone. Sound card drivers automatically play
951 single-channel audio in both speakers. This only works when the desired channel
952 is on the left.
953 </para>
955 <bridgehead>Example: duplicate front channels to the rear</bridgehead>
956 <para>
957 Another common operation is to duplicate the front channels and play them back
958 on the rear speakers of a quadraphonic setup.
959 <orderedlist>
960 <listitem><para>
961   There should be four output channels. The first suboption is "4".
962 </para></listitem>
963 <listitem><para>
964   Each of the two front channels needs to be moved to the corresponding rear
965   channel and also to itself. This is four moves, so the second suboption is "4".
966 </para></listitem>
967 <listitem><para>
968   The left front (channel 0) needs to moved to the left rear (channel 2):
969   "0:2".  The left front also needs to be moved to itself: "0:0". The right
970   front (channel 1) is moved to the right rear (channel 3): "1:3", and also to
971   itself: "1:1".
972 </para></listitem>
973 </orderedlist>
974 Combine all the suboptions to get:
975 <screen>
976 mplayer <replaceable>filename</replaceable> -af channels=4:4:0:2:0:0:1:3:1:1
977 </screen>
978 </para>
979 </sect2>
982 <sect2 id="advaudio-channels-mixing">
983 <title>Channel mixing</title>
985 <para>
986 The <option>pan</option> filter can mix channels in user-specified proportions.
987 This allows for everything the <option>channels</option> filter can do and
988 more. Unfortunately, the suboptions are much more complicated.
989 <orderedlist>
990 <listitem><para>
991   Decide how many channels to work with. You may need to specify this with
992   <option>-channels</option> and/or <option>-af channels</option>.
993   Later examples will show when to use which.
994 </para></listitem>
995 <listitem><para>
996   Decide how many channels to feed into <option>pan</option> (further decoded
997   channels are discarded). This is the first suboption, and it also controls how
998   many channels to employ for output.
999 </para></listitem>
1000 <listitem>
1001   <para>
1002   The remaining suboptions specify how much of each channel gets mixed into each
1003   other channel. This is the complicated part. To break the task down, split the
1004   suboptions into several sets, one set for each input channel. Each suboption
1005   within a set corresponds to an output channel. The number you specify will be
1006   the percentage of the input channel that gets mixed into the output channel.
1007   </para>
1008   <para>
1009   <option>pan</option> accepts values from 0 to 512, yielding 0% to 51200% of
1010   the original volume. Be careful when using values greater than 1. Not only
1011   can this give you very high volume, but if you exceed the sample range of
1012   your sound card you may hear painful pops and clicks. If you want you can
1013   follow <option>pan</option> with <option>,volume</option> to enable clipping,
1014   but it is best to keep the values of <option>pan</option> low enough that
1015   clipping is not necessary.
1016   </para>
1017 </listitem>
1018 </orderedlist>
1019 </para>
1021 <bridgehead>Example: one channel in two speakers</bridgehead>
1022 <para>
1023 Here is yet another example for playing the left channel in two speakers. Follow
1024 the steps above:
1025 <orderedlist>
1026 <listitem><para>
1027   <option>pan</option> should output two channels, so the first
1028   suboption is "2".
1029 </para></listitem>
1030 <listitem><para>
1031   Since we have two input channels, there will be two sets of suboptions.
1032   Since there are also two output channels,
1033   there will be two suboptions per set.
1034   The left channel from the file should go with full volume to
1035   the new left and the right channels.
1036   Thus the first set of suboptions is "1:1".
1037   The right channel should be discarded, so the second would be "0:0".
1038   Any 0 values at the end can be left out, but for ease of
1039   understanding we will keep them.
1040 </para></listitem>
1041 </orderedlist>
1042 Putting those options together gives:
1043 <screen>mplayer <replaceable>filename</replaceable> -af pan=2:1:1:0:0</screen>
1044 If the right channel is desired instead of the left, the suboptions to
1045 <option>pan</option> will be "2:0:0:1:1".
1046 </para>
1049 <bridgehead>Example: left channel in two speakers shortcut</bridgehead>
1050 <para>
1051 As with <option>channels</option>, there is a shortcut that only works with the
1052 left channel:
1053 <screen>mplayer <replaceable>filename</replaceable> -af pan=1:1</screen>
1054 Since <option>pan</option> has only one channel of input (the other channel is
1055 discarded), there is only one set with one suboption, which specifies that the
1056 only channel gets 100% of itself.
1057 </para>
1059 <bridgehead>Example: downmixing 6-channel PCM</bridgehead>
1060 <para>
1061 <application>MPlayer</application>'s decoder for 6-channel PCM is not capable of
1062 downmixing. Here is a way to downmix PCM using <option>pan</option>:
1063 <orderedlist>
1064 <listitem><para>
1065   The number of output channels is 2, so the first suboption is "2".
1066 </para></listitem>
1067 <listitem><para>
1068   With six input channels there will be six sets of options. Fortunately,
1069   since we only care about the output of the first two channels, we only need to
1070   make two sets; the remaining four sets can be omitted. Beware that not all
1071   multichannel audio files have the same channel order! This example
1072   demonstrates downmixing a file with the same channels as AC-3 5.1:
1073   <programlisting>
1074 0 - front left
1075 1 - front right
1076 2 - rear left
1077 3 - rear right
1078 4 - center front
1079 5 - subwoofer<!--
1080   --></programlisting>
1081   The first set of suboptions lists the percentages of the original volume, in
1082   order, which each output channel should receive from the
1083   front left channel: "1:0".
1084   The front right channel should go into the right output: "0:1".
1085   The same for the rear channels: "1:0" and "0:1".
1086   The center channel goes into both output channels with half volume:
1087   "0.5:0.5", and the subwoofer goes into both with full volume: "1:1".
1088 </para></listitem>
1089 </orderedlist>
1090 Put all that together, for:
1091 <screen>
1092 mplayer <replaceable>6-channel.wav</replaceable> -af pan=2:1:0:0:1:1:0:0:1:0.5:0.5:1:1
1093 </screen>
1094 The percentages listed above are only a rough example. Feel free to tweak them.
1095 </para>
1097 <bridgehead>Example: Playing 5.1 audio on big speakers without a subwoofer</bridgehead>
1098 <para>
1099 If you have a huge pair of front speakers you may not want to waste any money on
1100 buying a subwoofer for a complete 5.1 sound system. If you use
1101 <option>-channels 5</option> to request that liba52 decode 5.1 audio in 5.0,
1102 the subwoofer channel is simply discarded. If you want to distribute the
1103 subwoofer channel yourself you need to downmix manually with
1104 <option>pan</option>:
1105 <orderedlist>
1106 <listitem><para>
1107   Since <option>pan</option> needs to examine all six channels, specify
1108   <option>-channels 6</option> so liba52 decodes them all.
1109 </para></listitem>
1110 <listitem><para>
1111   <option>pan</option> outputs to only five channels, the first suboption is 5.
1112 </para></listitem>
1113 <listitem><para>
1114   Six input channels and five output channels means six sets of five suboptions.
1115   <itemizedlist spacing="compact">
1116   <listitem><para>
1117     The left front channel only replicates onto itself:
1118     "1:0:0:0:0"
1119   </para></listitem>
1120   <listitem><para>
1121     Same for the right front channel:
1122     "0:1:0:0:0"
1123   </para></listitem>
1124   <listitem><para>
1125     Same for the left rear channel:
1126     "0:0:1:0:0"
1127   </para></listitem>
1128   <listitem><para>
1129     And also the same for the right rear channel:
1130     "0:0:0:1:0"
1131   </para></listitem>
1132   <listitem><para>
1133     Center front, too:
1134     "0:0:0:0:1"
1135   </para></listitem>
1136   <listitem><para>
1137     And now we have to decide what to do with the subwoofer,
1138     e.g. half into front right and front left:
1139     "0.5:0.5:0:0:0"
1140   </para></listitem>
1141   </itemizedlist>
1142 </para></listitem>
1143 </orderedlist>
1144 Combine all those options to get:
1145 <screen>
1146 mplayer <replaceable>dvd://1</replaceable> -channels 6 -af pan=5:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0.5:0.5:0:0:0
1147 </screen>
1148 </para>
1149 </sect2>
1150 </sect1>
1152 <!-- ********** -->
1154 <sect1 id="advaudio-volume">
1155 <title>Software Volume adjustment</title>
1157 <para>
1158 Some audio tracks are too quiet to be heard comfortably without amplification.
1159 This becomes a problem when your audio equipment cannot amplify the signal for
1160 you. The <option>-softvol</option> option directs
1161 <application>MPlayer</application> to use an internal mixer. You can then use
1162 the volume adjustment keys (by default <keycap>9</keycap> and
1163 <keycap>0</keycap>) to reach much higher volume levels. Note that this does not
1164 bypass your sound card's mixer; <application>MPlayer</application> only
1165 amplifies the signal before sending it to your sound card.
1166 The following example is a good start:
1167 <screen>
1168 mplayer <replaceable>quiet-file</replaceable> -softvol -softvol-max 300
1169 </screen>
1170 The <option>-softvol-max</option> option specifies the maximum allowable output
1171 volume as a percentage of the
1172 original volume. For example, <option>-softvol-max 200</option> would allow the
1173 volume to be adjusted up to twice its original level.
1174 It is safe to specify a large value with
1175 <option>-softvol-max</option>; the higher volume will not be used until you
1176 use the volume adjustment keys. The only disadvantage of a large value is that,
1177 since <application>MPlayer</application> adjusts volume by a percentage of the
1178 maximum, you will not have as precise control when using the volume adjustment
1179 keys. Use a lower value with <option>-softvol-max</option> and/or specify
1180 <option>-volstep 1</option> if you need higher precision.
1181 </para>
1183 <para>
1184 The <option>-softvol</option> option works by controlling the
1185 <option>volume</option> audio filter. If you want to play a file at a certain
1186 volume from the beginning you can specify <option>volume</option> manually:
1187 <screen>mplayer <replaceable>quiet-file</replaceable> -af volume=10</screen>
1188 This will play the file with a ten decibel gain. Be careful when using the
1189 <option>volume</option> filter - you could easily hurt your ears if you use
1190 too high a value. Start low and work your way up gradually until you get a feel
1191 for how much adjustment is required. Also, if you specify excessively high
1192 values, <option>volume</option> may need to clip the signal to avoid sending
1193 your sound card data that is outside the allowable range; this will result in
1194 distorted audio.
1195 </para>
1196 </sect1>
1198 <!-- ********** -->
1200 <sect1 id="tv-input" xreflabel="TV input">
1201 <title>TV input</title>
1203 <para>
1204 This section is about how to enable <emphasis role="bold">watching/grabbing
1205 from V4L compatible TV tuner</emphasis>. See the man page for a description
1206 of TV options and keyboard controls.
1207 </para>
1209 <sect2 id="tv-tips">
1210 <title>Usage tips</title>
1212 <para>
1213 The full listing of the options is available on the manual page.
1214 Here are just a few tips:
1216 <itemizedlist>
1217 <listitem><para>
1218   Make sure your tuner works with another TV software in Linux, for
1219   example <application>XawTV</application>.
1220 </para></listitem>
1221 <listitem><para>
1222   Use the <option>channels</option> option. An example:
1223   <screen>-tv channels=26-MTV1,23-TV2</screen>
1224   Explanation: Using this option, only the 26 and 23 channels will be usable,
1225   and there will be a nice OSD text upon channel switching, displaying the
1226   channel's name. Spaces in the channel name must be replaced by the
1227   "_" character.
1228 </para></listitem>
1229 <listitem><para>
1230   Choose some sane image dimensions. The dimensions of the resulting image
1231   should be divisible by 16.
1232 </para></listitem>
1233 <listitem>
1234   <para>
1235   If you capture the video with the vertical resolution higher than half
1236   of the full resolution (i.e. 288 for PAL or 240 for NTSC), then the
1237   'frames' you get will really be interleaved pairs of fields.
1238   Depending on what you want to do with the video you may leave it in
1239   this form, destructively deinterlace, or break the pairs apart into
1240   individual fields.
1241   </para>
1242   <para>
1243   Otherwise you'll get a movie which is distorted during
1244   fast-motion scenes and the bitrate controller will be probably even unable
1245   to retain the specified bitrate as the interlacing artifacts produce high
1246   amount of detail and thus consume lot of bandwidth. You can enable
1247   deinterlacing with <option>-vf pp=DEINT_TYPE</option>.
1248   Usually <option>pp=lb</option> does a good job, but it can be matter of
1249   personal preference.
1250   See other deinterlacing algorithms in the manual and give it a try.
1251   </para>
1252 </listitem>
1253 <listitem><para>
1254   Crop out the dead space. When you capture the video, the areas at the edges
1255   are usually black or contain some noise. These again consume lots of
1256   unnecessary bandwidth. More precisely it's not the black areas themselves
1257   but the sharp transitions between the black and the brighter video image
1258   which do but that's not important for now. Before you start capturing,
1259   adjust the arguments of the <option>crop</option> option so that all the
1260   crap at the margins is cropped out. Again, don't forget to keep the resulting
1261   dimensions sane.
1262 </para></listitem>
1263 <listitem><para>
1264   Watch out for CPU load. It shouldn't cross the 90% boundary for most of the
1265   time. If you have a large capture buffer, <application>MEncoder</application>
1266   can survive an overload for few seconds but nothing more. It's better to
1267   turn off the 3D OpenGL screensavers and similar stuff.
1268 </para></listitem>
1269 <listitem><para>
1270   Don't mess with the system clock. <application>MEncoder</application> uses the
1271   system clock for doing A/V sync. If you adjust the system clock (especially
1272   backwards in time), <application>MEncoder</application> gets confused and you
1273   will lose frames. This is an important issue if you are hooked to a network
1274   and run some time synchronization software like NTP. You have to turn NTP
1275   off during the capture process if you want to capture reliably.
1276 </para></listitem>
1277 <listitem><para>
1278   Don't change the <option>outfmt</option> unless you know what you are doing
1279   or your card/driver really doesn't support the default (YV12 colorspace).
1280   In the older versions of <application>MPlayer</application>/
1281   <application>MEncoder</application> it was necessary to specify the output
1282   format. This issue should be fixed in the current releases and
1283   <option>outfmt</option> isn't required anymore, and the default suits the
1284   most purposes. For example, if you are capturing into DivX using
1285   <systemitem class="library">libavcodec</systemitem> and specify
1286   <option>outfmt=RGB24</option> in order to increase the quality of the captured
1287   images, the captured image will be actually later converted back into YV12 so
1288   the only thing you achieve is a massive waste of CPU power.
1289 </para></listitem>
1290 <listitem><para>
1291   There are several ways of capturing audio. You can grab the sound either using
1292   your sound card via an external cable connection between video card and
1293   line-in, or using the built-in ADC in the bt878 chip. In the latter case, you
1294   have to load the <emphasis role="bold">btaudio</emphasis> driver. Read the
1295   <filename>linux/Documentation/sound/btaudio</filename> file (in the kernel
1296   tree, not <application>MPlayer</application>'s) for some instructions on using
1297   this driver.
1298 </para></listitem>
1299 <listitem><para>
1300   If <application>MEncoder</application> cannot open the audio device, make
1301   sure that it is really available. There can be some trouble with the sound
1302   servers like aRts (KDE) or ESD (GNOME). If you have a full duplex sound card
1303   (almost any decent card supports it today), and you are using KDE, try to
1304   check the "full duplex" option in the sound server preference menu.
1305 </para></listitem>
1306 </itemizedlist>
1307 </para>
1308 </sect2>
1310 <sect2 id="tv-examples">
1311 <title>Examples</title>
1313 <informalexample><para>
1314 Dummy output, to AAlib :)
1315 <screen>mplayer -tv driver=dummy:width=640:height=480 -vo aa tv://</screen>
1316 </para></informalexample>
1318 <informalexample><para>
1319 Input from standard V4L:
1320 <screen>
1321 mplayer -tv driver=v4l:width=640:height=480:outfmt=i420 -vc rawi420 -vo xv tv://
1322 </screen>
1323 </para></informalexample>
1325 <informalexample><para>
1326 A more sophisticated example. This makes <application>MEncoder</application>
1327 capture the full PAL image, crop the margins, and deinterlace the picture
1328 using a linear blend algorithm. Audio is compressed with a constant bitrate
1329 of 64kbps, using LAME codec. This setup is suitable for capturing movies.
1330 <screen>
1331 mencoder -tv driver=v4l:width=768:height=576 -oac mp3lame -lameopts cbr:br=64\
1332     -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 \
1333     -vf crop=720:544:24:16,pp=lb -o <replaceable>output.avi</replaceable> tv://
1334 </screen>
1335 </para></informalexample>
1337 <informalexample><para>
1338 This will additionally rescale the image to 384x288 and compresses the
1339 video with the bitrate of 350kbps in high quality mode. The vqmax option
1340 looses the quantizer and allows the video compressor to actually reach so
1341 low bitrate even at the expense of the quality. This can be used for
1342 capturing long TV series, where the video quality isn't so important.
1343 <screen>
1344 mencoder -tv driver=v4l:width=768:height=576 \
1345     -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350:vhq:vqmax=31:keyint=300 \
1346     -oac mp3lame -lameopts cbr:br=48 -sws 1 -o <replaceable>output.avi</replaceable>\
1347     -vf crop=720:540:24:18,pp=lb,scale=384:288 tv://
1348 </screen>
1349 It's also possible to specify smaller image dimensions in the
1350 <option>-tv</option> option and omit the software scaling but this approach
1351 uses the maximum available information and is a little more resistant to noise.
1352 The bt8x8 chips can do the pixel averaging only in the horizontal direction due
1353 to a hardware limitation.
1354 </para></informalexample>
1355 </sect2>
1356 </sect1>
1358 <!-- ********** -->
1360 <sect1 id="tv-teletext">
1361 <title>Teletext</title>
1363 <para>
1364   Teletext is currently available only in <application>MPlayer</application>
1365   for v4l and v4l2 drivers.
1366 </para>
1368 <sect2 id="tv-teletext-implementation-notes">
1369 <title>Implementation notes</title>
1371 <para>
1372 <application>MPlayer</application> supports regular text, graphics and navigation links.
1373 Unfortunately, colored pages are not fully supported yet - all pages are shown as grayscaled.
1374 Subtitle pages (also known as Closed Captions) are supported, too.
1375 </para>
1377 <para>
1378 <application>MPlayer</application> starts caching all teletext pages upon
1379 starting to receive TV input, so you do not need to wait until the requested page is loaded.
1380 </para>
1382 <para>
1383 Note: Using teletext with <option>-vo xv</option> causes strange colors.
1384 </para>
1385 </sect2>
1387 <sect2 id="tv-teletext-usage">
1388 <title>Using teletext</title>
1390 <para>
1391 To enable teletext decoding you must specify the VBI device to get teletext data
1392 from (usually <filename>/dev/vbi0</filename> for Linux). This can be done by specifying
1393 <option>tdevice</option> in your configuration file, like shown below:
1394 <screen>tv=tdevice=/dev/vbi0</screen>
1395 </para>
1397 <para>
1398 You might need to specify the teletext language code for your country.
1399 To list all available country codes use
1400 <screen>tv=tdevice=/dev/vbi0:tlang=<replaceable>-1</replaceable></screen>
1401 Here is an example for Russian:
1402 <screen>tv=tdevice=/dev/vbi0:tlang=<replaceable>33</replaceable></screen>
1403 </para>
1404 </sect2>
1406 </sect1>
1408 <!-- ********** -->
1410 <sect1 id="radio">
1411 <title>Radio</title>
1413 <para>
1414 This section is about how to enable listening to radio from
1415 a V4L-compatible radio tuner. See the man page for a
1416 description of radio options and keyboard controls.
1417 </para>
1419 <!-- ********** -->
1421 <sect2 id="radio-tips">
1422 <title>Usage tips</title>
1424 <para>
1425 The full listing of the options is available in the manual page.
1426 Here are just a few tips:
1428 <itemizedlist>
1429 <listitem><para>
1430   Make sure your tuner works with another radio software in Linux, for
1431   example <application>XawTV</application>.
1432 </para></listitem>
1433 <listitem><para>
1434   Use the <option>channels</option> option. An example:
1435   <screen>-radio channels=104.4-Sibir,103.9-Maximum</screen>
1436   Explanation: With this option, only the 104.4 and 103.9 radio stations
1437   will be usable. There will be a nice OSD text upon channel switching,
1438   displaying the channel's name. Spaces in the channel name must be
1439   replaced by the "_" character.
1440 </para></listitem>
1441 <listitem><para>
1442   There are several ways of capturing audio. You can grab the sound either using
1443   your sound card via an external cable connection between video card and
1444   line-in, or using the built-in ADC in the saa7134 chip. In the latter case,
1445   you have to load the <systemitem>saa7134-alsa</systemitem> or
1446   <systemitem>saa7134-oss</systemitem> driver.
1447 </para></listitem>
1448 <listitem><para>
1449   <application>MEncoder</application> cannot be used for audio capture,
1450   because it requires a video stream to work. So your can either use
1451   <application>arecord</application> from ALSA project or
1452   use <option>-ao pcm:file=file.wav</option>. In the latter case you
1453   will not hear any sound (unless you are using a line-in cable and
1454   have switched line-in mute off).
1455 </para></listitem>
1456 </itemizedlist>
1457 </para>
1458 </sect2>
1460 <!-- ********** -->
1462 <sect2 id="radio-examples">
1463 <title>Examples</title>
1465 <informalexample><para>
1466 Input from standard V4L (using line-in cable, capture switched off):
1467 <screen>mplayer radio://104.4</screen>
1468 </para></informalexample>
1470 <informalexample><para>
1471 Input from standard V4L (using line-in cable, capture switched off,
1472 V4Lv1 interface):
1473 <screen>mplayer -radio driver=v4l radio://104.4</screen>
1474 </para></informalexample>
1476 <informalexample><para>
1477 Playing second channel from channel list:
1478 <screen>mplayer -radio channels=104.4=Sibir,103.9=Maximm radio://2</screen>
1479 </para></informalexample>
1481 <informalexample>
1482 <para>
1483 Passing sound over the PCI bus from the radio card's internal ADC.
1484 In this example the tuner is used as a second sound card
1485 (ALSA device hw:1,0). For saa7134-based cards either the
1486 <systemitem>saa7134-alsa</systemitem> or <systemitem>saa7134-oss</systemitem>
1487 module must be loaded.
1488 <screen>
1489 mplayer -rawaudio rate=32000 radio://2/capture \
1490     -radio adevice=hw=1.0:arate=32000:channels=104.4=Sibir,103.9=Maximm
1491 </screen>
1492 <note><para>
1493 When using ALSA device names colons must be replaced
1494 by equal signs, commas by periods.
1495 </para></note>
1496 </para>
1497 </informalexample>
1498 </sect2>
1500 </sect1>
1501 </chapter>