Configure Parametric Stereo for libfdk_aac in FFmpeg

This article explains how to configure and enable Parametric Stereo (PS) using the libfdk_aac encoder in FFmpeg. You will learn the specific command-line options required to activate High-Efficiency AAC Version 2 (HE-AAC v2), which utilizes Parametric Stereo to deliver quality audio at extremely low bitrates, along with practical command examples and configuration requirements.

Prerequisites

To use Parametric Stereo, your version of FFmpeg must be compiled with the external Fraunhofer FDK AAC library. Because this library is incompatible with the GPL, you must use a self-compiled or custom build of FFmpeg configured with the following flags:

  • --enable-libfdk-aac
  • --enable-nonfree

How to Enable Parametric Stereo

Parametric Stereo is the core technology behind the HE-AAC v2 profile. To enable Parametric Stereo in FFmpeg, you must explicitly instruct the libfdk_aac encoder to use the HE-AAC v2 profile.

Run the following command to encode an audio file using Parametric Stereo:

ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he_v2 -b:a 32k output.m4a

Command Parameters Explained

  • -c:a libfdk_aac: Selects the Fraunhofer FDK AAC encoder.
  • -profile:a aac_he_v2: Sets the audio profile to HE-AAC v2. This profile automatically enables Parametric Stereo (PS) alongside Spectral Band Replication (SBR).
  • -b:a 32k: Sets the target audio bitrate. Parametric Stereo is designed and optimized for ultra-low bitrates, typically between 16 kbps and 48 kbps for a stereo signal.

Critical Configuration Constraints

When configuring Parametric Stereo, you must adhere to the following audio constraints:

  • Stereo Input is Required: Parametric Stereo works by encoding a mono downmix of the left and right channels along with a small amount of parametric side information describing the stereo image. If your source file is mono, the HE-AAC v2 profile cannot be used.
  • Multichannel Downmixing: If your source file is surround sound (such as 5.1 channel audio), you must downmix it to stereo using the -ac 2 parameter for Parametric Stereo to function.

Here is an example of downmixing a multichannel audio file to stereo while applying the Parametric Stereo profile:

ffmpeg -i input_surround.wav -c:a libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k output.m4a