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