comparison DOCS/xml/en/audio.xml @ 9675:62c5a17038ba

XML version of MPlayer's doc
author nicolas
date Sun, 23 Mar 2003 23:35:12 +0000
parents
children a570a78537aa
comparison
equal deleted inserted replaced
9674:461f71ba8af4 9675:62c5a17038ba
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <sect2 id="audio-dev">
3 <title>Audio output devices</title>
4 <sect3 id="sync">
5 <title>Audio/Video synchronisation</title>
6
7 <para>
8 <application>MPlayer</application>'s audio interface is called
9 <emphasis>libao2</emphasis>. It currently contains these drivers:
10 </para>
11
12 <informaltable>
13 <tgroup cols="2">
14 <thead>
15 <row><entry>Driver</entry><entry>Comment</entry></row>
16 </thead>
17 <tbody>
18 <row><entry>oss</entry><entry>
19 OSS (ioctl) driver (supports hardware AC3 passthrough)
20 </entry></row>
21 <row><entry>sdl</entry><entry>
22 SDL driver (supports sound daemons like <emphasis role="bold">ESD</emphasis>
23 and <emphasis role="bold">ARTS</emphasis>)
24 </entry></row>
25 <row><entry>nas</entry><entry>
26 NAS (Network Audio System) driver
27 </entry></row>
28 <row><entry>alsa5</entry><entry>
29 native ALSA 0.5 driver
30 </entry></row>
31 <row><entry>alsa9</entry><entry>
32 native ALSA 0.9 driver (supports hardware AC3 passthrough)
33 </entry></row>
34 <row><entry>sun</entry><entry>
35 SUN audio driver (<filename>/dev/audio</filename>) for BSD and Solaris8 users
36 </entry></row>
37 <row><entry>arts</entry><entry>
38 native ARTS driver (mostly for KDE users)
39 </entry></row>
40 <row><entry>esd</entry><entry>
41 native ESD driver (mostly for GNOME users)
42 </entry></row>
43 </tbody>
44 </tgroup>
45 </informaltable>
46
47 <para>
48 Linux sound card drivers have compatibility problems. This is because
49 <application>MPlayer</application> relies on an in-built feature of
50 <emphasis>properly</emphasis> coded sound drivers that enable them to
51 maintain correct audio/video sync. Regrettably, some driver authors
52 don't take the care to code this feature since it is not needed for
53 playing MP3s or sound effects.
54 </para>
55
56 <para>
57 Other media players like <ulink url="http://avifile.sourceforge.net">aviplay</ulink>
58 or <ulink url="http://xine.sourceforge.net">xine</ulink> possibly work
59 out-of-the-box with these drivers because they use "simple" methods
60 with internal timing. Measuring showed that their methods are not as
61 efficient as <application>MPlayer</application>'s.
62 </para>
63
64 <para>
65 Using <application>MPlayer</application> with a properly written audio
66 driver will never result in A/V desyncs related to the audio, except
67 only with very badly created files (check the man page for workarounds).
68 </para>
69
70 <para>
71 If you happen to have a bad audio driver, try the <option>-autosync</option>
72 option, it should sort out your problems. See the man page for detailed
73 information.
74 </para>
75
76 <itemizedlist>
77 <title>Some notes:</title>
78 <listitem><para>
79 If you have an OSS driver, first try <option>-ao oss</option> (this is
80 the default). If you experience glitches, halts or anything out of the
81 ordinary, try <option>-ao sdl</option> (NOTE: you need to have SDL libraries
82 and header files installed). The SDL audio driver helps in a lot of cases
83 and also supports ESD (GNOME) and ARTS (KDE).
84 </para></listitem>
85 <listitem><para>
86 If you have ALSA version 0.5, then you almost always have to use
87 <option>-ao alsa5</option>, since ALSA 0.5 has buggy OSS emulation code,
88 and will <emphasis role="bold">crash <application>MPlayer</application></emphasis>
89 with a message like this:
90 <screen>
91 DEMUXER: Too many (945 in 8390980 bytes) video packets in the buffer!<!--
92 --></screen>
93 </para></listitem>
94 <listitem><para>
95 On Solaris, use the SUN audio driver with the <option>-ao sun</option> option,
96 otherwise neither video nor audio will work.
97 </para></listitem>
98 <listitem><para>
99 If the sound clicks when playing from CD-ROM, turn on IRQ unmasking, e.g.
100 <command>hdparm -u1 /dev/cdrom</command> (<command>man hdparm</command>).
101 This is generally beneficial and described in more detail in the
102 <link linkend="drives">CD-ROM section</link>.
103 </para></listitem>
104 </itemizedlist>
105 </sect3>
106
107 <sect3 id="experiences">
108 <title>Soundcard experiences, recommendations</title>
109 <para>
110 On Linux, a 2.4.x kernel is highly recommended. Kernel 2.2 is not tested.
111 </para>
112
113 <para>
114 Linux sound drivers are primarily provided by the free version of OSS.
115 These drivers have been superceded by <ulink url="http://www.alsa-project.org">ALSA</ulink>
116 (Advanced Linux Sound Architecture) in the 2.5 development series. If
117 your distribution does not already use ALSA you may wish to try their
118 drivers if you experience sound problems. ALSA drivers are generally
119 superior to OSS in compatibility, performance and features. But some
120 sound cards are only supported by the commercial OSS drivers from
121 <ulink url="http://www.opensound.com/">4Front Technologies</ulink>.
122 They also support several non-Linux systems.
123 </para>
124
125 <informaltable>
126 <tgroup cols="8">
127 <colspec colname="c1"/>
128 <colspec colname="c2"/>
129 <colspec colname="c3"/>
130 <colspec colname="c4"/>
131 <colspec colname="c5"/>
132 <colspec colname="c6"/>
133 <colspec colname="c7"/>
134 <colspec colname="c8"/>
135 <spanspec spanname="driver" namest="c2" nameend="c5"/>
136 <spanspec spanname="ossfree" namest="c2" nameend="c2"/>
137 <spanspec spanname="alsa" namest="c3" nameend="c3"/>
138 <spanspec spanname="osspro" namest="c4" nameend="c4"/>
139 <spanspec spanname="others" namest="c5" nameend="c5"/>
140 <thead>
141 <row>
142 <entry morerows="2" valign="middle">SOUND CARD</entry>
143 <entry spanname="driver">DRIVER</entry>
144 <entry morerows="2" valign="middle">Max kHz</entry>
145 <entry morerows="2" valign="middle">Max Channels</entry>
146 <entry morerows="2" valign="middle">Max Opens
147 <footnote id="maxopens">
148 <para>the number of applications that are able to use
149 the device <emphasis>at the same time</emphasis>.</para>
150 </footnote>
151 </entry>
152 </row>
153
154 <row>
155 <entry spanname="ossfree">OSS/Free</entry>
156 <entry spanname="alsa">ALSA</entry>
157 <entry spanname="osspro">OSS/Pro</entry>
158 <entry spanname="others">other</entry>
159 </row>
160 </thead>
161
162 <tbody>
163 <row>
164 <entry>VIA onboard (686/A/B, 8233, 8235)</entry>
165 <entry>
166 <ulink url="http://sourceforge.net/project/showfiles.php?group_id=3242&amp;release_id=59602">via82cxxx_audio</ulink>
167 </entry>
168 <entry>snd-via82xx</entry>
169 <entry></entry>
170 <entry></entry>
171 <entry>4-48 kHz or 48 kHz only, depending on the chipset</entry>
172 <entry></entry>
173 <entry></entry>
174 </row>
175
176 <row>
177 <entry>Aureal Vortex 2</entry>
178 <entry>none</entry>
179 <entry>none</entry>
180 <entry>OK</entry>
181 <entry>
182 <ulink url="http://aureal.sourceforge.net">Linux Aureal Drivers</ulink>
183 <ulink url="http://makacs.poliod.hu/~pontscho/aureal/au88xx-1.1.3.tar.bz2">buffer size increased to 32k</ulink>
184 </entry>
185 <entry>48</entry>
186 <entry>4.1</entry>
187 <entry>5+</entry>
188 </row>
189
190 <row>
191 <entry>SB Live!</entry>
192 <entry>Analog OK, SP/DIF not working</entry>
193 <entry>Both OK</entry>
194 <entry>Both OK</entry>
195 <entry>
196 <ulink url="http://opensource.creative.com">Creative's OSS driver (SP/DIF support)</ulink>
197 </entry>
198 <entry>192</entry>
199 <entry>4.0/5.1</entry>
200 <entry>32</entry>
201 </row>
202
203 <row>
204 <entry>SB 128 PCI (es1371)</entry>
205 <entry>OK</entry>
206 <entry>?</entry>
207 <entry></entry>
208 <entry></entry>
209 <entry>48</entry>
210 <entry>stereo</entry>
211 <entry>2</entry>
212 </row>
213
214 <row>
215 <entry>SB AWE 64</entry>
216 <entry>max 44kHz</entry>
217 <entry>48kHz sounds bad</entry>
218 <entry></entry>
219 <entry></entry>
220 <entry>48</entry>
221 <entry></entry>
222 <entry></entry>
223 </row>
224
225 <row>
226 <entry>GUS PnP</entry>
227 <entry>none</entry>
228 <entry>OK</entry>
229 <entry>OK</entry>
230 <entry></entry>
231 <entry>48</entry>
232 <entry></entry>
233 <entry></entry>
234 </row>
235
236 <row>
237 <entry>Gravis UltraSound ACE</entry>
238 <entry></entry>
239 <entry></entry>
240 <entry></entry>
241 <entry></entry>
242 <entry></entry>
243 <entry></entry>
244 <entry></entry>
245 </row>
246
247 <row>
248 <entry>Gravis UltraSound MAX</entry>
249 <entry>OK</entry>
250 <entry>OK (?)</entry>
251 <entry></entry>
252 <entry></entry>
253 <entry>48</entry>
254 <entry></entry>
255 <entry></entry>
256 </row>
257
258 <row>
259 <entry>ESS 688</entry>
260 <entry>OK</entry>
261 <entry>OK (?)</entry>
262 <entry></entry>
263 <entry></entry>
264 <entry>48</entry>
265 <entry></entry>
266 <entry></entry>
267 </row>
268
269 <row>
270 <entry>C-Media cards (which ones?)</entry>
271 <entry>not OK (hissing) (?)</entry>
272 <entry>OK</entry>
273 <entry></entry>
274 <entry></entry>
275 <entry>?</entry>
276 <entry></entry>
277 <entry></entry>
278 </row>
279
280 <row>
281 <entry>Yamaha cards (*ymf*)</entry>
282 <entry>not OK (?) (maybe <option>-ao sdl</option>)</entry>
283 <entry>OK only with ALSA 0.5 with OSS emulation
284 <emphasis role="bold">AND</emphasis> <option>-ao sdl</option> (!) (?)</entry>
285 <entry></entry>
286 <entry></entry>
287 <entry></entry>
288 <entry></entry>
289 <entry></entry>
290 </row>
291
292 <row>
293 <entry>Cards with envy24 chips (like Terratec EWS88MT)</entry>
294 <entry>?</entry>
295 <entry>?</entry>
296 <entry>OK</entry>
297 <entry></entry>
298 <entry>?</entry>
299 <entry></entry>
300 <entry></entry>
301 </row>
302
303 <row>
304 <entry>PC Speaker or DAC</entry>
305 <entry>OK</entry>
306 <entry>none</entry>
307 <entry></entry>
308 <entry>
309 <ulink url="http://www.geocities.com/stssppnn/pcsp.html">Linux PC speaker OSS driver</ulink>
310 </entry>
311 <entry>The driver emulates 44.1, maybe more.</entry>
312 <entry>mono</entry>
313 <entry>1</entry>
314 </row>
315
316 </tbody>
317 </tgroup>
318 </informaltable>
319
320 <para>
321 Feedback to this document is welcome. Please tell us how
322 <application>MPlayer</application> and your sound card(s) worked together.
323 </para>
324 </sect3>
325
326 <sect3 id="af">
327 <title>Audio filters</title>
328 <para>
329 The old audio plugins have been superseded by a new audio filter layer. Audio
330 filters are used for changing the properties of the audio data before the
331 sound reaches the sound card. The activation and deactivation of the filters
332 is normally automated but can be overridden. The filters are activated when
333 the properties of the audio data differ from those required by the sound card
334 and deactivated if unnecessary. The <option>-af filter1,filter2,...</option>
335 option is used to override the automatic activation of filters or to insert
336 filters that are not automatically inserted. The filters will be executed as
337 they appear in the comma separated list.
338 </para>
339
340 <para>
341 Example:
342 <screen>mplayer -af resample,pan movie.avi</screen>
343 would run the sound through the resampling filter followed by the pan filter.
344 Observe that the list must not contain any spaces, else it will fail.
345 </para>
346
347 <para>
348 The filters often have options that change their behavior. These options
349 are explained in detail in the sections below. A filter will execute using
350 default settings if its options are omitted. Here is an example of how to use
351 filters in combination with filter specific options:
352 <screen>mplayer -af resample=11025,pan=1:0.5:0.5 -channels 1 -srate 11025 media.avi</screen>
353 would set the output frequency of the resample filter to 11025Hz and downmix
354 the audio to 1 channel using the pan filter.
355 </para>
356
357
358 <para>
359 The overall execution of the filter layer is controlled using the
360 <option>-af-adv</option> option. This option has two suboptions:
361 </para>
362
363 <para>
364 <option>force</option> is a bit field that controls how the filters
365 are inserted and what speed/accuracy optimizations they use:
366 </para>
367
368 <variablelist>
369 <varlistentry>
370 <term><option>0</option></term>
371 <listitem><para>
372 Use automatic insertion of filters and optimize according to CPU speed.
373 </para></listitem>
374 </varlistentry>
375
376 <varlistentry>
377 <term><option>1</option></term>
378 <listitem><para>
379 Use automatic insertion of filters and optimize for the highest speed.
380 <emphasis>Warning:</emphasis> Some features in the audio filters may
381 silently fail, and the sound quality may drop.
382 </para></listitem>
383 </varlistentry>
384
385 <varlistentry>
386 <term><option>2</option></term>
387 <listitem><para>
388 Use automatic insertion of filters and optimize for quality.
389 </para></listitem>
390 </varlistentry>
391
392 <varlistentry>
393 <term><option>3</option></term>
394 <listitem><para>
395 Use no automatic insertion of filters and no optimization.
396 <emphasis>Warning:</emphasis> It may be possible to crash MPlayer
397 using this setting.
398 </para></listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term><option>4</option></term>
403 <listitem><para>
404 Use automatic insertion of filters according to 0 above,
405 but use floating point processing when possible.
406 </para></listitem>
407 </varlistentry>
408
409 <varlistentry>
410 <term><option>5</option></term>
411 <listitem><para>
412 Use automatic insertion of filters according to 1 above,
413 but use floating point processing when possible.
414 </para></listitem>
415 </varlistentry>
416
417 <varlistentry>
418 <term><option>6</option></term>
419 <listitem><para>
420 Use automatic insertion of filters according to 2 above,
421 but use floating point processing when possible.
422 </para></listitem>
423 </varlistentry>
424
425 <varlistentry>
426 <term><option>7</option></term>
427 <listitem><para>
428 Use no automatic insertion of filters according to 3 above,
429 and use floating point processing when possible.
430 </para></listitem>
431 </varlistentry>
432 </variablelist>
433
434 <para>
435 <option>list</option> is an alias for the -af option.
436 </para>
437
438 <para>
439 The filter layer is also affected by the following generic options:
440 </para>
441
442 <variablelist>
443 <varlistentry>
444 <term><option>-v</option></term>
445 <listitem><para>
446 Increases the verbosity level and makes most filters print out extra
447 status messages.
448 </para></listitem>
449 </varlistentry>
450
451 <varlistentry>
452 <term><option>-channels</option></term>
453 <listitem><para>
454 This option sets the number of output channels you would like your
455 sound card to use. It also affects the number of channels that are
456 being decoded from the media. If the media contains less channels
457 than requested the channels filter (see below) will automatically
458 be inserted. The routing will be the default routing for the channels
459 filter.
460 </para></listitem>
461 </varlistentry>
462
463 <varlistentry>
464 <term><option>-srate</option></term>
465 <listitem><para>
466 This option selects the sample rate you would like your sound card
467 to use (of course the cards have limits on this). If the sample frequency
468 of your sound card is different from that of the current media, the resample
469 filter (see below) will be inserted into the audio filter layer to compensate
470 for the difference.
471 </para></listitem>
472 </varlistentry>
473 <varlistentry>
474 <term><option>-format</option></term>
475 <listitem><para>
476 This option sets the sample format between the audio filter layer and the
477 sound card. If the requested sample format of your sound card is different
478 from that of the current media, a format filter (see below) will be inserted
479 to rectify the difference.
480 </para></listitem>
481 </varlistentry>
482 </variablelist>
483
484 <sect4 id="af_resample">
485 <title>Up/Downsampling</title>
486
487 <para>
488 MPlayer fully supports sound up/down-sampling through the
489 <systemitem>resample</systemitem> filter. It can be used if you
490 have a fixed frequency sound card or if you are stuck with an old sound card
491 that is only capable of max 44.1kHz. This filter is automatically enabled if
492 it is necessary, but it can also be explicitly enabled on the command line. It
493 has three options:
494 </para>
495
496 <variablelist>
497 <varlistentry>
498 <term><option>srate &lt;8000-192000&gt;</option></term>
499 <listitem><para>
500 is an integer used for setting the output sample
501 frequency in Hz. The valid range for this parameter is 8kHz to 192kHz. If
502 the input and output sample frequency are the same or if this parameter is
503 omitted the filter is automatically unloaded. A high sample frequency
504 normally improves the audio quality, especially when used in combination
505 with other filters.
506 </para></listitem>
507 </varlistentry>
508
509 <varlistentry>
510 <term><option>sloppy</option></term>
511 <listitem><para>
512 is an optional binary parameter that allows the output frequency to differ
513 slightly from the frequency given by <option>srate</option>. This option
514 can be used if the startup of the playback is extremely slow. It is enabled
515 by default.
516 </para></listitem>
517 </varlistentry>
518
519 <varlistentry>
520 <term><option>type &lt;0-2&gt;</option></term>
521 <listitem><para>
522 is an optional integer between <literal>0</literal> and <literal>2</literal> that
523 selects which resampling method to use. Here <literal>0</literal> represents
524 linear interpolation as resampling method, <literal>1</literal> represents
525 resampling using a poly-phase filter-bank and integer processing and
526 <literal>2</literal> represents resampling using a poly-phase filter-bank and
527 floating point processing. Linear interpolation is extremely fast, but
528 suffers from poor sound quality especially when used for up-sampling. The
529 best quality is given by <literal>2</literal> but this method also suffers from
530 the highest CPU load.
531 </para></listitem>
532 </varlistentry>
533 </variablelist>
534
535 <para>Example:
536 <screen>mplayer -af resample=44100:0:0</screen>
537 would set the output frequency of the resample filter to 44100Hz using exact output
538 frequency scaling and linear interpolation.
539 </para>
540 </sect4>
541
542 <sect4 id="af_channels">
543 <title>Changing the number of channels</title>
544 <para>
545 The <option>channels</option> filter can be used for adding and removing
546 channels, it can also be used for routing or copying channels. It is
547 automatically enabled when the output from the audio filter layer differs from
548 the input layer or when it is requested by another filter. This filter unloads
549 itself if not needed. The number of options is dynamic:
550 </para>
551
552 <variablelist>
553 <varlistentry>
554 <term><option>nch &lt;1-6&gt;</option></term>
555 <listitem><para>
556 is an integer between <literal>1</literal> and <literal>6</literal> that is used
557 for setting the number of output channels. This option is required, leaving it
558 empty results in a runtime error.
559 </para></listitem>
560 </varlistentry>
561
562 <varlistentry>
563 <term><option>nr &lt;1-6&gt;</option></term>
564 <listitem><para>
565 is an integer between <literal>1</literal> and <literal>6</literal> that is used
566 for specifying the number of routes. This parameter is optional. If it is
567 omitted the default routing is used.
568 </para></listitem>
569 </varlistentry>
570
571 <varlistentry>
572 <term><option>from1:to1:from2:to2:from3:to3...</option></term>
573 <listitem><para>
574 are pairs of numbers between <literal>0</literal> and <literal>5</literal>
575 that define where each channel should be routed.
576 </para></listitem>
577 </varlistentry>
578 </variablelist>
579
580 <para>
581 If only <option>nch</option> is given the default routing is used, it works
582 as follows: If the number of output channels is bigger than the number of input
583 channels empty channels are inserted (except mixing from mono to stereo, then
584 the mono channel is repeated in both of the output channels). If the number of
585 output channels is smaller than the number of input channels the exceeding
586 channels are truncated.
587 </para>
588
589 <para>
590 Example 1:
591 <screen>mplayer -af channels=4:4:0:1:1:0:2:2:3:3 media.avi</screen>
592 would change the number of channels to 4 and set up 4 routes that swap
593 channel 0 and channel 1 and leave channel 2 and 3 intact. Observe that
594 if media containing two channels was played back, channels 2 and 3 would
595 contain silence but 0 and 1 would still be swapped.
596 </para>
597
598 <para>
599 Exemple 2:
600 <screen>mplayer -af channels=6:4:0:0:0:1:0:2:0:3 media.avi</screen>
601 would change the number of channels to 6 and set up 4 routes that copy
602 channel 0 to channels 0 to 3. Channel 4 and 5 will contain silence.
603 </para>
604 </sect4>
605
606 <sect4 id="af_format">
607 <title>Sample format converter</title>
608 <para>
609 The <option>format</option> filter converts between different sample formats. It
610 is automatically enabled when needed by the sound card or another filter.
611 </para>
612
613 <variablelist>
614 <varlistentry>
615 <term><option>bps &lt;number&gt;</option></term>
616 <listitem><para>
617 can be <literal>1</literal>, <literal>2</literal> or <literal>4</literal> and
618 denotes the number of bytes per sample. This option is required, leaving it empty
619 results in a runtime error.
620 </para></listitem>
621 </varlistentry>
622
623 <varlistentry>
624 <term><option>f &lt;format&gt;</option></term>
625 <listitem><para>
626 is a text string describing the sample format. The string is a
627 concatenated mix of: <option>alaw</option>, <option>mulaw</option> or
628 <option>imaadpcm</option>, <option>float</option> or <option>int</option>,
629 <option>unsigned</option> or <option>signed</option>, <option>le</option> or
630 <option>be</option> (little or big endian). This option is required,
631 leaving it empty results in a runtime error.
632 </para></listitem>
633 </varlistentry>
634 </variablelist>
635
636 <para>
637 Example:
638 <screen>mplayer -af format=4:float media.avi</screen>
639 would set the output format to 4 bytes per sample floating point data.
640 </para>
641 </sect4>
642
643 <sect4 id="af_delay">
644 <title>Delay</title>
645 <para>
646 The <option>delay</option> filter delays the sound to the loudspeakers such that
647 the sound from the different channels arrives at the listening position
648 simultaneously.
649 It is only useful if you have more than 2 loudspeakers. This filter has a
650 variable number of parameters:
651 </para>
652
653 <variablelist>
654 <varlistentry>
655 <term><option>d1:d2:d3...</option></term>
656 <listitem><para>
657 are floating point numbers representing the delays in ms that should be
658 imposed on the different channels. The minimum delay is 0ms and the maximum
659 is 1000ms.
660 </para></listitem>
661 </varlistentry>
662 </variablelist>
663
664 <para>
665 To calculate the required delay for the different channels do as follows:
666 </para>
667
668 <orderedlist>
669 <listitem><para>
670 Measure the distance to the loudspeakers in meters in relation to your
671 listening position, giving you the distances s1 to s5 (for a 5.1 system).
672 There is no point in compensating for the sub-woofer (you will not hear the
673 difference anyway).
674 </para></listitem>
675 <listitem><para>
676 Subtract the distances s1 to s5 from the maximum distance i.e.
677 s[i] = max(s) - s[i]; i = 1...5
678 </para></listitem>
679 <listitem><para>
680 alculated the required delays in ms as
681 d[i] = 1000*s[i]/342; i = 1...5
682 s[i] = max(s) - s[i]; i = 1...5
683 </para></listitem>
684 </orderedlist>
685
686 <para>
687 Example:
688 <screen>mplayer -af delay=10.5:10.5:0:0:7:0 media.avi</screen>
689 would delay front left and right by 10.5ms, the two rear channels and the sub
690 by 0ms and the center channel by 7ms.
691 </para>
692
693 </sect4>
694
695 <sect4 id="af_volume">
696 <title>Software volume control</title>
697 <para>Software volume control is implemented by the <option>volume</option>
698 audio filter. Use this filter with caution since it can reduce the signal to
699 noise ratio of the sound. In most cases it is best to set the level for the
700 PCM sound to max, leave this filter out and control the output level to your
701 speakers with the master volume control of the mixer. In case your sound card
702 has a digital PCM mixer instead of an analog one, and you hear distortion,
703 use the MASTER mixer instead. If there is an external amplifier connected to
704 the computer (this is almost always the case), the noise level can be minimized
705 by adjusting the master level and the volume knob on the amplifier until the
706 hissing noise in the background is gone. This filter has two options:
707 </para>
708
709 <variablelist>
710 <varlistentry>
711 <term><option>v &lt;-200 - +60&gt;</option></term>
712 <listitem><para>
713 is a floating point number between <literal>-200</literal> and <literal>+60</literal>
714 which represents the volume level in dB. The default level is 0dB.
715 </para></listitem>
716 </varlistentry>
717
718 <varlistentry>
719 <term><option>c</option></term>
720 <listitem><para>
721 is a binary control that turns soft clipping on and off. Soft-clipping can
722 make the sound more smooth if very high volume levels are used. Enable this
723 option if the dynamic range of the loudspeakers is very low. Be aware that
724 this feature creates distortion and should be considered a last resort.
725 </para></listitem>
726 </varlistentry>
727 </variablelist>
728
729 <para>
730 Example:
731 <screen>mplayer -af volume=10.1:0 media.avi</screen>
732 would amplify the sound by 10.1dB and hard-clip if the sound level is too high.
733 </para>
734
735 <para>
736 This filter has a second feature: It measures the overall maximum sound level
737 and prints out that level when MPlayer exits. This volume estimate can be used
738 for setting the sound level in MEncoder such that the maximum dynamic range is
739 utilized.
740 </para>
741 </sect4>
742
743 <sect4 id="af_equalizer">
744 <title>Equalizer</title>
745 <para>
746 The <option>equalizer</option> filter represents a 10 octave band graphic
747 equalizer, implemented using 10 IIR band pass filters. This means that
748 it works regardless of what type of audio is being played back. The center
749 frequencies for the 10 bands are:
750 </para>
751
752 <informaltable>
753 <tgroup cols="2">
754 <thead>
755 <row>
756 <entry>Band No.</entry><entry>Center frequency</entry>
757 </row>
758 </thead>
759 <tbody>
760 <row><entry>0</entry><entry>31.25 Hz</entry></row>
761 <row><entry>1</entry><entry>62.50 Hz</entry></row>
762 <row><entry>2</entry><entry>125.0 Hz</entry></row>
763 <row><entry>3</entry><entry>250.0 Hz</entry></row>
764 <row><entry>4</entry><entry>500.0 Hz</entry></row>
765 <row><entry>5</entry><entry>1.000 kHz</entry></row>
766 <row><entry>6</entry><entry>2.000 kHz</entry></row>
767 <row><entry>7</entry><entry>4.000 kHz</entry></row>
768 <row><entry>8</entry><entry>8.000 kHz</entry></row>
769 <row><entry>9</entry><entry>16.00 kHz</entry></row>
770 </tbody>
771 </tgroup>
772 </informaltable>
773
774 <para>
775 If the sample rate of the sound being played back is lower than the center
776 frequency for a frequency band, then that band will be disabled. A known
777 bug with this filter is that the characteristics for the uppermost band
778 are not completely symmetric if the sample rate is close to the center
779 frequency of that band. This problem can be worked around by up-sampling
780 the sound using the resample filter before it reaches this filter.
781 </para>
782
783 <para>
784 This filter has 10 parameters:
785 </para>
786
787 <variablelist>
788 <varlistentry>
789 <term><option>g1:g2:g3...g10</option></term>
790 <listitem><para>
791 are floating point numbers between <literal>-12</literal> and <literal>+12</literal>
792 representing the gain in dB for each frequency band.
793 </para></listitem>
794 </varlistentry>
795 </variablelist>
796
797 <para>
798 Example:
799 <screen>mplayer -af equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi</screen>
800 would amplify the sound in the upper and lower frequency region while
801 canceling it almost completely around 1kHz.
802 </para>
803 </sect4>
804
805 <sect4 id="af_panning">
806 <title>Panning filter</title>
807 <para>
808 Use the <option>pan</option> filter to mix channels arbitrarily. It is
809 basically a combination of the volume control and the channels filter.
810 There are two major uses for this filter:
811 </para>
812
813 <orderedlist>
814 <listitem><para>
815 Down-mixing many channels to only a few, stereo to mono for example.
816 </para></listitem>
817 <listitem><para>
818 Varying the &quot;width&quot; of the center speaker in a surround sound system.
819 </para></listitem>
820 </orderedlist>
821
822 <para>
823 This filter is hard to use, and will require some tinkering before the
824 desired result is obtained. The number of options for this filter
825 depends on the number of output channels:
826 </para>
827
828 <variablelist>
829 <varlistentry>
830 <term><option>nch &lt;1-6&gt;</option></term>
831 <listitem><para>
832 is an integer between <literal>1</literal> and <literal>6</literal> and is used
833 for setting the number of output channels. This option is required, leaving it
834 empty results in a runtime error.
835 </para></listitem>
836 </varlistentry>
837
838 <varlistentry>
839 <term><option>l00:l01:l02:..l10:l11:l12:...ln0:ln1:ln2:...</option></term>
840 <listitem><para>
841 are floating point values between <literal>0</literal> and <literal>1</literal>.
842 <option>l[i][j]</option> determines how much of input channel j is mixed into
843 output channel i.
844 </para></listitem>
845 </varlistentry>
846 </variablelist>
847
848 <para>
849 Example 1:
850 <screen>mplayer -af pan=1:0.5:0.5 -channels 1 media.avi</screen>
851 would down-mix from stereo to mono.
852 </para>
853
854 <para>
855 Example 2:
856 <screen>mplayer -af pan=3:1:0:1:0.5:0.5 -channels 3 media.avi</screen>
857 would give 3 channel output leaving channels 0 and 1 intact, and mix
858 channels 0 and 1 into output channel 2 (which could be sent to a
859 sub-woofer for example).
860 </para>
861 </sect4>
862
863 <sect4 id="af_sub">
864 <title>Sub-woofer</title>
865 <para>
866 The <option>sub</option> filter adds a sub woofer channel to the audio
867 stream. The audio data used for creating the sub-woofer channel is an
868 average of the sound in channel 0 and channel 1. The resulting sound is
869 then low-pass filtered by a 4th order Butterworth filter with a default
870 cutoff frequency of 60Hz and added to a separate channel in the audio
871 stream. Warning: Disable this filter when you are playing DVDs with Dolby
872 Digital 5.1 sound, otherwise this filter will disrupt the sound to the
873 sub-woofer. This filter has two parameters:
874 </para>
875
876 <variablelist>
877 <varlistentry>
878 <term><option>fc &lt;20-300&gt;</option></term>
879 <listitem><para>
880 is an optional floating point number used for setting the cutoff frequency
881 for the filter in Hz. The valid range is 20Hz to 300Hz. For the best result
882 try setting the cutoff frequency as low as possible. This will improve the
883 stereo or surround sound experience. The default cutoff frequency is 60Hz.
884 </para></listitem>
885 </varlistentry>
886
887 <varlistentry>
888 <term><option>ch &lt;0-5&gt;</option></term>
889 <listitem><para>
890 is an optional integer between <literal>0</literal> and <literal>5</literal>
891 which determines the channel number in which to insert the sub-channel audio.
892 The default is channel number <literal>5</literal>. Observe that the number of
893 channels will automatically be increased to <replaceable>ch</replaceable> if
894 necessary.
895 </para></listitem>
896 </varlistentry>
897 </variablelist>
898
899 <para>
900 Example:
901 <screen>mplayer -af sub=100:4 -channels 5 media.avi</screen>
902 would add a sub-woofer channel with a cutoff frequency of
903 100Hz to output channel 4.
904 </para>
905 </sect4>
906
907 <sect4 id="af_surround">
908 <title>Surround-sound decoder</title>
909 <para>
910 Matrix encoded surround sound can be decoded by the <option>surround</option>
911 filter. Dolby Surround is an example of a matrix encoded format. Many files
912 with 2 channel audio actually contain matrixed surround sound. To use this
913 feature you need a sound card supporting at least 4 channels. This filter has
914 one parameter:
915 </para>
916
917 <variablelist>
918 <varlistentry>
919 <term><option>d &lt;0-1000&gt;</option></term>
920 <listitem><para>
921 is an optional floating point number between <literal>0</literal> and
922 <literal>1000</literal> used for setting the delay time in ms for the
923 rear speakers. This delay should be set as follows: if d1 is the distance
924 from the listening position to the front speakers and d2 is the distance
925 from the listening position to the rear speakers, then the delay d should
926 be set to 15ms if d1 &lt;= d2 and to 15 + 5*(d1-d2) if d1 &gt; d2. The default
927 value for d is 20ms.
928 </para></listitem>
929 </varlistentry>
930 </variablelist>
931
932 <para>
933 Example:
934 <screen>mplayer -af surround=15 -channels 4 media.avi</screen>
935 would add surround sound decoding with 15ms delay for the sound to the
936 rear speakers.
937 </para>
938 </sect4>
939 </sect3>
940
941 <sect3 id="audio-plugins">
942 <title>Audio plugins (deprecated)</title>
943 <note><para><emphasis role="bold">Audio plugins have been deprecated by audio filters and will
944 be removed soon.</emphasis></para></note>
945
946 <para>
947 <application>MPlayer</application> has support for audio plugins. Audio
948 plugins can be used for changing the properties of the audio data before
949 the sound reaches the sound card. They are enabled using the
950 <option>-aop</option> switch which takes a
951 <option>list=plugin1,plugin2,...</option> argument. The
952 <option>list</option> argument is required and determines which plugins
953 should be used and in which order they should be executed. Example:
954
955 <screen>mplayer media.avi -aop list=resample,format</screen>
956
957 would run the sound through the resampling plugin followed by the format
958 plugin.
959 </para>
960
961 <para>
962 The plugins can also have switches that change their behavior. These
963 switches are explained in detail in the sections below. A plugin will
964 execute using default settings if its switches are omitted. Here is an
965 example of how to use plugins in combination with plugin specific switches:
966
967 <screen>mplayer media.avi -aop list=resample,format:fout=44100:format=0x8</screen>
968
969 would set the output frequency of the resample plugin to 44100 Hz and the
970 output format of the format plugin to AFMT_U8.
971 </para>
972
973 <para>
974 Currently audio plugins can not be used in
975 <application>MEncoder</application>.
976 </para>
977
978
979 <sect4 id="updn-sampling">
980 <title>Up/Downsampling</title>
981
982 <para>
983 <application>MPlayer</application> fully supports up/downsampling of the sound. This plugin can be
984 used if you have a fixed frequency sound card or if you are stuck with an
985 old sound card that is only capable of max 44.1 kHz. Limitations in your
986 hardware are not auto detected, so you have to specify the sample frequency
987 explicitly. This plugin has one switch: <option>fout</option> which is used for setting the
988 desired output sample frequency. It defaults to 48 kHz, and is given in
989 Hz.
990 </para>
991
992 <para>
993 Usage:
994
995 <screen>
996 mplayer <replaceable>media.avi</replaceable> -aop list=resample:fout=<replaceable>freq</replaceable></screen>
997
998 where <literal><replaceable>freq</replaceable></literal> is the frequency
999 in Hz, like <literal>44100</literal>.
1000 </para>
1001
1002 <note>
1003 <para>
1004 The output frequency should not be scaled up from the default value.
1005 Scaling up will cause the audio and video streams to be played in slow
1006 motion in addition to audio distortion.
1007 </para>
1008 </note>
1009 </sect4>
1010
1011
1012 <sect4 id="surround-decode">
1013 <title>Surround Sound decoding</title>
1014
1015 <para>
1016 <application>MPlayer</application> has an audio plugin that can decode
1017 matrix encoded surround sound. Dolby Surround is an example of a matrix
1018 encoded format. Many files with 2 channel audio actually contain matrixed
1019 surround sound. To use this feature you need a sound card supporting at
1020 least 4 channels.
1021 </para>
1022
1023 <para>
1024 Usage:
1025 <screen>mplayer <replaceable>media.avi</replaceable> -aop list=surround</screen>
1026 </para>
1027 </sect4>
1028
1029
1030 <sect4 id="sample-format-conv">
1031 <title>Sample format converter</title>
1032
1033 <para>
1034 If your sound card driver does not support signed 16-bit int data type,
1035 this plugin can be used to change the format to one which your sound card
1036 can understand. It has one switch, <option>format</option>, which can be
1037 set to one of the numbers found in <filename>libao2/afmt.h</filename>. This
1038 plugin is hardly ever needed and is intended for advanced users. Keep in
1039 mind that this plugin only changes the sample format and not the sample
1040 frequency or the number of channels.
1041 </para>
1042
1043 <para>
1044 Usage:
1045
1046 <screen>
1047 mplayer <replaceable>media.avi</replaceable> -aop list=format:format=<replaceable>outfmt</replaceable></screen>
1048
1049 where <literal><replaceable>outfmt</replaceable></literal> is the
1050 required output format.
1051 </para>
1052 </sect4>
1053
1054
1055 <sect4 id="audio-delay">
1056 <title>Delay</title>
1057 <para>
1058 This plugin delays the sound and is intended as an example of how to
1059 develop new plugins. It can not be used for anything useful from a users
1060 perspective and is mentioned here for the sake of completeness only. Do not
1061 use this plugin unless you are a developer.
1062 </para>
1063 </sect4>
1064
1065
1066 <sect4 id="sw-volume">
1067 <title>Software volume control</title>
1068
1069 <para>
1070 This plugin is a software replacement for the volume control, and can be
1071 used on machines with a broken mixer device. It can also be used if one
1072 wants to change the output volume of <application>MPlayer</application>
1073 without changing the PCM volume setting in the mixer. It has one switch
1074 <option>volume</option> that is used for setting the initial sound level.
1075 The initial sound level can be set to values between 0 and 255 and defaults
1076 to 101 which equals 0dB amplification. Use this plugin with caution since
1077 it can reduce the signal to noise ratio of the sound. In most cases it is
1078 best to set the level for the PCM sound to max, leave this plugin out and
1079 control the output level to your speakers with the master volume control of
1080 the mixer. If there is an external amplifier connected to the computer
1081 (this is almost always the case), the noise level can be minimized by
1082 adjusting the master level and the volume knob on the amplifier until the
1083 hissing noise in the background is gone.
1084 </para>
1085
1086 <para>
1087 Usage:
1088 <screen>
1089 mplayer <replaceable>media.avi</replaceable> -aop list=volume:volume=<replaceable>0-255</replaceable></screen>
1090 </para>
1091
1092 <para>
1093 This plugin also has compressor or "soft-clipping" capabilities.
1094 Compression can be used if the dynamic range of the sound is very high or
1095 if the dynamic range of the loudspeakers is very low. Be aware that this
1096 feature creates distortion and should be considered a last resort.
1097 </para>
1098
1099 <para>
1100 Usage:
1101 <screen>
1102 mplayer <replaceable>media.avi</replaceable> -aop list=volume:softclip</screen>
1103 </para>
1104 </sect4>
1105
1106 <sect4 id="extrastereo">
1107 <title>Extrastereo</title>
1108
1109 <para>
1110 This plugin (linearly) increases the difference between left and right
1111 channels (like the XMMS extrastereo plugin) which gives some sort of "live"
1112 effect to playback.
1113 </para>
1114
1115 <para>
1116 Usage:
1117 <screen>
1118 mplayer <replaceable>media.avi</replaceable> -aop list=extrastereo
1119 mplayer <replaceable>media.avi</replaceable> -aop list=extrastereo:mul=3.45<!--
1120 --></screen>
1121
1122 The default coefficient (<option>mul</option>) is a float number that
1123 defaults to 2.5. If you set it to <literal>0.0</literal>, you will have
1124 mono sound (average of both channels). If you set it to
1125 <literal>1.0</literal>, sound will be unchanged, if you set it to
1126 <literal>-1.0</literal>, left and right channels will be swapped.
1127 </para>
1128 </sect4>
1129
1130
1131 <sect4 id="volnorm">
1132 <title>Volume normalizer</title>
1133
1134 <para>
1135 This plugin maximizes the volume without distorting the sound.
1136 </para>
1137
1138 <para>
1139 Usage:
1140 <screen>mplayer <replaceable>media.avi</replaceable> -aop list=volnorm</screen>
1141 </para>
1142 </sect4>
1143 </sect3>
1144 </sect2>