3.9. Surround/Multichannel playback

3.9.1. DVDs

Most DVDs and many other files include surround sound. MPlayer supports surround playback but does not enable it by default because stereo equipment is by far more common. To play a file that has more than two channels of audio use -channels. For example, to play a DVD with 5.1 audio:

mplayer dvd://1 -channels 6

Note that despite the name "5.1" there are actually six discrete channels. If you have surround sound equipment it is safe to put the channels option in your MPlayer configuration file ~/.mplayer/config. For example, to make quadraphonic playback the default, add this line:

channels=4

MPlayer will then output audio in four channels when all four channels are available.

3.9.2. Playing stereo files to four speakers

MPlayer does not duplicate any channels by default, and neither do most audio drivers. If you want to do that manually:

mplayer filename -af channels=2:2:0:1:0:0

See the section on channel copying for an explanation.

3.9.3. AC-3/DTS Passthrough

DVDs usually have surround audio encoded in AC-3 (Dolby Digital) or DTS (Digital Theater System) format. Some modern audio equipment is capable of decoding these formats internally. MPlayer can be configured to relay the audio data without decoding it. This will only work if you have a S/PDIF (Sony/Philips Digital Interface) jack in your sound card, or if you are passing audio over HDMI.

If your audio equipment can decode both AC-3 and DTS, you can safely enable passthrough for both formats. Otherwise, enable passthrough for only the format your equipment supports.

To enable passthrough on the command line:

  • For AC-3 only, use -ac hwac3

  • For DTS only, use -ac hwdts

  • For both AC-3 and DTS, use -afm hwac3

To enable passthrough in the MPlayer configuration file:

  • For AC-3 only, use ac=hwac3,

  • For DTS only, use ac=hwdts,

  • For both AC-3 and DTS, use afm=hwac3

Note that there is a comma (",") at the end of ac=hwac3, and ac=hwdts,. This will make MPlayer fall back on the codecs it normally uses when playing a file that does not have AC-3 or DTS audio. afm=hwac3 does not need a comma; MPlayer will fall back anyway when an audio family is specified.

3.9.4. MPEG audio Passthrough

Digital TV transmissions (such as DVB and ATSC) and some DVDs usually have MPEG audio streams (in particular MP2). Some MPEG hardware decoders such as full-featured DVB cards and DXR2 adapters can natively decode this format. MPlayer can be configured to relay the audio data without decoding it.

To use this codec:

 mplayer -ac hwmpa 

3.9.5. Matrix-encoded audio

***TODO***

This section has yet to be written and cannot be completed until somebody provides sample files for us to test. If you have any matrix-encoded audio files, know where to find some, or have any information that could be helpful, please send a message to the MPlayer-DOCS mailing list. Put "[matrix-encoded audio]" in the subject line.

If no files or further information are forthcoming this section will be dropped.

Good links:

3.9.6. Surround emulation in headphones

MPlayer includes an HRTF (Head Related Transfer Function) filter based on an MIT project wherein measurements were taken from microphones mounted on a dummy human head.

Although it is not possible to exactly imitate a surround system, MPlayer's HRTF filter does provide more spatially immersive audio in 2-channel headphones. Regular downmixing simply combines all the channels into two; besides combining the channels, hrtf generates subtle echoes, increases the stereo separation slightly, and alters the volume of some frequencies. Whether HRTF sounds better may be dependent on the source audio and a matter of personal taste, but it is definitely worth trying out.

To play a DVD with HRTF:

mplayer dvd://1 -channels 6 -af hrtf

hrtf only works well with 5 or 6 channels. Also, hrtf requires 48 kHz audio. DVD audio is already 48 kHz, but if you have a file with a different sampling rate that you want to play using hrtf you must resample it:

mplayer filename -channels 6 -af resample=48000,hrtf

3.9.7. Troubleshooting

If you do not hear any sound out of your surround channels, check your mixer settings with a mixer program such as alsamixer; audio outputs are often muted and set to zero volume by default.