7.2. Audio codecs
Prev | Chapter 7. Codecs | Next

## 7.2. Audio codecs

The most important audio codecs above all:

- MPEG layer 1/2/3 (MP1/2/3) audio (native code, with MMX/SSE/3DNow! optimization)
- Windows Media Audio 7 and 8 (AKA WMAv1 and WMAv2) (native code, with `libavcodec`)
- Windows Media Audio 9 (WMAv3) (using DMO DLL)
- AC3 Dolby audio (native code, with MMX/SSE/3DNow! optimization)
- AC3 passing through sound card hardware
- AAC
- Ogg Vorbis audio codec (native library)
- RealAudio: DNET (low bitrate AC3), Cook, Sipro and ATRAC3
- QuickTime: Qualcomm and QDesign audio codecs
- VIVO audio (g723, Vivo Siren)
- Voxware audio (using DirectShow DLL)
- alaw and ulaw, various gsm, adpcm and pcm formats and other simple old audio codecs
- Adaptive Multi-Rate (AMR) speech codecs

### 7.2.1. Software AC3 decoding

This is the default decoder used for files with AC3 audio.

The AC3 decoder can create audio output mixes for 2, 4, or 6 speakers. When configured for 6 speakers, this decoder provides separate output of all the AC3 channels to the sound driver, allowing for full "surround sound" experience without the external AC3 decoder required to use the hwac3 codec.

Use the `-channels` option to select the number of output channels. Use `-channels 2` for a stereo downmix. For a 4 channel downmix (Left Front, Right Front, Left Surround and Right Surround outputs), use `-channels 4`. In this case, any center channel will be mixed equally to the front channels. `-channels 6` will output all the AC3 channels as they are encoded - in the order Left, Right, Left Surround, Right Surround, Center and LFE.

The default number of output channels is 2.

To use more than 2 output channels, you will need to use OSS, and have a sound card that supports the appropriate number of output channels via the SNDCTL_DSP_CHANNELS ioctl. An example of a suitable driver is emu10k1 (used by Soundblaster Live! cards) from August 2001 or newer (ALSA CVS is also supposed to work).

### 7.2.2. Hardware AC3 decoding

You need an AC3 capable sound card, with digital out (S/PDIF). The card's driver must properly support the AFMT_AC3 format (C-Media does). Connect your AC3 decoder to the S/PDIF output, and use the `-ac hwac3` option. It is experimental but known to work with C-Media cards and Soundblaster Live! + ALSA (but not OSS) drivers and DXR3/Hollywood+ MPEG decoder cards.

### 7.2.3. libmad support

libmad is a multiplatform, integer (internally 24bit PCM) only MPEG audio decoding library. It does not handle broken files well, and it sometimes has problems with seeking, but it may perform better on FPU-less (such as ARM) platform than mp3lib.

To enable support, compile with the `--enable-mad` configure option.

### 7.2.4. Hardware MPEG audio codec

This codec (selected by -ac hwmpa) passes through MPEG audio packets to hardware decoders, such as the ones found in full-featured DVB cards and DXR2 adapters. Don't use it in combination with any other audio output device (such as OSS and ALSA) that isn't able to decode it (you will hear only white noise).

### 7.2.5. VIVO audio

The audio codec used in VIVO files depends on whether it is a VIVO/1.0 or VIVO/2.0 file. VIVO/1.0 files have g.723 audio, and VIVO/2.0 files have Vivo Siren audio. Both are supported.

### 7.2.6. RealAudio

MPlayer supports decoding nearly all versions of RealAudio:

- RealAudio DNET - decoding supported by `liba52`
- RealAudio Cook/Sipro/ATRAC3 - decoding supported by RealPlayer libraries

Instructions on how to install the RealPlayer libraries are in the RealVideo section.

### 7.2.7. QDesign codecs

QDesign audio streams (fourcc:QDMC, QDM2) are found in MOV/QT files. Both versions of this codec can be decoded with QuickTime libraries. For installation instructions please see the Sorenson video codec section.

### 7.2.8. Qualcomm codecs

Qualcomm audio streams (fourcc:Qclp) is found in MOV/QT files. It can be decoded with QuickTime libraries. For installation instructions please see the Sorenson video codec section.

### 7.2.9. AAC codec

AAC (Advanced Audio Coding) is an audio codec sometimes found in MOV and MP4 files. An open source decoder called FAAD is available from http://www.audiocoding.com. MPlayer includes a CVS snapshot of libfaad 2.1 beta, so you do not need to get it separately.

If you use gcc 3.2 which fails to compile our internal FAAD or want to use the external library for some other reason, download the library from the download page and pass `--enable-external-faad` to `configure`. You do not need all of faad2 to decode AAC files, libfaad is enough. Build it like this:

    cd faad2/
    sh bootstrap
    ./configure
    cd libfaad
    make
    make install

Binaries are not available from audiocoding.com, but you can (apt-)get Debian packages from Christian Marillat's homepage, Mandrake/Mandriva RPMs from the P.L.F and RedHat RPMs from Grey Sector.

### 7.2.10. AMR codecs

Adaptive Multi-Rate speech codec is used in third generation (3G) mobile phones. Reference implementation is available from The 3rd Generation Partnership Project (free for private use).

To enable support, download the sources for AMR-NB and AMR-WB codecs, put them in the directory where you unpacked the MPlayer source and run the following commands:

    unzip 26104-610.zip
    unzip 26104-610_ANSI_C_source_code.zip
    mv c-code libavcodec/amr_float
    unzip 26204-600.zip
    unzip 26204-600_ANSI-C_source_code.zip
    mv c-code libavcodec/amrwb_float

After that, follow the usual MPlayer build procedure.

Prev | Up | Next
7.1. Video codecs | Home | 7.3. Win32 codecs importing HOWTO