comparison DOCS/en/sound.html @ 9382:1b3444713694

Move English files to en/ subdirectory.
author diego
date Mon, 10 Feb 2003 00:00:00 +0000
parents DOCS/sound.html@e23939b2ac30
children 6c6ea2b4cfdb
comparison
equal deleted inserted replaced
9381:007a1bdce1f4 9382:1b3444713694
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML>
3
4 <HEAD>
5 <TITLE>Sound - MPlayer - The Movie Player for Linux</TITLE>
6 <LINK REL="stylesheet" TYPE="text/css" HREF="default.css">
7 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
8 </HEAD>
9
10 <BODY>
11
12
13 <H3><A NAME="audio">2.3.2 Audio output devices</A></H3>
14
15 <H4><A NAME="sync">2.3.2.1 Audio/Video synchronisation</A></H4>
16
17 <P>MPlayer's audio interface is called <I>libao2</I>. It currently
18 contains these drivers:</P>
19
20 <DL>
21 <DT>oss</DT>
22 <DD>OSS (ioctl) driver (supports hardware AC3 passthrough)</DD>
23
24 <DT>sdl</DT>
25 <DD>SDL driver (supports sound daemons like <B>ESD</B> and <B>ARTS</B>)</DD>
26
27 <DT>nas</DT>
28 <DD>NAS (Network Audio System) driver</DD>
29
30 <DT>alsa5</DT>
31 <DD>native ALSA 0.5 driver</DD>
32
33 <DT>alsa9</DT>
34 <DD>native ALSA 0.9 driver (supports hardware AC3 passthrough)</DD>
35
36 <DT>sun</DT>
37 <DD>SUN audio driver (<CODE>/dev/audio</CODE>) for BSD and Solaris8 users</DD>
38
39 <DT>arts</DT>
40 <DD>native ARTS driver (mostly for KDE users)</DD>
41
42 <DT>esd</DT>
43 <DD>native ESD driver (mostly for GNOME users)</DD>
44 </DL>
45
46 <P>Linux sound card drivers have compatibility problems. This is because MPlayer
47 relies on an in-built feature of <EM>properly</EM> coded sound drivers that
48 enable them to maintain correct audio/video sync. Regrettably, some driver
49 authors don't take the care to code this feature since it is not needed for
50 playing MP3s or sound effects. </P>
51
52 <P>Other media players like <A HREF="http://avifile.sourceforge.net">aviplay</A>
53 or <A HREF="http://xine.sourceforge.net">xine</A> possibly work
54 out-of-the-box with these drivers because they use "simple" methods with
55 internal timing. Measuring showed that their methods are not as efficient
56 as MPlayer's. </P>
57
58 <P>Using MPlayer with a properly written audio driver will never result
59 in A/V desyncs related to the audio, except only with very badly created
60 files (check the man page for workarounds).</P>
61
62 <P>If you happen to have a bad audio driver, try the <CODE>-autosync</CODE>
63 option, it should sort out your problems. See the man page for detailed
64 information.</P>
65
66 <P>Some notes:</P>
67
68 <UL>
69 <LI>If you have an OSS driver, first try <CODE>-ao oss</CODE> (this is the
70 default). If you experience glitches, halts or anything out of the
71 ordinary, try <CODE>-ao sdl</CODE> (NOTE: You need to have SDL libraries
72 and header files installed). The SDL audio driver helps in a lot of cases
73 and also supports ESD (GNOME) and ARTS (KDE).</LI>
74 <LI>If you have ALSA version 0.5, then you almost always have to use
75 <CODE>-ao alsa5</CODE> , since ALSA 0.5 has buggy OSS emulation code, and
76 will <B>crash MPlayer</B> with a message like this:<BR>
77 <CODE>DEMUXER: Too many (945 in 8390980 bytes) video packets in the buffer!</CODE></LI>
78 <LI>On Solaris, use the SUN audio driver with the <CODE>-ao sun</CODE> option,
79 otherwise neither video nor audio will work.</LI>
80 <LI>If the sound clicks when playing from CD-ROM, turn on IRQ unmasking, e.g.
81 <CODE>hdparm -u1 /dev/cdrom</CODE> (<CODE>man hdparm</CODE>). This is
82 generally beneficial and described in more detail in the
83 <A HREF="cd-dvd.html#drives">CD-ROM section</A>.</LI>
84 </UL>
85
86
87 <H4><A NAME="experiences">2.3.2.2 Sound Card experiences, recommendations</A></H4>
88
89 <P>On Linux, a 2.4.x kernel is highly recommended. Kernel 2.2 is not tested.</P>
90
91 <P>Linux sound drivers are primarily provided by the free version of OSS. These
92 drivers have been superceded by <A HREF="http://www.alsa-project.org">ALSA</A>
93 (Advanced Linux Sound Architecture) in the 2.5 development series. If your
94 distribution does not already use ALSA you may wish to try their drivers if
95 you experience sound problems. ALSA drivers are generally superior to OSS in
96 compatibility, performance and features. But some sound cards are only
97 supported by the commercial OSS drivers from
98 <A HREF="http://www.opensound.com/">4Front Technologies</A>. They also support
99 several non-Linux systems.</P>
100
101 <TABLE BORDER="1" WIDTH="100%">
102
103 <TR>
104 <TH ROWSPAN="2"><B>SOUND CARD</B></TH>
105 <TH COLSPAN="4"><B>DRIVER</B></TH>
106 <TH ROWSPAN="2"><B>Max kHz</B></TH>
107 <TH ROWSPAN="2"><B>Max Channels</B></TH>
108 <TH ROWSPAN="2"><B>Max Opens<FONT SIZE="-2"><A HREF=#note1>[1]</A></FONT></B></TH>
109 </TR>
110
111 <TR>
112 <TH><B>OSS/Free</B></TH>
113 <TH><B>ALSA</B></TH>
114 <TH><B>OSS/Pro</B></TH>
115 <TH><B>other</B></TH>
116 </TR>
117
118 <TR>
119 <TD><B>VIA onboard (686/A/B, 8233, 8235)</B></TD>
120 <TD><A HREF="http://sourceforge.net/project/showfiles.php?group_id=3242&amp;release_id=59602">via82cxxx_audio</A></TD>
121 <TD>snd-via82xx</TD>
122 <TD>&nbsp;</TD>
123 <TD>&nbsp;</TD>
124 <TD>4-48 kHz or 48 kHz only, depending on the chipset</TD>
125 <TD>&nbsp;</TD>
126 <TD>&nbsp;</TD>
127 </TR>
128
129 <TR>
130 <TD><B>Aureal Vortex 2</B></TD>
131 <TD>none</TD>
132 <TD>none</TD>
133 <TD>OK</TD>
134 <TD><A HREF="http://aureal.sourceforge.net">Linux Aureal Drivers</A><BR>
135 <A HREF="http://makacs.poliod.hu/~pontscho/aureal/au88xx-1.1.3.tar.bz2">buffer size increased to 32k</A></TD>
136 <TD>48</TD>
137 <TD>4.1</TD>
138 <TD>5+</TD>
139 </TR>
140
141 <TR>
142 <TD><B>SB Live!</B></TD>
143 <TD>Analog OK, SP/DIF not working</TD>
144 <TD>Both OK</TD>
145 <TD>Both OK</TD>
146 <TD><A HREF="http://opensource.creative.com">Creative's OSS driver (SP/DIF support)</A></TD>
147 <TD>192</TD>
148 <TD>4.0/5.1</TD>
149 <TD>32</TD>
150 </TR>
151
152 <TR>
153 <TD><B>SB 128 PCI (es1371)</B></TD>
154 <TD>OK</TD>
155 <TD>?</TD>
156 <TD>&nbsp;</TD>
157 <TD>&nbsp;</TD>
158 <TD>48</TD>
159 <TD>stereo</TD>
160 <TD>2</TD>
161 </TR>
162
163 <TR>
164 <TD><B>SB AWE 64</B></TD>
165 <TD>max 44kHz</TD>
166 <TD>48kHz sounds bad</TD>
167 <TD>&nbsp;</TD>
168 <TD>&nbsp;</TD>
169 <TD>48</TD>
170 <TD>&nbsp;</TD>
171 <TD>&nbsp;</TD>
172 </TR>
173
174 <TR>
175 <TD><B>GUS PnP</B></TD>
176 <TD>none</TD>
177 <TD>OK</TD>
178 <TD>OK</TD>
179 <TD>&nbsp;</TD>
180 <TD>48</TD>
181 <TD>&nbsp;</TD>
182 <TD>&nbsp;</TD>
183 </TR>
184
185 <TR>
186 <TD><B>Gravis UltraSound ACE</B></TD>
187 <TD>not OK</TD>
188 <TD>OK</TD>
189 <TD>&nbsp;</TD>
190 <TD>&nbsp;</TD>
191 <TD>44</TD>
192 <TD>&nbsp;</TD>
193 <TD>&nbsp;</TD>
194 </TR>
195
196 <TR>
197 <TD><B>Gravis UltraSound MAX</B></TD>
198 <TD>OK</TD>
199 <TD>OK (?)</TD>
200 <TD>&nbsp;</TD>
201 <TD>&nbsp;</TD>
202 <TD>48</TD>
203 <TD>&nbsp;</TD>
204 <TD>&nbsp;</TD>
205 </TR>
206
207 <TR>
208 <TD><B>ESS 688</B></TD>
209 <TD>OK</TD>
210 <TD>OK (?)</TD>
211 <TD>&nbsp;</TD>
212 <TD>&nbsp;</TD>
213 <TD>48</TD>
214 <TD>&nbsp;</TD>
215 <TD>&nbsp;</TD>
216 </TR>
217
218 <TR>
219 <TD><B>C-Media cards (which ones?)</B></TD>
220 <TD>not OK (hissing) (?)</TD>
221 <TD>OK</TD>
222 <TD>&nbsp;</TD>
223 <TD>&nbsp;</TD>
224 <TD>?</TD>
225 <TD>&nbsp;</TD>
226 <TD>&nbsp;</TD>
227 </TR>
228
229 <TR>
230 <TD><B>Yamaha cards (*ymf*)</B></TD>
231 <TD>not OK (?) (maybe <CODE>-ao sdl</CODE>)</TD>
232 <TD>OK only with ALSA 0.5 with OSS emulation <B>AND</B>
233 <CODE>-ao sdl</CODE> (!) (?)</TD>
234 <TD>&nbsp;</TD>
235 <TD>&nbsp;</TD>
236 <TD>?</TD>
237 <TD>&nbsp;</TD>
238 <TD>&nbsp;</TD>
239 </TR>
240
241 <TR>
242 <TD><B>Cards with envy24 chips (like Terratec EWS88MT)</B></TD>
243 <TD>?</TD>
244 <TD>?</TD>
245 <TD>OK</TD>
246 <TD>&nbsp;</TD>
247 <TD>?</TD>
248 <TD>&nbsp;</TD>
249 <TD>&nbsp;</TD>
250 </TR>
251
252 <TR>
253 <TD><B>PC Speaker or DAC</B></TD>
254 <TD>OK</TD>
255 <TD>none</TD>
256 <TD>&nbsp;</TD>
257 <TD><A HREF="http://www.geocities.com/stssppnn/pcsp.html">Linux PC speaker OSS driver</a></TD>
258 <TD>The driver emulates 44.1, maybe more.</TD>
259 <TD>mono</TD>
260 <TD>1</TD>
261 </TR>
262
263 </TABLE>
264
265 <P><A NAME="note1"><B>[1]</B></A>: the number of applications that are able to use the
266 device <I>at the same time</I>.</P>
267
268 <P>Feedback to this document is welcome. Please tell us how MPlayer
269 and your sound card(s) worked together.</P>
270
271
272 <H4><A NAME="af">2.3.2.3 Audio filters</A></H4>
273
274 <P>The old audio plugins have been superseded by a new audio filter layer. Audio
275 filters are used for changing the properties of the audio data before the
276 sound reaches the sound card. The activation and deactivation of the filters
277 is normally automated but can be overridden. The filters are activated when
278 the properties of the audio data differ from those required by the sound card
279 and deactivated if unnecessary. The <CODE>-af filter1,filter2,...</CODE>
280 option is used to override the automatic activation of filters or to insert
281 filters that are not automatically inserted. The filters will be executed as
282 they appear in the comma separated list.</P>
283
284 <P>Example:<BR>
285 &nbsp;&nbsp;<CODE>mplayer -af resample,pan movie.avi </CODE></P>
286
287 <P>would run the sound through the resampling filter followed by the pan filter.
288 Observe that the list must not contain any spaces, else it will fail.</P>
289
290 <P>The filters often have options that change their behavior. These options
291 are explained in detail in the sections below. A filter will execute using
292 default settings if its options are omitted. Here is an example of how to use
293 filters in combination with filter specific options:</P>
294
295 <P>&nbsp;&nbsp;<CODE>mplayer -af resample=11025,pan=1:0.5:0.5 -channels 1
296 -srate 11025 media.avi</CODE></P>
297
298 <P>would set the output frequency of the resample filter to 11025Hz and downmix
299 the audio to 1 channel using the pan filter.</P>
300
301 <P>The overall execution of the filter layer is controlled using the
302 <CODE>-af-adv</CODE> option. This option has two suboptions:</P>
303
304 <DL>
305 <DT><CODE>force</CODE><DT>
306 <DD>is a Bit field that controls how the filters are inserted and what
307 speed/accuracy optimizations they use:
308 <DL>
309 <DT><CODE>0</CODE></DT>
310 <DD>Use automatic insertion of filters and optimize according to CPU
311 speed.</DD>
312 <DT><CODE>1</CODE></DT>
313 <DD>Use automatic insertion of filters and optimize for the highest
314 speed.<BR>
315 <EM>Warning:</EM> Some features in the audio filters may silently fail,
316 and the sound quality may drop.</DD>
317 <DT><CODE>2</CODE></DT>
318 <DD>Use automatic insertion of filters and optimize for quality.</DD>
319 <DT><CODE>3</CODE></DT>
320 <DD>Use no automatic insertion of filters and no optimization.<BR>
321 <I>Warning:</I> It may be possible to crash MPlayer using this
322 setting.</DD>
323 <DT><CODE>4</CODE></DT>
324 <DD>Use automatic insertion of filters according to 0 above, but use
325 floating point processing when possible.</DD>
326 <DT><CODE>5</CODE></DT>
327 <DD>Use automatic insertion of filters according to 1 above, but use
328 floating point processing when possible.</DD>
329 <DT><CODE>6</CODE></DT>
330 <DD>Use automatic insertion of filters according to 2 above, but use
331 floating point processing when possible.</DD>
332 <DT><CODE>7</CODE></DT>
333 <DD>Use no automatic insertion of filters according to 3 above, and use
334 floating point processing when possible.</DD>
335 </DL>
336 </DD>
337
338 <DT><CODE>list</CODE></DT>
339 <DD>is an alias for the -af option.</DD>
340 </DL>
341
342 <P>The filter layer is also affected by the following generic options:
343
344 <DL>
345 <DT><CODE>-v</CODE></DT>
346 <DD>Increases the verbosity level and makes most filters print out extra
347 status messages.</DD>
348 <DT><CODE>-channels</CODE></DT>
349 <DD>This option sets the number of output channels you would like your
350 sound card to use.
351 It also affects the number of channels that are being decoded from the
352 media. If the media contains less channels than requested the channels
353 filter (see below) will automatically be inserted. The routing will be the
354 default routing for the channels filter.</DD>
355 <DT><CODE>-srate</CODE></DT>
356 <DD>This option selects the sample rate you would like your sound card to
357 use (of course the cards have limits on this). If the sample
358 frequency of your sound card is different from that of the current media,
359 the resample filter (see below) will be inserted into the audio filter layer
360 to compensate for the difference.</DD>
361 <DT><CODE>-format</CODE><DT>
362 <DD>This option sets the sample format between the audio filter layer and the sound
363 card. If the requested sample format of your sound card is different from
364 that of the current media, a format filter (see below) will be inserted to
365 rectify the difference.</DD>
366 </DL>
367
368
369 <H4><A NAME="af_resample">2.3.2.3.1 Up/Down-sampling</A></H4>
370
371 <P>MPlayer fully supports sound up/down-sampling through the
372 <CODE>resample</CODE> filter. It can be used if you
373 have a fixed frequency sound card or if you are stuck with an old sound card
374 that is only capable of max 44.1kHz. This filter is automatically enabled if
375 it is necessary, but it can also be explicitly enabled on the command line. It
376 has three options:</P>
377
378 <DL>
379 <DT><CODE>srate &lt;8000-192000&gt;</CODE></DT>
380 <DD>is an integer used for setting the output sample
381 frequency in Hz. The valid range for this parameter is 8kHz to 192kHz. If
382 the input and output sample frequency are the same or if this parameter is
383 omitted the filter is automatically unloaded. A high sample frequency
384 normally improves the audio quality, especially when used in combination
385 with other filters.</DD>
386
387 <DT><CODE>sloppy</CODE></DT>
388 <DD>is an optional binary parameter that allows the output frequency to differ
389 slightly from the frequency given by <CODE>srate</CODE>. This option can be
390 used if the startup of the playback is extremely slow. It is enabled by
391 default.</DD>
392
393 <DT><CODE>type &lt;0-2&gt;</CODE><DT>
394 <DD>is an optional integer between <CODE>0</CODE> and <CODE>2</CODE> that
395 selects which resampling method to use. Here <CODE>0</CODE> represents
396 linear interpolation as resampling method, <CODE>1</CODE> represents
397 resampling using a poly-phase filter-bank and integer processing and
398 <CODE>2</CODE> represents resampling using a poly-phase filter-bank and
399 floating point processing. Linear interpolation is extremely fast, but
400 suffers from poor sound quality especially when used for up-sampling. The
401 best quality is given by <CODE>2</CODE> but this method also suffers from
402 the highest CPU load.</DD>
403 </DL>
404
405 <P>Example:<BR>
406 &nbsp;&nbsp;<CODE>mplayer -af resample=44100:0:0</CODE></P>
407
408 <P>would set the output frequency of the resample filter to 44100Hz using exact
409 output frequency scaling and linear interpolation.</P>
410
411
412 <H4><A NAME="af_channels">2.3.2.3.2 Changing the number of channels</A></H4>
413
414 <P>The <CODE>channels</CODE> filter can be used for adding and removing
415 channels, it can also be used for routing or copying channels. It is
416 automatically enabled when the output from the audio filter layer differs from
417 the input layer or when it is requested by another filter. This filter unloads
418 itself if not needed. The number of options is dynamic:</P>
419
420 <DL>
421 <DT><CODE>nch &lt;1-6&gt;</CODE></DT>
422 <DD>is an integer between <CODE>1</CODE> and <CODE>6</CODE> that is used for
423 setting the number of output channels. This option is required, leaving it
424 empty results in a runtime error.</DD>
425
426 <DT><CODE>nr &lt;1-6&gt;</CODE></DT>
427 <DD>is an integer between <CODE>1</CODE> and <CODE>6</CODE> that is used for
428 specifying the number of routes. This parameter is optional. If it is
429 omitted the default routing is used.</DD>
430
431 <DT><CODE>from1:to1:from2:to2:from3:to3...</CODE></DT>
432 <DD>are pairs of numbers between <CODE>0</CODE> and <CODE>5</CODE> that define
433 where each channel should be routed.</DD>
434 </DL>
435
436 <P>If only <CODE>nch</CODE> is given the default routing is used, it works as
437 follows: If the number of output channels is bigger than the number of input
438 channels empty channels are inserted (except mixing from mono to stereo, then
439 the mono channel is repeated in both of the output channels). If the number of
440 output channels is smaller than the number of input channels the exceeding
441 channels are truncated.</P>
442
443 <P>Example 1:<BR>
444 &nbsp;&nbsp;<CODE>mplayer -af channels=4:4:0:1:1:0:2:2:3:3 media.avi </CODE></P>
445
446 <P>would change the number of channels to 4 and set up 4 routes that swap
447 channel 0 and channel 1 and leave channel 2 and 3 intact. Observe that if
448 media containing two channels was played back, channels 2 and 3 would contain
449 silence but 0 and 1 would still be swapped.</P>
450
451 <P>Example 2:<BR>
452 &nbsp;&nbsp;<CODE>mplayer -af channels=6:4:0:0:0:1:0:2:0:3 media.avi </CODE></P>
453
454 <P>would change the number of channels to 6 and set up 4 routes that copy
455 channel 0 to channels 0 to 3. Channel 4 and 5 will contain silence.</P>
456
457
458 <H4><A NAME="af_format">2.3.2.3.3 Sample format converter</A></H4>
459
460 <P>The <CODE>format</CODE> filter converts between different sample formats. It
461 is automatically enabled when needed by the sound card or another filter.</P>
462
463 <DL>
464 <DT><CODE>bps &lt;number&gt;</CODE></DT>
465 <DD>can be <CODE>1</CODE>, <CODE>2</CODE> or <CODE>4</CODE> and denotes the
466 number of bytes per sample. This option is required, leaving it empty
467 results in a runtime error.</DD>
468
469 <DT><CODE>f &lt;format&gt;</CODE></DT>
470 <DD>is a text string describing the sample format. The string is a
471 concatenated mix of: <CODE>alaw</CODE>, <CODE>mulaw</CODE> or
472 <CODE>imaadpcm</CODE>, <CODE>float</CODE> or <CODE>int</CODE>,
473 <CODE>unsigned</CODE> or <CODE>signed</CODE>, <CODE>le</CODE> or
474 <CODE>be</CODE> (little or big endian). This option is required, leaving it
475 empty results in a runtime error.</DD>
476 </DL>
477
478 <P>Example:<BR>
479 &nbsp;&nbsp;<CODE>mplayer -af format=4:float media.avi</CODE></P>
480
481 <P>would set the output format to 4 bytes per sample floating point
482 data.</P>
483
484
485 <H4><A NAME="af_delay">2.3.2.3.4 Delay</A></H4>
486
487 <P>The <CODE>delay</CODE> filter delays the sound to the loudspeakers such that
488 the sound from the different channels arrives at the listening position
489 simultaneously.
490 It is only useful if you have more than 2 loudspeakers. This filter has a
491 variable number of parameters:</P>
492
493 <DL>
494 <DT><CODE>d1:d2:d3...</CODE></DT>
495 <DD>are floating point numbers representing the delays in ms that should be
496 imposed on the different channels. The minimum delay is 0ms and the maximum
497 is 1000ms.</DD>
498 </DL>
499
500 <P>To calculate the required delay for the different channels do as follows:</P>
501
502 <OL>
503 <LI>Measure the distance to the loudspeakers in meters in relation to your
504 listening position, giving you the distances s1 to s5 (for a 5.1 system).
505 There is no point in compensating for the sub-woofer (you will not hear the
506 difference anyway).</LI>
507 <LI>Subtract the distances s1 to s5 from the maximum distance i.e.<BR>
508 s[i] = max(s) - s[i]; i = 1...5</LI>
509 <LI>Calculated the required delays in ms as<BR>
510 d[i] = 1000*s[i]/342; i = 1...5 </LI>
511 </OL>
512
513 <P>Example:<BR>
514 &nbsp;&nbsp;<CODE>mplayer -af delay=10.5:10.5:0:0:7:0 media.avi</CODE></P>
515
516 <P>would delay front left and right by 10.5ms, the two rear channels and the sub
517 by 0ms and the center channel by 7ms.</P>
518
519
520 <H4><A NAME="af_volume">2.3.2.3.5 Software volume control</A></H4>
521
522 <P>Software volume control is implemented by the <CODE>volume</CODE> audio
523 filter. Use this filter with caution since
524 it can reduce the signal to noise ratio of the sound. In most cases it is best
525 to set the level for the PCM sound to max, leave this filter out and control
526 the output level to your speakers with the master volume control of the mixer.
527 In case your sound card has a digital PCM mixer instead of an analog one, and
528 you hear distortion, use the MASTER mixer instead.
529 If there is an external amplifier connected to the computer (this is almost
530 always the case), the noise level can be minimized by adjusting the master
531 level and the volume knob on the amplifier until the hissing noise in the
532 background is gone. This filter has two options:</P>
533
534 <DL>
535 <DT><CODE>v &lt;-200 - +60&gt;</CODE></DT>
536 <DD>is a floating point number between <CODE>-200</CODE> and <CODE>+60</CODE>
537 which represents the volume level in dB. The default level is 0dB.</DD>
538
539 <DT><CODE>c</CODE></DT>
540 <DD>is a binary control that turns soft clipping on and off. Soft-clipping can
541 make the sound more smooth if very high volume levels are used. Enable this
542 option if the dynamic range of the loudspeakers is very low. Be aware that
543 this feature creates distortion and should be considered a last resort.</DD>
544 </DL>
545
546 <P>Example:<BR>
547 &nbsp;&nbsp;<CODE>mplayer -af volume=10.1:0 media.avi</CODE></P>
548
549 <P>would amplify the sound by 10.1dB and hard-clip if the sound level is too
550 high.</P>
551
552 <P>This filter has a second feature: It measures the overall maximum sound level
553 and prints out that level when MPlayer exits. This volume estimate can be used
554 for setting the sound level in MEncoder such that the maximum dynamic range is
555 utilized.</P>
556
557
558 <H4><A NAME="af_equalizer">2.3.2.3.6 Equalizer</A></H4>
559
560 <P>The <CODE>equalizer</CODE> filter represents a 10 octave band graphic
561 equalizer, implemented using 10 IIR
562 band pass filters. This means that it works regardless of what type of audio
563 is being played back. The center frequencies for the 10 bands are:</P>
564
565 <TABLE BORDER="0" WIDTH="100%">
566 <TR><TD>Band No.</TD><TD>Center frequency</TD></TR>
567 <TR><TD>0</TD><TD>31.25 Hz</TD></TR>
568 <TR><TD>1</TD><TD>62.50 Hz</TD></TR>
569 <TR><TD>2</TD><TD>125.0 Hz</TD></TR>
570 <TR><TD>3</TD><TD>250.0 Hz</TD></TR>
571 <TR><TD>4</TD><TD>500.0 Hz</TD></TR>
572 <TR><TD>5</TD><TD>1.000 kHz</TD></TR>
573 <TR><TD>6</TD><TD>2.000 kHz</TD></TR>
574 <TR><TD>7</TD><TD>4.000 kHz</TD></TR>
575 <TR><TD>8</TD><TD>8.000 kHz</TD></TR>
576 <TR><TD>9</TD><TD>16.00 kHz</TD></TR>
577 </TABLE>
578
579 <P>If the sample rate of the sound being played back is lower than the center
580 frequency for a frequency band, then that band will be disabled. A known bug
581 with this filter is that the characteristics for the uppermost band are not
582 completely symmetric if the sample rate is close to the center frequency of
583 that band. This problem can be worked around by up-sampling the sound using
584 the resample filter before it reaches this filter. </P>
585
586 <P>This filter has 10 parameters:</P>
587
588 <DL>
589 <DT><CODE>g1:g2:g3...g10</CODE></DT>
590 <DD>are floating point numbers between <CODE>-12</CODE> and <CODE>+12</CODE>
591 representing the gain in dB for each frequency band.</DD>
592 </DL>
593
594 <P>Example:<BR>
595 &nbsp;&nbsp;<CODE>mplayer -af equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi</CODE></P>
596
597 <P>would amplify the sound in the upper and lower frequency region while
598 canceling it almost completely around 1kHz.</P>
599
600
601 <H4><A NAME="af_panning">2.3.2.3.7 Panning filter</A></H4>
602
603 <P>Use the <CODE>pan</CODE> filter to mix channels arbitrarily. It is basically
604 a combination of the volume control and the channels filter. There are two
605 major uses for this filter:</P>
606
607 <OL>
608 <LI>Down-mixing many channels to only a few, stereo to mono for example.</LI>
609 <LI>Varying the "width" of the center speaker in a surround sound system.</LI>
610 </OL>
611
612 <P>This filter is hard to use, and will require some tinkering before the
613 desired result is obtained. The number of options for this filter depends on
614 the number of output channels:</P>
615
616 <DL>
617 <DT><CODE>nch &lt;1-6&gt;</CODE></DT>
618 <DD>is an integer between <CODE>1</CODE> and <CODE>6</CODE> and is used for
619 setting the number of output channels. This option is required, leaving it
620 empty results in a runtime error.</DD>
621
622 <DT><CODE>l00:l01:l02:..l10:l11:l12:...ln0:ln1:ln2:...</CODE></DT>
623 <DD>are floating point values between <CODE>0</CODE> and <CODE>1</CODE>.
624 <CODE>l[i][j]</CODE> determines how much of input channel j is mixed into
625 output channel i.</DD>
626 </DL>
627
628 <P>Example 1:<BR>
629 &nbsp;&nbsp;<CODE>mplayer -af pan=1:0.5:0.5 -channels 1 media.avi</CODE></P>
630
631 <P>would down-mix from stereo to mono.</P>
632
633 <P>Example 2:<BR>
634 &nbsp;&nbsp;<CODE>mplayer -af pan=3:1:0:1:0.5:0.5 -channels 3 media.avi</CODE></P>
635
636 <P>would give 3 channel output leaving channels 0 and 1 intact, and mix channels
637 0 and 1 into output channel 2 (which could be sent to a sub-woofer for
638 example).</P>
639
640
641 <H4><A NAME="af_sub">2.3.2.3.8 Sub-woofer</A></H4>
642
643 <P>The <CODE>sub</CODE> filter adds a sub woofer channel to the audio stream.
644 The audio data
645 used for creating the sub-woofer channel is an average of the sound in channel
646 0 and channel 1. The resulting sound is then low-pass filtered by a 4th
647 order Butterworth filter with a default cutoff frequency of 60Hz and added to
648 a separate channel in the audio stream. Warning: Disable this filter when you
649 are playing DVDs with Dolby Digital 5.1 sound, otherwise this filter will
650 disrupt the sound to the sub-woofer. This filter has two parameters:</P>
651
652 <DL>
653 <DT><CODE>fc &lt;20-300&gt;</CODE></DT>
654 <DD>is an optional floating point number used for setting the cutoff frequency
655 for the filter in Hz. The valid range is 20Hz to 300Hz. For the best result
656 try setting the cutoff frequency as low as possible. This will improve the
657 stereo or surround sound experience. The default cutoff frequency is
658 60Hz.</DD>
659
660 <DT><CODE>ch &lt;0-5&gt;</CODE></DT>
661 <DD>is an optional integer between <CODE>0</CODE> and <CODE>5</CODE> which
662 determines the channel number in which to insert the sub-channel audio.
663 The default is channel number <CODE>5</CODE>. Observe that the number of
664 channels will automatically be increased to <CODE>ch</CODE> if
665 necessary.</DD>
666 </DL>
667
668 <P>Example:<BR>
669 &nbsp;&nbsp;<CODE>mplayer -af sub=100:4 -channels 5 media.avi</CODE></P>
670
671 <P>would add a sub-woofer channel with a cutoff frequency of 100Hz to output
672 channel 4.</P>
673
674 <H4><A NAME="af_surround">2.3.2.3.9 Surround-sound decoder</A></H4>
675
676 <P>Matrix encoded surround sound can be decoded by the <CODE>surround</CODE>
677 filter. Dolby Surround is
678 an example of a matrix encoded format. Many files with 2 channel audio
679 actually contain matrixed surround sound. To use this feature you need a sound
680 card supporting at least 4 channels. This filter has one parameter:</P>
681
682 <DL>
683 <DT><CODE>d &lt;0-1000&gt;</CODE></DT>
684 <DD>is an optional floating point number between <CODE>0</CODE> and
685 <CODE>1000</CODE> used for setting the delay time in ms for the rear
686 speakers. This delay should be set as follows: if d1 is the distance from
687 the listening position to the front speakers and d2 is the distance from
688 the listening position to the rear speakers, then the delay <CODE>d</CODE>
689 should be set to 15ms if d1 &lt;= d2 and to 15 + 5*(d1-d2) if d1 &gt; d2.
690 The default value for <CODE>d</CODE> is 20ms.</DD>
691 </DL>
692
693 <P>Example:<BR>
694 &nbsp;&nbsp;<CODE>mplayer -af surround=15 -channels 4 media.avi</CODE></P>
695
696 <P>would add surround sound decoding with 15ms delay for the sound to the rear
697 speakers.</P>
698
699
700 <H4><A NAME="plugins">2.3.2.4 Audio plugins (deprecated)</A></H4>
701
702 <H2><STRONG>Note: Audio plugins have been deprecated by audio filters and will be
703 removed soon.</STRONG></H2>
704
705 <P>MPlayer has support for audio plugins. Audio plugins can be used to
706 change the properties of the audio data before it reaches the sound
707 card. They are enabled using the <CODE>-aop</CODE> option which takes a
708 <CODE>list=plugin1,plugin2,...</CODE> argument. The <CODE>list</CODE> argument
709 is required and determines which plugins should be used and in which order they
710 should be executed. Example:</P>
711
712 <P>&nbsp;&nbsp;<CODE>mplayer media.avi -aop list=resample,format</CODE></P>
713
714 <P>would run the sound through the resampling plugin followed by the format
715 plugin.</P>
716
717 <P>The plugins can also have options that change their behavior. These
718 options are explained in detail in the sections below. A plugin will execute
719 using default settings if its options are omitted. Here is an example of how
720 to use plugins in combination with plugin specific options:</P>
721
722 <P>&nbsp;&nbsp;<CODE>mplayer media.avi -aop
723 list=resample,format:fout=44100:format=0x8</CODE></P>
724
725 <P>would set the output frequency of the resample plugin to 44100Hz and the
726 output format of the format plugin to AFMT_U8.</P>
727
728 <P>Currently audio plugins cannot be used in MEncoder.</P>
729
730
731 <H4><A NAME="resample">2.3.2.4.1 Up/Downsampling</A></H4>
732
733 <P>MPlayer fully supports up/downsampling of the sound. This plugin can
734 be used if you have a fixed frequency sound card or if you are
735 stuck with an old sound card that is only capable of max 44.1kHz.
736 MPlayer <EM>autodetects</EM> whether or not usage of this plugin is necessary.
737 This plugin has one option, <CODE>fout</CODE>, which is used for setting the
738 desired output sample frequency. The value is given in Hz, and defaults to
739 48kHz.</P>
740
741 <P>Usage:<BR>
742 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=resample:fout=&lt;required
743 frequency in Hz, like 44100&gt;</CODE></P>
744
745 <P>Note that the output frequency should not be scaled up from the default value.
746 Scaling up will cause the audio and video streams to be played in slow motion
747 and cause audio distortion.</P>
748
749
750 <H4><A NAME="surround_decoding">2.3.2.4.2 Surround Sound decoding</A></H4>
751
752 <P>MPlayer has an audio plugin that can decode matrix encoded
753 surround sound. Dolby Surround is an example of a matrix encoded format.
754 Many files with 2 channel audio actually contain matrixed surround sound.
755 To use this feature you need a sound card supporting at least 4 channels.</P>
756
757 <P>Usage:<BR>
758 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=surround</CODE></P>
759
760
761 <H4><A NAME="format">2.3.2.3.3 Sample format converter</A></H4>
762
763 <P>If your sound card driver does not support signed 16bit <CODE>int</CODE> data type,
764 this plugin can
765 be used to change the format to one which your sound card can understand. It
766 has one option, <CODE>format</CODE>, which can be set to one of the numbers
767 found in <CODE>libao2/afmt.h</CODE>. This plugin is hardly ever needed and is
768 intended for advanced users. Keep in mind that this plugin only changes the
769 sample format and not the sample frequency or the number of channels.</P>
770
771 <P>Usage:<BR>
772 &nbsp;&nbsp;<CODE>mplayer media.avi -aop
773 list=format:format=&lt;required output format&gt;</CODE></P>
774
775
776 <H4><A NAME="delay">2.3.2.4.4 Delay</A></H4>
777
778 <P>This plugin delays the sound and is intended as an example of how to develop
779 new plugins. It can not be used for anything useful from a users perspective
780 and is mentioned here for the sake of completeness only. Do not use this
781 plugin unless you are a developer.</P>
782
783 <P>If you have a file with a consistent A/V sync fault, use the <CODE>+/-</CODE>
784 keys to adjust timings on-the-fly instead. Usage of the OSD is recommended
785 to make this easier.</P>
786
787
788 <H4><A NAME="volume">2.3.2.4.5 Software volume control</A></H4>
789
790 <P>This plugin is a software replacement for the volume control, and
791 can be used on machines with a broken mixer device. It can also be
792 used if one wants to change the output volume of MPlayer
793 without changing the PCM volume setting in the mixer. It has one
794 option <CODE>volume</CODE> that is used for setting the initial
795 sound level. The initial sound level can be set to values between 0
796 and 255 and defaults to 101 which equals 0dB amplification. Use this
797 plugin with caution since it can reduce the signal to noise ratio of
798 the sound. In most cases it is best to set the level for the PCM
799 sound to max, leave this plugin out and control the output level to
800 your speakers with the MASTER volume control of the mixer.
801 In case your sound card has a digital PCM mixer instead of an analog one, and
802 you hear distortion, use the MASTER mixer instead.
803 external amplifier connected to the computer (this is almost always
804 the case), the noise level can be minimized by adjusting the master
805 level and the volume knob on the amplifier until the hissing noise
806 in the background is gone.</P>
807
808 <P>Usage:<BR>
809 &nbsp;&nbsp;<CODE>mplayer media.avi -aop
810 list=volume:volume=&lt;0-255&gt;</CODE></P>
811
812 <P>This plugin also has compressor or "soft-clipping" capabilities.
813 Compression can be used if the dynamic range of the sound is very
814 high or if the dynamic range of the loudspeakers is very
815 low. Be aware that this feature creates distortion and should be
816 considered a last resort.</P>
817
818 <P>Usage:<BR>
819 &nbsp;&nbsp;<CODE>mplayer media.avi -aop
820 list=volume:softclip</CODE></P>
821
822
823 <H4><A NAME="extrastereo">2.3.2.4.6 Extrastereo</A></H4>
824
825 <P>This plugin (linearly) increases the difference between left and right
826 channels (like the XMMS extrastereo plugin) which gives some sort of "live"
827 effect to playback.</P>
828
829 <P>Usage:<BR>
830 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=extrastereo</CODE><BR>
831 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=extrastereo:mul=3.45</CODE></P>
832
833 <P>The default coefficient (<CODE>mul</CODE>) is a float number that defaults
834 to 2.5. If you set it to 0.0, you will have mono sound (average of both
835 channels). If you set it to 1.0, sound will be unchanged, if you set it to
836 -1.0, left and right channels will be swapped.</P>
837
838
839 <H4><A NAME="normalizer">2.3.2.4.7 Volume normalizer</A></H4>
840
841 <P>This plugin maximizes the volume without distorting the sound.</P>
842
843 <P>Usage:<BR>
844 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=volnorm</CODE><BR>
845
846
847 </BODY>
848 </HTML>