comparison DOCS/sound.html @ 8750:f6323ff433aa

New audio filter documentation by Anders Johannsson with some structural modifications by myself.
author diego
date Fri, 03 Jan 2003 22:29:16 +0000
parents 352b654c7787
children f117a4150786
comparison
equal deleted inserted replaced
8749:8d29bc9a5836 8750:f6323ff433aa
10 <BODY> 10 <BODY>
11 11
12 12
13 <H3><A NAME="audio">2.3.2 Audio output devices</A></H3> 13 <H3><A NAME="audio">2.3.2 Audio output devices</A></H3>
14 14
15 <H4><A NAME="sync">2.3.2.1 Description of MPlayer's A/V sync method</A></H4> 15 <H4><A NAME="sync">2.3.2.1 Audio/Video synchronisation</A></H4>
16 16
17 <P>MPlayer's audio interface is called <I>libao2</I>. It currently 17 <P>MPlayer's audio interface is called <I>libao2</I>. It currently
18 contains these drivers:</P> 18 contains these drivers:</P>
19 19
20 <TABLE BORDER=0> 20 <TABLE BORDER="0">
21 <TR><TD COLSPAN=4><P><B>General:</B></P></TD></TR> 21 <TR><TD COLSPAN=4><P><B>General:</B></P></TD></TR>
22 <TR><TD>&nbsp;&nbsp;</TD><TD VALIGN=top>oss</TD><TD>&nbsp;&nbsp;</TD><TD>OSS (ioctl) driver (supports hardware AC3 passthrough)</TD></TR> 22 <TR><TD>&nbsp;&nbsp;</TD><TD VALIGN=top>oss</TD><TD>&nbsp;&nbsp;</TD><TD>OSS (ioctl) driver (supports hardware AC3 passthrough)</TD></TR>
23 <TR><TD></TD><TD VALIGN=top>sdl</TD><TD></TD><TD>SDL driver (supports <B>ESD</B>, <B>ARTS</B> etc)</TD></TR> 23 <TR><TD></TD><TD VALIGN=top>sdl</TD><TD></TD><TD>SDL driver (supports <B>ESD</B>, <B>ARTS</B> etc)</TD></TR>
24 <TR><TD></TD><TD VALIGN=top>nas</TD><TD></TD><TD>NAS (Network Audio System) driver</TD></TR> 24 <TR><TD></TD><TD VALIGN=top>nas</TD><TD></TD><TD>NAS (Network Audio System) driver</TD></TR>
25 <TR><TD></TD><TD VALIGN=top>alsa5</TD><TD></TD><TD>native ALSA 0.5 driver</TD></TR> 25 <TR><TD></TD><TD VALIGN=top>alsa5</TD><TD></TD><TD>native ALSA 0.5 driver</TD></TR>
27 <TR><TD></TD><TD VALIGN=top>sun</TD><TD></TD><TD>SUN audio driver (<CODE>/dev/audio</CODE>) for BSD and Solaris8 users</TD></TR> 27 <TR><TD></TD><TD VALIGN=top>sun</TD><TD></TD><TD>SUN audio driver (<CODE>/dev/audio</CODE>) for BSD and Solaris8 users</TD></TR>
28 <TR><TD></TD><TD VALIGN=top>arts</TD><TD></TD><TD>native ARTS driver (mostly for KDE users)</TD></TR> 28 <TR><TD></TD><TD VALIGN=top>arts</TD><TD></TD><TD>native ARTS driver (mostly for KDE users)</TD></TR>
29 </TABLE> 29 </TABLE>
30 30
31 <P>Fact is, Linux sound card drivers have compatibility problems. The cause 31 <P>Fact is, Linux sound card drivers have compatibility problems. The cause
32 is that MPlayer uses a feature of normally coded audio drivers to maintain 32 is that MPlayer uses a feature that well coded audio drivers implement to
33 audio/video sync. Regrettably, some driver authors don't care of this 33 maintain audio/video sync. Regrettably, some driver authors do not care about
34 function: it isn't needed for playing MP3s, or sound effects.</P> 34 this function, it is not needed for playing MP3s or for sound effects.</P>
35 35
36 <P>Other media players like aviplay or xine possibly work out-of-the-box with 36 <P>Other media players like aviplay or xine possibly work out-of-the-box with
37 these drivers because they use "simple" methods with internal timing. A note: 37 these drivers because they use "simple" methods with internal timing. A note:
38 time showed their methods aren't AS efficient as MPlayer's.</P> 38 time showed their methods aren't AS efficient as MPlayer's.</P>
39 39
40 <P>Using MPlayer with a correctly written audio driver won't ever give you A/V 40 <P>With a correctly written audio driver MPlayer will never create audio related
41 desyncs related to the audio, only with very badly created files (check the 41 A/V desynchronisation, unless your file is badly broken. Some options to work
42 documentation for workarounds!).</P> 42 around these problems are described in the man page).</P>
43 43
44 <P>If you happen to have a bad audio driver, try the <CODE>-autosync</CODE> 44 <P>If you happen to have a bad audio driver, try the <CODE>-autosync</CODE>
45 option, it should sort out your problems. See the man page for detailed 45 option, it should sort out your problems. See the man page for detailed
46 information.</P> 46 information.</P>
47 47
48 <P>Some notes:</P> 48 <P>Some notes:</P>
49 49
50 <UL> 50 <UL>
51 <LI>If you have an OSS driver, first try <CODE>-ao oss</CODE> (this is the 51 <LI>If you have an OSS driver, first try <CODE>-ao oss</CODE> (this is the
52 default). If you experience glitches, halts or anything out of the 52 default). If you experience glitches, halts or anything out of the
53 ordinary, try <CODE>-ao sdl</CODE> (NOTE: you need to have SDL libraries 53 ordinary, try <CODE>-ao sdl</CODE> (NOTE: You need to have SDL libraries
54 and header files installed). The SDL audio driver helps in a lot of cases 54 and header files installed). The SDL audio driver helps in a lot of cases
55 and also supports ESD, ARTS. (ESD is the sound daemon 55 and also supports ESD and ARTS. (ESD is the sound daemon
56 from GNOME, ARTS is from KDE.)</LI> 56 from GNOME, ARTS is from KDE.)</LI>
57 <LI>If you have ALSA version 0.5, then you almost always have to use 57 <LI>If you have ALSA version 0.5, then you almost always have to use
58 <CODE>-ao alsa5</CODE> , since ALSA 0.5 has buggy OSS emulation code, and 58 <CODE>-ao alsa5</CODE> , since ALSA 0.5 has buggy OSS emulation code, and
59 will <B>crash MPlayer</B> with a message like this:<BR> 59 will <B>crash MPlayer</B> with a message like this:<BR>
60 <CODE>DEMUXER: Too many (945 in 8390980 bytes) video packets in the buffer!</CODE></LI> 60 <CODE>DEMUXER: Too many (945 in 8390980 bytes) video packets in the buffer!</CODE></LI>
64 <CODE>-ao sun</CODE> option, otherwise neither video nor audio will work.</P> 64 <CODE>-ao sun</CODE> option, otherwise neither video nor audio will work.</P>
65 65
66 66
67 <H4><A NAME="experiences">2.3.2.2 Sound Card experiences, recommendations</A></H4> 67 <H4><A NAME="experiences">2.3.2.2 Sound Card experiences, recommendations</A></H4>
68 68
69 <TABLE BORDER=0 WIDTH="100%"> 69 <TABLE BORDER="0" WIDTH="100%">
70 <TR><TD COLSPAN=3><B>VIA onboard chipset (via82cxxx) 48kHz only</B></TD></TR> 70 <TR><TD COLSPAN=3><B>VIA onboard chipset (via82cxxx) 48kHz only</B></TD></TR>
71 <TR><TD></TD><TD>Driver:</TD><TD> from <A HREF="http://sourceforge.net/project/showfiles.php?group_id=3242&amp;release_id=59602">sourceforge.net</A></TD></TR> 71 <TR><TD></TD><TD>Driver:</TD><TD> from the
72 <A HREF="http://sourceforge.net/project/showfiles.php?group_id=3242&amp;release_id=59602">gkernel project</A></TD></TR>
72 73
73 <TR><TD COLSPAN=3><B>Aureal Vortex 2</B></TD></TR> 74 <TR><TD COLSPAN=3><B>Aureal Vortex 2</B></TD></TR>
74 <TR><TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD>OSS:</TD><TD>no driver</TD></TR> 75 <TR><TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD>OSS:</TD><TD>no driver</TD></TR>
75 <TR><TD></TD><TD>OSS/Pro:</TD><TD>OK</TD></TR> 76 <TR><TD></TD><TD>OSS/Pro:</TD><TD>OK</TD></TR>
76 <TR><TD></TD><TD>ALSA:</TD><TD>no driver</TD></TR> 77 <TR><TD></TD><TD>ALSA:</TD><TD>no driver</TD></TR>
133 <TR><TD></TD><TD>Driver:</TD><TD><A HREF="ftp://ftp.infradead.org/pub/pcsp">ftp://ftp.infradead.org/pub/pcsp</A></TD></TR> 134 <TR><TD></TD><TD>Driver:</TD><TD><A HREF="ftp://ftp.infradead.org/pub/pcsp">ftp://ftp.infradead.org/pub/pcsp</A></TD></TR>
134 </TABLE> 135 </TABLE>
135 136
136 <P>On Linux, a 2.4.x kernel is highly recommended. Kernel 2.2 is not tested.</P> 137 <P>On Linux, a 2.4.x kernel is highly recommended. Kernel 2.2 is not tested.</P>
137 138
138 <P>If sound clicks when playing from CD-ROM, turn on IRQ unmasking, e.g. 139 <P>If the sound clicks when playing from CD-ROM, turn on IRQ unmasking, e.g.
139 <CODE>hdparm -u1 /dev/cdrom</CODE> (<CODE>man hdparm</CODE>). This is 140 <CODE>hdparm -u1 /dev/cdrom</CODE> (<CODE>man hdparm</CODE>). This is
140 generally beneficial and described more detailed in the <A 141 generally beneficial and described in more detail in the
141 HREF="cd-dvd.html#drives">CD-ROM section</A>.</P> 142 <A HREF="cd-dvd.html#drives">CD-ROM section</A>.</P>
142 143
143 <P>Sharing your sound card with another application like XMMS is <B>strongly 144 <P>Sharing your sound card with another application like XMMS is <B>strongly
144 discouraged</B>! If the other sound application is using ESD, start 145 discouraged</B>! If the other sound application is using ESD, start
145 MPlayer with the <CODE>-vo sdl:esd</CODE> option to combine both 146 MPlayer with the <CODE>-vo sdl:esd</CODE> option to combine both
146 sound streams. In fact, the option <CODE>-vo sdl:esd</CODE> could be used 147 sound streams. In fact, the option <CODE>-vo sdl:esd</CODE> could be used
148 149
149 <P>Feedback to this document is welcome. Please tell us how MPlayer 150 <P>Feedback to this document is welcome. Please tell us how MPlayer
150 and your sound card(s) worked together.</P> 151 and your sound card(s) worked together.</P>
151 152
152 153
153 <H4><A NAME="plugins">2.3.2.3 Audio plugins</A></H4> 154 <H4><A NAME="af">2.3.2.3 Audio filters</A></H4>
155
156 <P>The old audio plugins have been superseded by a new audio filter layer. Audio
157 filters are used for changing the properties of the audio data before the
158 sound reaches the sound card. The activation and deactivation of the filters
159 is normally automated but can be overridden. The filters are activated when
160 the properties of the audio data differ from those required by the sound card
161 and deactivated if unnecessary. The <CODE>-af filter1,filter2,...</CODE>
162 switch is used to override the automatic activation of filters or to insert
163 filters that are not automatically inserted. The filters will be executed as
164 they appear in the comma separated list.</P>
165
166 <P>Example:<BR>
167 &nbsp;&nbsp;<CODE>mplayer -af resample,pan movie.avi </CODE></P>
168
169 <P>would run the sound through the resampling filter followed by the pan filter.
170 Observe that the list must not contain any spaces, else it will fail.</P>
171
172 <P>The filters often have switches that change their behavior. These switches
173 are explained in detail in the sections below. A filter will execute using
174 default settings if its switches are omitted. Here is an example of how to use
175 filters in combination with filter specific switches:</P>
176
177 <P>&nbsp;&nbsp;<CODE>mplayer -af resample=11025,pan=1:0.5:0.5 -channels 1
178 -srate 11025 media.avi</CODE></P>
179
180 <P>would set the output frequency of the resample filter to 11025Hz and downmix
181 the audio to 1 channel using the pan filter.</P>
182
183 <P>Most filters respond to the <CODE>-v</CODE> switch, which makes the filters
184 print out status messages.</P>
185
186 <P>The overall execution of the filter layer is controlled using the
187 <CODE>-af-adv</CODE> switch. This switch has two suboptions:</P>
188
189 <DL>
190 <DT><CODE>force</CODE><DT>
191 <DD>is an integer between 0 and 3 that controls how the filters are inserted
192 and what speed/accuracy optimizations they use:
193 <DL>
194 <DT>0</DT>
195 <DD>Use automatic insertion of filters and optimize according to CPU
196 speed.</DD>
197 <DT>1</DT>
198 <DD>Use automatic insertion of filters and optimize for the highest speed.
199 If this option is set the processing of the audio data will be done
200 using fix point arithmetics. Warning: Some features in the audio filters
201 will silently fail, and the sound quality may drop.</DD>
202 <DT>2</DT>
203 <DD>Use automatic insertion of filters and optimize for quality. If this
204 option is set the processing of the audio data will be done using
205 floating point instructions and is therefore quite CPU intensive, but
206 gives a lot higher sound quality than fix point processing.</DD>
207 <DT>3</DT>
208 <DD>Use no automatic insertion of filters and no optimization. Warning: It
209 may be possible to crash MPlayer using this setting.</DD>
210 </DL>
211
212 </DD>
213
214 <DT><CODE>list</CODE></DT>
215 <DD>is an alias for the -af switch.</DD>
216 </DL>
217
218
219 <H5><A NAME="af_resample">2.3.2.3.1 Up/Down-sampling</A></H5>
220
221 <P>MPlayer fully supports sound up/down-sampling. This filter can be used if you
222 have a fixed frequency sound card or if you are stuck with an old sound card
223 that is only capable of max 44.1kHz. This filter is automatically enabled if
224 it is necessary, but it can also be explicitly enabled on the command line. It
225 has three switches:</P>
226
227 <DL>
228 <DT><CODE>srate</CODE></DT>
229 <DD>is an integer used for setting the output sample
230 frequency in Hz. The valid range for this parameter is 8kHz to 192kHz. If
231 the input and output sample frequency are the same or if this parameter is
232 omitted the filter is automatically unloaded. A high sample frequency
233 normally improves the audio quality, especially when used in combination
234 with other filters.</DD>
235
236 <DT><CODE>sloppy</CODE></DT>
237 <DD>is an optional binary parameter that allows the output frequency to differ
238 slightly from the frequency given by <CODE>srate</CODE>. This switch can be
239 used if the startup of the playback is extremely slow.</DD>
240
241 <DT><CODE>fast</CODE><DT>
242 <DD>is an optional binary parameter that enables linear interpolation as
243 resampling method. Linear interpolation is extremely fast, but suffers from
244 poor sound quality especially when used for up-sampling.</DD>
245 </DL>
246
247 <P>Example:<BR>
248 &nbsp;&nbsp;<CODE>mplayer -af resample=44100:0:1</CODE></P>
249
250 <P>would set the output frequency of the resample filter to 44100Hz using exact
251 output frequency scaling and linear interpolation.</P>
252
253
254 <H5><A NAME="af_channels">2.3.2.3.2 Changing the number of channels</A></H5>
255
256 <P>The <CODE>channels</CODE> filter can be used for adding and removing
257 channels, it can also be used for routing or copying channels. It is
258 automatically enabled when the output from the audio filter layer differs from
259 the input layer or when it is requested by another filter. This filter unloads
260 itself if not needed. The number of switches is dynamic:</P>
261
262 <DL>
263 <DT><CODE>nch</CODE></DT>
264 <DD>is an integer between 1 and 6 that is used for setting the number of
265 output channels. This switch is required, leaving it empty results in a
266 runtime error.</DD>
267
268 <DT><CODE>nr</CODE></DT>
269 <DD>is an integer between 1 and 6 that is used for specifying the number of
270 routes. This parameter is optional. If it is omitted the default routing is
271 used.</DD>
272
273 <DT><CODE>from1:to1:from2:to2:from3:to3...</CODE></DT>
274 <DD>are pairs of numbers between 0 and 5 that define where each channel should
275 be routed.</DD>
276 </DL>
277
278 <P>If only <CODE>nch</CODE> is given the default routing is used, it works as
279 follows: If the number of output channels is bigger than the number of input
280 channels empty channels are inserted (except mixing from mono to stereo, then
281 the mono channel is repeated in both of the output channels). If the number of
282 output channels is smaller than the number of input channels the exceeding
283 channels are truncated.</P>
284
285 <P>Example 1:<BR>
286 &nbsp;&nbsp;<CODE>mplayer -af channels=4:4:0:1:1:0:2:2:3:3 media.avi </CODE></P>
287
288 <P>would change the number of channels to 4 and set up 4 routes that swap
289 channel 0 and channel 1 and leave channel 2 and 3 intact. Observe that if
290 media containing two channels was played back, channels 2 and 3 would contain
291 silence but 0 and 1 would still be swapped.</P>
292
293 <P>Example 2:<BR>
294 &nbsp;&nbsp;<CODE>mplayer -af channels=6:4:0:0:0:1:0:2:0:3 media.avi </CODE></P>
295
296 <P>would change the number of channels to 6 and set up 4 routes that copy
297 channel 0 to channels 0 to 3. Channel 4 and 5 will contain silence.</P>
298
299
300 <H5><A NAME="af_format">2.3.2.3.3 Sample format converter</A></H5>
301
302 <P>This filter is a sample format converter. It is automatically enabled when
303 needed by the sound card or another filter.</P>
304
305 <DL>
306 <DT><CODE>bps</CODE></DT>
307 <DD>can be 1, 2 or 4 and denotes the number of bytes per sample. This switch
308 is required, leaving it empty results in a runtime error.</DD>
309
310 <DT><CODE>f</CODE></DT>
311 <DD>is a text string describing the sample format. The string is a
312 concatenated mix of: <CODE>alaw</CODE>, <CODE>mulaw</CODE> or
313 <CODE>imaadpcm</CODE>, <CODE>float</CODE> or <CODE>int</CODE>,
314 <CODE>unsigned</CODE> or <CODE>signed</CODE>, <CODE>le</CODE> or
315 <CODE>be</CODE> (little or big endian). This switch is required, leaving it
316 empty results in a runtime error.</DD>
317 </DL>
318
319 <P>Example:<BR>
320 &nbsp;&nbsp;<CODE>mplayer media.avi -af format=4:float</CODE></P>
321
322 <P>would set the output output format to 4 bytes per sample floating point
323 data.</P>
324
325
326 <H5><A NAME="af_delay">2.3.2.3.4 Delay</A></H5>
327
328 <P>This filter delays the sound to the loudspeakers in order to make the sound
329 in the different channels arrive at the same time to the listening position.
330 It is only useful if you have more than 2 loudspeakers. This filter has a
331 variable number of parameters:</P>
332
333 <DL>
334 <DT><CODE>d1:d2:d3...</CODE></DT>
335 <DD>are floating point numbers representing the delays in ms that should be
336 imposed on the different channels. The minimum delay is 0ms and the maximum
337 is 1000ms.</DD>
338 </DL>
339
340 <P>To calculate the required delay for the different channels do as follows:</P>
341
342 <OL>
343 <LI>Measure the distance to the loudspeakers in meters in relation to your
344 listening position, giving you the distances s1 to s5 (for a 5.1 system).
345 There is no point in compensating for the sub-woofer (you will not hear the
346 difference anyway).</LI>
347 <LI>Subtract the distances s1 to s5 from the maximum distance i.e.<BR>
348 s[i] = max(s) - s[i]; i = 1...5</LI>
349 <LI>Calculated the required delays in ms as<BR>
350 d[i] = 1000*s[i]/342; i = 1...5 </LI>
351 </OL>
352
353 <P>Example:<BR>
354 &nbsp;&nbsp;<CODE>mplayer -af delay=10.5:10.5:0:0:7:0 media.avi</CODE></P>
355
356 <P>would delay front left and right by 10.5ms, the two rear channels and the sub
357 by 0ms and the center channel by 7ms.</P>
358
359
360 <H5><A NAME="af_volume">2.3.2.3.5 Software volume control</A></H5>
361
362 <P>This filter is a software volume control. Use this filter with caution since
363 it can reduce the signal to noise ratio of the sound. In most cases it is best
364 to set the level for the PCM sound to max, leave this filter out and control
365 the output level to your speakers with the master volume control of the mixer.
366 If there is an external amplifier connected to the computer (this is almost
367 always the case), the noise level can be minimized by adjusting the master
368 level and the volume knob on the amplifier until the hissing noise in the
369 background is gone. This filter has two switches:</P>
370
371 <DL>
372 <DT><CODE>v</CODE></DT>
373 <DD>is a floating point number between -200 and +60 which represents the
374 volume level in dB. The default level is -10dB.</DD>
375
376 <DT><CODE>c</CODE></DT>
377 <DD>is a binary control that turns soft clipping on and off. Soft-clipping can
378 make the sound more smooth if very high volume levels are used. Enable this
379 switch if the dynamic range of the loudspeakers is very low. Be aware that
380 this feature creates distortion and should be considered a last resort.</DD>
381 </DL>
382
383 <P>Example:<BR>
384 &nbsp;&nbsp;<CODE>mplayer -af volume=10.1:0 media.avi</CODE></P>
385
386 <P>would amplify the sound by 10.1dB and hard-clip if the sound level is too
387 high.</P>
388
389 <P>This filter has a second feature: It measures the overall maximum sound level
390 and prints out that level when MPlayer exits. This volume estimate can be used
391 for setting the sound level in MEncoder such that the maximum dynamic range is
392 utilized.</P>
393
394
395 <H5><A NAME="af_equalizer">2.3.2.3.6 Equalizer</A></H5>
396
397 <P> This filter is a 10 octave band graphic equalizer, implemented using 10 IIR
398 band pass filters. This means that it works regardless of what type of audio
399 is being played back. The center frequencies for the 10 bands are:</P>
400
401 <TABLE BORDER="0" WIDTH="100%">
402 <TR><TD>Band No.</TD><TD>Center frequency</TD></TR>
403 <TR><TD>0</TD><TD>31.25 Hz</TD></TR>
404 <TR><TD>1</TD><TD>62.50 Hz</TD></TR>
405 <TR><TD>2</TD><TD>125.0 Hz</TD></TR>
406 <TR><TD>3</TD><TD>250.0 Hz</TD></TR>
407 <TR><TD>4</TD><TD>500.0 Hz</TD></TR>
408 <TR><TD>5</TD><TD>1.000 kHz</TD></TR>
409 <TR><TD>6</TD><TD>2.000 kHz</TD></TR>
410 <TR><TD>7</TD><TD>4.000 kHz</TD></TR>
411 <TR><TD>8</TD><TD>8.000 kHz</TD></TR>
412 <TR><TD>9</TD><TD>16.00 kHz</TD></TR>
413 </TABLE>
414
415 <P>If the sample rate of the sound being played back is lower than the center
416 frequency for a frequency band, then that band will be disabled. A known bug
417 with this filter is that the characteristics for the uppermost band are not
418 completely symmetric if the sample rate is close to the center frequency of
419 that band. This problem can be worked around by up-sampling the sound using
420 the resample filter before it reaches this filter. </P>
421
422 <P> This filter has 10 parameters:</P>
423
424 <DL>
425 <DT><CODE>g1:g2:g3...g10</CODE></DT>
426 <DD>are floating point numbers between -12 to +12dB representing the gain in
427 dB for each frequency band.</DD>
428 </DL>
429
430 <P>Example:<BR>
431 &nbsp;&nbsp;<CODE>mplayer -af equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi</CODE></P>
432
433 <P>would amplify the sound in the upper and lower frequency region while
434 canceling it almost completely around 1kHz.</P>
435
436 <H5><A NAME="af_panning">2.3.2.3.7 Panning filter </A></H5>
437
438 <P>This filter can be used for mixing the channels arbitrarily. It is basically
439 a combination of the volume control and the channels filter. There are two
440 major uses for this filter: </P>
441
442 <OL>
443 <LI>Down-mixing many channels to only a few, stereo to mono for example.</LI>
444 <LI>Varying the "width" of the center speaker in a surround sound system.</LI>
445 </OL>
446
447 <P>This filter is hard to use, and will require some tinkering before the
448 desired result is obtained. The number of switches for this filter depends on
449 the number of output channels:</P>
450
451 <DL>
452 <DT><CODE>nch</CODE></DT>
453 <DD>is an integer between 1 and 6 and is used for setting the number of output
454 channels. This switch is required, leaving it empty results in a runtime
455 error.</DD>
456
457 <DT><CODE>l00:l01:l02:..l10:l11:l12:...ln0:ln1:ln2:...</CODE></DT>
458 <DD>are floating point values between 0 and 1 that determine the level
459 <CODE>l[i][j]</CODE> that the input channel j is mixed into output channel
460 i.</DD>
461 </DL>
462
463 <P>Example:<BR>
464 &nbsp;&nbsp;<CODE>mplayer -af pan=1:0.5:0.5 -channels 1 media.avi</CODE></P>
465
466 <P>would down-mix from stereo to mono.</P>
467
468
469 <H2><STRONG>Note: Audio plugins have been deprecated by audio filters and will be
470 removed soon.</STRONG></H2>
471
472 <H4><A NAME="plugins">2.3.2.4 Audio plugins (deprecated)</A></H4>
154 473
155 <P>MPlayer has support for audio plugins. Audio plugins can be used for 474 <P>MPlayer has support for audio plugins. Audio plugins can be used for
156 changing the properties of the audio data before the sound reaches the sound 475 changing the properties of the audio data before the sound reaches the sound
157 card. They are enabled using the <CODE>-aop</CODE> switch which takes a 476 card. They are enabled using the <CODE>-aop</CODE> switch which takes a
158 <CODE>list=plugin1,plugin2,...</CODE> argument. The <CODE>list</CODE> argument 477 <CODE>list=plugin1,plugin2,...</CODE> argument. The <CODE>list</CODE> argument
171 490
172 <P>&nbsp;&nbsp;<CODE>mplayer media.avi -aop 491 <P>&nbsp;&nbsp;<CODE>mplayer media.avi -aop
173 list=resample,format:fout=44100:format=0x8</CODE></P> 492 list=resample,format:fout=44100:format=0x8</CODE></P>
174 493
175 <P>would set the output frequency of the resample plugin to 44100Hz and the 494 <P>would set the output frequency of the resample plugin to 44100Hz and the
176 output format of the format plugin to AFMT_U8.</P> 495 output format of the format plugin to AFMT_U8.</P>
177 496
178 <P>Currently audio plugins can not be used in MEncoder.</P> 497 <P>Currently audio plugins can not be used in MEncoder.</P>
179 498
180 499
181 <H5><A NAME="resample">2.3.2.3.1 Up/Downsampling</A></H5> 500 <H5><A NAME="resample">2.3.2.4.1 Up/Downsampling</A></H5>
182 501
183 <P>MPlayer fully supports up/downsampling of the sound. This plugin can 502 <P>MPlayer fully supports up/downsampling of the sound. This plugin can
184 be used if you have a fixed frequency sound card or if you are 503 be used if you have a fixed frequency sound card or if you are
185 stuck with an old sound card that is only capable of max 44.1kHz. 504 stuck with an old sound card that is only capable of max 44.1kHz.
186 Whether is usage of this plugin is neccessary or not, is <B>autodetected</B>. 505 Whether is usage of this plugin is necessary or not, is <B>autodetected</B>.
187 This plugin has one switch: 506 This plugin has one switch:
188 <CODE>fout</CODE> which is used for setting the desired output sample 507 <CODE>fout</CODE> which is used for setting the desired output sample
189 frequency. It defaults to 48kHz, and is given in 508 frequency. It defaults to 48kHz, and is given in
190 &lt;Hz&gt;.</P> 509 &lt;Hz&gt;.</P>
191 510
196 <P>Note that the output frequency should not be scaled up from the default value. 515 <P>Note that the output frequency should not be scaled up from the default value.
197 Scaling up will cause the audio and video streams to be played in slow motion 516 Scaling up will cause the audio and video streams to be played in slow motion
198 in addition to audio distortion.</P> 517 in addition to audio distortion.</P>
199 518
200 519
201 <H5><A NAME="surround_decoding">2.3.2.3.2 Surround Sound decoding</A></H5> 520 <H5><A NAME="surround_decoding">2.3.2.4.2 Surround Sound decoding</A></H5>
202 521
203 <P>MPlayer has an audio plugin that can decode matrix encoded 522 <P>MPlayer has an audio plugin that can decode matrix encoded
204 surround sound. Dolby Surround is an example of a matrix encoded format. 523 surround sound. Dolby Surround is an example of a matrix encoded format.
205 Many files with 2 channel audio actually contain matrixed surround sound. 524 Many files with 2 channel audio actually contain matrixed surround sound.
206 To use this feature you need a sound card supporting at least 4 channels.</P> 525 To use this feature you need a sound card supporting at least 4 channels.</P>
208 <P>Usage:<BR> 527 <P>Usage:<BR>
209 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=surround</CODE></P> 528 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=surround</CODE></P>
210 529
211 530
212 <H5><A NAME="format">2.3.2.3.3 Sample format converter</A></H5> 531 <H5><A NAME="format">2.3.2.3.3 Sample format converter</A></H5>
213 532
214 <P>If your sound card driver does not support signed 16bit <CODE>int</CODE> data type, 533 <P>If your sound card driver does not support signed 16bit <CODE>int</CODE> data type,
215 this plugin can 534 this plugin can
216 be used to change the format to one which your sound card can understand. It 535 be used to change the format to one which your sound card can understand. It
217 has one switch, <CODE>format</CODE>, which can be set to one of the numbers 536 has one switch, <CODE>format</CODE>, which can be set to one of the numbers
218 found in <CODE>libao2/afmt.h</CODE>. This plugin is hardly ever needed and is 537 found in <CODE>libao2/afmt.h</CODE>. This plugin is hardly ever needed and is
219 intended for advanced users. Keep in mind that this plugin only changes the 538 intended for advanced users. Keep in mind that this plugin only changes the
222 <P>Usage:<BR> 541 <P>Usage:<BR>
223 &nbsp;&nbsp;<CODE>mplayer media.avi -aop 542 &nbsp;&nbsp;<CODE>mplayer media.avi -aop
224 list=format:format=&lt;required output format&gt;</CODE></P> 543 list=format:format=&lt;required output format&gt;</CODE></P>
225 544
226 545
227 <H5><A NAME="delay">2.3.2.3.4 Delay</A></H5> 546 <H5><A NAME="delay">2.3.2.4.4 Delay</A></H5>
228 547
229 <P>This plugin delays the sound and is intended as an example of how to develop 548 <P>This plugin delays the sound and is intended as an example of how to develop
230 new plugins. It can not be used for anything useful from a users perspective 549 new plugins. It can not be used for anything useful from a users perspective
231 and is mentioned here for the sake of completeness only. Do not use this 550 and is mentioned here for the sake of completeness only. Do not use this
232 plugin unless you are a developer.</P> 551 plugin unless you are a developer.</P>
233 552
234 553
235 <H5><A NAME="volume">2.3.2.3.5 Software volume control</A></H5> 554 <H5><A NAME="volume">2.3.2.4.5 Software volume control</A></H5>
236 555
237 <P>This plugin is a software replacement for the volume control, and 556 <P>This plugin is a software replacement for the volume control, and
238 can be used on machines with a broken mixer device. It can also be 557 can be used on machines with a broken mixer device. It can also be
239 used if one wants to change the output volume of MPlayer 558 used if one wants to change the output volume of MPlayer
240 without changing the PCM volume setting in the mixer. It has one 559 without changing the PCM volume setting in the mixer. It has one
263 <P>Usage:<BR> 582 <P>Usage:<BR>
264 &nbsp;&nbsp;<CODE>mplayer media.avi -aop 583 &nbsp;&nbsp;<CODE>mplayer media.avi -aop
265 list=volume:softclip</CODE></P> 584 list=volume:softclip</CODE></P>
266 585
267 586
268 <H5><A NAME="extrastereo">2.3.2.3.6 Extrastereo</A></H5> 587 <H5><A NAME="extrastereo">2.3.2.4.6 Extrastereo</A></H5>
269 588
270 <P>This plugin (linearly) increases the difference between left and right 589 <P>This plugin (linearly) increases the difference between left and right
271 channels (like the XMMS extrastereo plugin) which gives some sort of "live" 590 channels (like the XMMS extrastereo plugin) which gives some sort of "live"
272 effect to playback.</P> 591 effect to playback.</P>
273 592
279 to 2.5. If you set it to 0.0, you will have mono sound (average of both 598 to 2.5. If you set it to 0.0, you will have mono sound (average of both
280 channels). If you set it to 1.0, sound will be unchanged, if you set it to 599 channels). If you set it to 1.0, sound will be unchanged, if you set it to
281 -1.0, left and right channels will be swapped.</P> 600 -1.0, left and right channels will be swapped.</P>
282 601
283 602
284 <H5><A NAME="normalizer">2.3.2.3.7 Volume normalizer</A></H5> 603 <H5><A NAME="normalizer">2.3.2.4.7 Volume normalizer</A></H5>
285 604
286 <P>This plugin maximizes the volume without distorting the sound.</P> 605 <P>This plugin maximizes the volume without distorting the sound.</P>
287 606
288 <P>Usage:<BR> 607 <P>Usage:<BR>
289 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=volnorm</CODE><BR> 608 &nbsp;&nbsp;<CODE>mplayer media.avi -aop list=volnorm</CODE><BR>