Encode Audio to AAC-HE with FFmpeg

This article provides a quick guide on how to encode audio streams into High-Efficiency AAC (HE-AAC) using FFmpeg. You will learn about the required external library, the specific commands for both HE-AAC Version 1 and Version 2, and the optimal bitrate configurations for low-bandwidth audio compression.

Prerequisites: The libfdk_aac Library

FFmpeg’s native AAC encoder does not support High-Efficiency profiles (HE-AAC). To encode to HE-AAC, you must use the Fraunhofer FDK AAC library (libfdk_aac).

Because this library is under a non-free license, it is not included in standard, pre-compiled FFmpeg builds. You must use a build of FFmpeg compiled with the --enable-libfdk-aac flag (and usually --enable-nonfree). You can verify if your FFmpeg installation supports it by running:

ffmpeg -codecs | grep fdk

How to Encode to HE-AAC Version 1 (v1)

HE-AAC v1 is ideal for stereo audio at bitrates between 48kbps and 64kbps. It uses Spectral Band Replication (SBR) to reconstruct high-frequency signals.

Use the following command to encode an audio file to HE-AAC v1:

ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k output.m4a
  • -c:a libfdk_aac: Selects the FDK AAC encoder.
  • -profile:a aac_he: Enables the High-Efficiency AAC profile.
  • -b:a 64k: Sets the audio bitrate to 64 kbps (recommended target for v1 stereo).

How to Encode to HE-AAC Version 2 (v2)

HE-AAC v2 is optimized for even lower bitrates, typically between 24kbps and 32kbps for stereo. It adds Parametric Stereo (PS) to the SBR technology. Note that HE-AAC v2 only supports stereo input.

To encode to HE-AAC v2, use this command:

ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he_v2 -b:a 32k output.m4a
  • -profile:a aac_he_v2: Enables the HE-AAC v2 profile.
  • -b:a 32k: Sets the audio bitrate to 32 kbps.

Bitrate Selection Guide

Using the correct profile for your target bitrate ensures the best possible audio quality:

  • Below 32 kbps: Use HE-AAC v2 (aac_he_v2).
  • 32 kbps to 80 kbps: Use HE-AAC v1 (aac_he).
  • Above 80 kbps to 96 kbps: Use standard AAC-LC (Low Complexity), as the high-efficiency tools lose their advantage at higher bitrates.