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)

- AC-3 Dolby audio (native code, with MMX/SSE/3DNow! optimization)

- AC-3 passing through sound card hardware

- AAC

- Ogg Vorbis audio codec (native library)

- RealAudio: DNET (low bitrate AC-3), 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 AC-3 decoding

This is the default decoder used for files with AC-3 audio.

The AC-3 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 AC-3 channels to the sound driver, allowing for full "surround sound" experience without the external AC-3 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 AC-3 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 AC-3 decoding

You need an AC-3 capable sound card, with digital out (S/PDIF). The card's driver must properly support the AFMT_AC3 format (C-Media does). Connect your AC-3 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`.

If you have a proper installation of `libmad`, `./configure` will notice and support for MPEG audio decoding via `libmad` will be built automatically.

### 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. 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-faad-external` 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 Fedora RPMs from Livna.

### 7.2.6. 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 and install support libraries for AMR-NB and AMR-WB following the instructions on that page. Recompile MPlayer afterwards.

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