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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect2 id="audio-dev">
<title>Audio output devices</title>
<sect3 id="sync">
<title>Audio/Video synchronisation</title>
<para>
<application>MPlayer</application>'s audio interface is called
<emphasis>libao2</emphasis>. It currently contains these drivers:
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row><entry>Driver</entry><entry>Comment</entry></row>
</thead>
<tbody>
<row><entry>oss</entry><entry>
OSS (ioctl) driver (supports hardware AC3 passthrough)
</entry></row>
<row><entry>sdl</entry><entry>
SDL driver (supports sound daemons like <emphasis role="bold">ESD</emphasis>
and <emphasis role="bold">ARTS</emphasis>)
</entry></row>
<row><entry>nas</entry><entry>
NAS (Network Audio System) driver
</entry></row>
<row><entry>alsa5</entry><entry>
native ALSA 0.5 driver
</entry></row>
<row><entry>alsa9</entry><entry>
native ALSA 0.9 driver (supports hardware AC3 passthrough)
</entry></row>
<row><entry>sun</entry><entry>
SUN audio driver (<filename>/dev/audio</filename>) for BSD and Solaris8 users
</entry></row>
<row><entry>macosx</entry><entry>
native MacOSX driver
</entry></row>
<row><entry>win32</entry><entry>
native Win32 driver
</entry></row>
<row><entry>arts</entry><entry>
native ARTS driver (mostly for KDE users)
</entry></row>
<row><entry>esd</entry><entry>
native ESD driver (mostly for GNOME users)
</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>
Linux sound card drivers have compatibility problems. This is because
<application>MPlayer</application> relies on an in-built feature of
<emphasis>properly</emphasis> coded sound drivers that enable them to
maintain correct audio/video sync. Regrettably, some driver authors
don't take the care to code this feature since it is not needed for
playing MP3s or sound effects.
</para>
<para>
Other media players like <ulink url="http://avifile.sourceforge.net">aviplay</ulink>
or <ulink url="http://xine.sourceforge.net">xine</ulink> possibly work
out-of-the-box with these drivers because they use "simple" methods
with internal timing. Measuring showed that their methods are not as
efficient as <application>MPlayer</application>'s.
</para>
<para>
Using <application>MPlayer</application> with a properly written audio
driver will never result in A/V desyncs related to the audio, except
only with very badly created files (check the man page for workarounds).
</para>
<para>
If you happen to have a bad audio driver, try the <option>-autosync</option>
option, it should sort out your problems. See the man page for detailed
information.
</para>
<itemizedlist>
<title>Some notes:</title>
<listitem><para>
If you have an OSS driver, first try <option>-ao oss</option> (this is
the default). If you experience glitches, halts or anything out of the
ordinary, try <option>-ao sdl</option> (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 (GNOME) and ARTS (KDE).
</para></listitem>
<listitem><para>
If you have ALSA version 0.5, then you almost always have to use
<option>-ao alsa5</option>, since ALSA 0.5 has buggy OSS emulation code,
and will <emphasis role="bold">crash <application>MPlayer</application></emphasis>
with a message like this:
<screen>
DEMUXER: Too many (945 in 8390980 bytes) video packets in the buffer!<!--
--></screen>
</para></listitem>
<listitem><para>
On Solaris, use the SUN audio driver with the <option>-ao sun</option> option,
otherwise neither video nor audio will work.
</para></listitem>
<listitem><para>
If the sound clicks when playing from CD-ROM, turn on IRQ unmasking, e.g.
<command>hdparm -u1 /dev/cdrom</command> (<command>man hdparm</command>).
This is generally beneficial and described in more detail in the
<link linkend="drives">CD-ROM</link> section.
</para></listitem>
</itemizedlist>
</sect3>
<sect3 id="experiences">
<title>Soundcard experiences, recommendations</title>
<para>
On Linux, a 2.4.x kernel is highly recommended. Kernel 2.2 is not tested.
</para>
<para>
Linux sound drivers are primarily provided by the free version of OSS.
These drivers have been superseded by <ulink url="http://www.alsa-project.org">ALSA</ulink>
(Advanced Linux Sound Architecture) in the 2.5 development series. If
your distribution does not already use ALSA you may wish to try their
drivers if you experience sound problems. ALSA drivers are generally
superior to OSS in compatibility, performance and features. But some
sound cards are only supported by the commercial OSS drivers from
<ulink url="http://www.opensound.com/">4Front Technologies</ulink>.
They also support several non-Linux systems.
</para>
<informaltable>
<tgroup cols="8">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<colspec colname="c4"/>
<colspec colname="c5"/>
<colspec colname="c6"/>
<colspec colname="c7"/>
<colspec colname="c8"/>
<spanspec spanname="driver" namest="c2" nameend="c5"/>
<spanspec spanname="ossfree" namest="c2" nameend="c2"/>
<spanspec spanname="alsa" namest="c3" nameend="c3"/>
<spanspec spanname="osspro" namest="c4" nameend="c4"/>
<spanspec spanname="others" namest="c5" nameend="c5"/>
<thead>
<row>
<entry morerows="2" valign="middle">SOUND CARD</entry>
<entry spanname="driver">DRIVER</entry>
<entry morerows="2" valign="middle">Max kHz</entry>
<entry morerows="2" valign="middle">Max Channels</entry>
<entry morerows="2" valign="middle">Max Opens
<footnote id="maxopens">
<para>the number of applications that are able to use
the device <emphasis>at the same time</emphasis>.</para>
</footnote>
</entry>
</row>
<row>
<entry spanname="ossfree">OSS/Free</entry>
<entry spanname="alsa">ALSA</entry>
<entry spanname="osspro">OSS/Pro</entry>
<entry spanname="others">other</entry>
</row>
</thead>
<tbody>
<row>
<entry>VIA onboard (686/A/B, 8233, 8235)</entry>
<entry>
<ulink url="http://sourceforge.net/project/showfiles.php?group_id=3242&release_id=59602">via82cxxx_audio</ulink>
</entry>
<entry>snd-via82xx</entry>
<entry></entry>
<entry></entry>
<entry>4-48 kHz or 48 kHz only, depending on the chipset</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>Aureal Vortex 2</entry>
<entry>none</entry>
<entry>none</entry>
<entry>OK</entry>
<entry>
<ulink url="http://aureal.sourceforge.net">Linux Aureal Drivers</ulink>
<ulink url="http://makacs.poliod.hu/~pontscho/aureal/au88xx-1.1.3.tar.bz2">buffer size increased to 32k</ulink>
</entry>
<entry>48</entry>
<entry>4.1</entry>
<entry>5+</entry>
</row>
<row>
<entry>SB Live!</entry>
<entry>Analog OK, S/PDIF not working</entry>
<entry>Both OK</entry>
<entry>Both OK</entry>
<entry>
<ulink url="http://opensource.creative.com">Creative's OSS driver (S/PDIF support)</ulink>
</entry>
<entry>192</entry>
<entry>4.0/5.1</entry>
<entry>32</entry>
</row>
<row>
<entry>SB 128 PCI (es1371)</entry>
<entry>OK</entry>
<entry>?</entry>
<entry></entry>
<entry></entry>
<entry>48</entry>
<entry>stereo</entry>
<entry>2</entry>
</row>
<row>
<entry>SB AWE 64</entry>
<entry>max 44kHz</entry>
<entry>48kHz sounds bad</entry>
<entry></entry>
<entry></entry>
<entry>48</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>GUS PnP</entry>
<entry>none</entry>
<entry>OK</entry>
<entry>OK</entry>
<entry></entry>
<entry>48</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>Gravis UltraSound ACE</entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>Gravis UltraSound MAX</entry>
<entry>OK</entry>
<entry>OK (?)</entry>
<entry></entry>
<entry></entry>
<entry>48</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>ESS 688</entry>
<entry>OK</entry>
<entry>OK (?)</entry>
<entry></entry>
<entry></entry>
<entry>48</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>C-Media cards (CMI8338/8738)</entry>
<entry>OK</entry>
<entry>OK S/PDIF is supported with ALSA 0.9.x</entry>
<entry>?</entry>
<entry></entry>
<entry>44</entry>
<entry>stereo</entry>
<entry>1</entry>
</row>
<row>
<entry>Yamaha cards (*ymf*)</entry>
<entry>not OK (?) (maybe <option>-ao sdl</option>)</entry>
<entry>OK only with ALSA 0.5 with OSS emulation
<emphasis role="bold">AND</emphasis> <option>-ao sdl</option> (!) (?)</entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>Cards with envy24 chips (like Terratec EWS88MT)</entry>
<entry>?</entry>
<entry>?</entry>
<entry>OK</entry>
<entry></entry>
<entry>?</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>PC Speaker or DAC</entry>
<entry>OK</entry>
<entry>none</entry>
<entry></entry>
<entry>
<ulink url="http://www.geocities.com/stssppnn/pcsp.html">Linux PC speaker OSS driver</ulink>
</entry>
<entry>The driver emulates 44.1, maybe more.</entry>
<entry>mono</entry>
<entry>1</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Feedback to this document is welcome. Please tell us how
<application>MPlayer</application> and your sound card(s) worked together.
</para>
</sect3>
<sect3 id="af">
<title>Audio filters</title>
<para>
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 <option>-af filter1,filter2,...</option>
option 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.
</para>
<para>
Example:
<screen>mplayer -af resample,pan <replaceable>movie.avi</replaceable></screen>
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.
</para>
<para>
The filters often have options that change their behavior. These options
are explained in detail in the sections below. A filter will execute using
default settings if its options are omitted. Here is an example of how to use
filters in combination with filter specific options:
<screen>mplayer -af resample=11025,pan=1:0.5:0.5 -channels 1 -srate 11025 <replaceable>media.avi</replaceable></screen>
would set the output frequency of the resample filter to 11025Hz and downmix
the audio to 1 channel using the pan filter.
</para>
<para>
The overall execution of the filter layer is controlled using the
<option>-af-adv</option> option. This option has two suboptions:
</para>
<para>
<option>force</option> is a bit field that controls how the filters
are inserted and what speed/accuracy optimizations they use:
</para>
<variablelist>
<varlistentry>
<term><option>0</option></term>
<listitem><para>
Use automatic insertion of filters and optimize according to CPU speed.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>1</option></term>
<listitem><para>
Use automatic insertion of filters and optimize for the highest speed.
<emphasis>Warning:</emphasis> Some features in the audio filters may
silently fail, and the sound quality may drop.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>2</option></term>
<listitem><para>
Use automatic insertion of filters and optimize for quality.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>3</option></term>
<listitem><para>
Use no automatic insertion of filters and no optimization.
<emphasis>Warning:</emphasis> It may be possible to crash <application>MPlayer</application>
using this setting.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>4</option></term>
<listitem><para>
Use automatic insertion of filters according to 0 above,
but use floating point processing when possible.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>5</option></term>
<listitem><para>
Use automatic insertion of filters according to 1 above,
but use floating point processing when possible.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>6</option></term>
<listitem><para>
Use automatic insertion of filters according to 2 above,
but use floating point processing when possible.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>7</option></term>
<listitem><para>
Use no automatic insertion of filters according to 3 above,
and use floating point processing when possible.
</para></listitem>
</varlistentry>
</variablelist>
<para>
<option>list</option> is an alias for the -af option.
</para>
<para>
The filter layer is also affected by the following generic options:
</para>
<variablelist>
<varlistentry>
<term><option>-v</option></term>
<listitem><para>
Increases the verbosity level and makes most filters print out extra
status messages.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-channels</option></term>
<listitem><para>
This option sets the number of output channels you would like your
sound card to use. 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.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-srate</option></term>
<listitem><para>
This option selects the sample rate you would like your sound card
to use (of course the cards have limits on this). 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.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-format</option></term>
<listitem><para>
This option sets the sample format between 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.
</para></listitem>
</varlistentry>
</variablelist>
<sect4 id="af_resample">
<title>Up/Downsampling</title>
<para>
<application>MPlayer</application> fully supports sound up/down-sampling through the
<option>resample</option> 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 options:
</para>
<variable
|