Ch. 12 · Audio Codecs

한국어日本語
7 min

Surround and Lossless: AC-3, E-AC-3, and FLAC

Why are the AC-3 family so widely used for surround sound in broadcast, film, and streaming? And how does lossless compression (FLAC) differ from lossy codecs?

AC-3 and E-AC-3 (Dolby Digital / Dolby Digital Plus)

AC-3 is Dolby's codec, which spread widely under the name Dolby Digital across DVDs, digital broadcasting, and home AV equipment. Its signature use is carrying 5.1-channel surround in a single stream. E-AC-3 (Dolby Digital Plus) is its successor, extending it to code more efficiently and support a wider range of channel configurations. Both codecs belong to the same perceptual-coding family as the previous lessons, and since they are Dolby's proprietary technology, they are known to require a license to use.

AC-3E-AC-3
AliasDolby DigitalDolby Digital Plus
Typical channel configurationsStereo to 5.15.1 and above (used up to 7.1)
Bitrate ceiling640 kbpsDesigned to go higher than AC-3
Where you typically see itDVD, broadcast, optical output (S/PDIF) passthroughSurround on streaming services, some object-based audio delivery

The values in the table are commonly known specifications. Actual bitrates differ from service to service.

In the field: passthrough

When you send AC-3/E-AC-3 as is to a TV or soundbar, the device decodes it itself. In that case the player can hand over the encoded stream untouched (passthrough) instead of decoding it to PCM, but if the device doesn't support that codec, you get no sound or it collapses to stereo. A lot of surround problems come down to "does the device know this codec?" It is similar to the hardware decoding situation from Chapter 10.

FLAC: lossless compression

FLAC (Free Lossless Audio Codec) is a lossless codec that restores audio bit-for-bit identical to the original PCM. It fits the samples with linear prediction and writes the remaining error compactly with Rice coding, which resembles the "prediction → residual → entropy coding" structure you already know from Chapter 3. In exchange, since nothing is thrown away as in perceptual coding, the size savings are limited. It varies with the music, so it is hard to give an exact ratio, but it is generally known to shrink files to somewhere around half of the original PCM.

Lossy (AAC/Opus/MP3)Lossless (FLAC)
Restoring the originalImpossible (parts that wouldn't be heard are discarded)Restored identically, bit for bit
File sizeSmall (greatly reduced versus PCM)Relatively large (reduced versus PCM, but with a limit)
Bitrate controlFreely chosenDetermined by the content (grows when the music is complex)
Used forDistribution, streaming, video audioArchiving, masters, selling high-quality music
Lossless is for archiving; lossy is for delivery

The standard practice is to use a lossless format such as FLAC or WAV (PCM) for editing and archiving, and to lossy-encode to AAC/Opus only once, at the very end, when you send it to viewers. It is the same structure as keeping a master on the video side (an editing codec like ProRes from Chapter 9) and producing only the delivery copy as H.264/AV1.

Convert WAV to FLAC, then verify they really are the same
ffmpeg -i master.wav -c:a flac -compression_level 8 master.flac

# If the PCM hashes of the two files match, it was restored losslessly
ffmpeg -i master.wav  -map 0:a -f hash -hash md5 -
ffmpeg -i master.flac -map 0:a -f hash -hash md5 -
AC-3AC-3 (Dolby Digital)

Dolby's perceptual coding codec. Widely delivers 5.1 surround on DVD and in broadcast.

E-AC-3E-AC-3 (Dolby Digital Plus)

The extended version of AC-3. Higher efficiency and a wider range of channel configurations.

FLACFLAC

An open-source lossless audio codec. Restores audio bit-for-bit identical to the original PCM.

PassthroughPassthrough

Sending the encoded audio stream as is to an external device without decoding it.

LosslessLossless (audio)

A method where the exact original samples can be restored after compression.

Check yourself

What happens when you decode a FLAC file back to WAV (PCM)?