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