Changes between Version 72 and Version 73 of Encode/AAC


Ignore:
Timestamp:
Jul 12, 2026, 5:14:31 AM (3 months ago)
Author:
Balling
Comment:

Updates now that Apple NMR is ported

Legend:

Unmodified
Added
Removed
Modified
  • Encode/AAC

    v72 v73  
    11[[PageOutline(1, Contents)]]
    22
    3 [[http://en.wikipedia.org/wiki/Advanced_Audio_Coding|Advanced Audio Coding (AAC)]] is the successor format to MP3, and is defined in MPEG-4 part 3 (ISO/IEC 14496-3). It is often used within an MP4 container format; for music the `.m4a` extension is customarily used. The second-most common use is within MKV (Matroska) files because it has better support for embedded text-based soft subtitles than MP4. The examples in this guide will use the extensions MP4 and M4A.
    4 
    5 FFmpeg supports three AAC-LC encoders (`aac`, `libfdk_aac`, `aac_at`) and two HE-AAC (v1/2) encoder (`libfdk_aac`, `aac_at`). The license of `libfdk_aac` is not compatible with GPL, so the GPL does not permit distribution of binaries containing incompatible code when GPL-licensed code is also included. Therefore this encoder have been designated as "non-free", and you cannot download a pre-built ffmpeg that supports it. This can be resolved by [[CompilationGuide|compiling ffmpeg]] yourself.
     3[[http://en.wikipedia.org/wiki/Advanced_Audio_Coding|Advanced Audio Coding (AAC)]] is the successor format to MP3, and is defined in MPEG-4 part 3 (ISO/IEC 14496-3). It is often used within an MP4 container format; for music the `.m4a` extension (m4a actually is different in the bitstream so it is not enough to change the .mp4 to m4a) is customarily used. The second-most common use is within MKV and .mka (Matroska) files because it has better support for embedded text-based soft subtitles than MP4. The examples in this guide will use the extensions MP4 and M4A.
     4
     5FFmpeg supports three AAC-LC encoders (`aac`, `libfdk_aac`, `aac_at`) and two HE-AAC (v1/2) encoders (`libfdk_aac`, `aac_at`). The license of `libfdk_aac` is not compatible with GPL, so the GPL does not permit distribution of binaries containing incompatible code when GPL-licensed code is also included. Therefore this encoder have been designated as "non-free", and you cannot download a pre-built ffmpeg that supports it. This can be resolved by [[CompilationGuide|compiling ffmpeg]] yourself.
    66
    77See also [[Encode/HighQualityAudio]] for general guidelines on FFmpeg audio encoding (which also includes a comparison of which AAC encoder is best quality).
    … …  
    100100}}}
    101101
    102 Unfortunately, many devices that can play AAC-LC (the default profile for `libfdk_aac`) simply cannot play either version of HE-AAC, so this is not recommended for surround sound audio, which normally needs to be compatible with such hardware players. If you are only going to play it on your computer, or you are sure that your hardware player supports HE-AAC, you can aim for a bit rate of 160kb/s for version 1, or 128kb/s for version 2. As always, experiment to see what works for your ears.
     102Unfortunately, many devices that can play AAC-LC (the default profile for `libfdk_aac`) simply cannot play either version of HE-AAC, so this is not recommended for surround sound audio, which normally needs to be compatible with such hardware players, and the bug exists that LFE is not correctly decoded in ffmpeg decoder in HE-AAC. If you are only going to play it on your computer, or you are sure that your hardware player supports HE-AAC, you can aim for a bit rate of 160kb/s for version 1, or 128kb/s for version 2. As always, experiment to see what works for your ears.
    103103
    104104
    … …  
    121121= Native FFmpeg AAC Encoder (`aac`) =#native
    122122
    123 The native FFmpeg AAC encoder. This is currently the second highest-quality AAC encoder available in FFmpeg and does not require an external library like the other AAC encoders described here. This is the default AAC encoder.
    124 
    125 By default, the native encoder produces AAC-LC, which is a "low complexity" profile of baseline AAC. It actually supports the more powerful "main" and "long-term prediction" profiles ([[https://ffmpeg.org/ffmpeg-codecs.html#aac|documentation]]), but these are less tested.
     123The native FFmpeg AAC encoder, highest quality. This is the default AAC encoder and since 9.1 nmr coder is used which is better than other coders, but even twoloop is better than FDK AAC.
     124
     125By default, the native encoder produces AAC-LC, which is a "low complexity" profile of baseline AAC. It actually supports "long-term prediction" profile, but "main" profile was removed ([[https://ffmpeg.org/ffmpeg-codecs.html#aac|documentation]]).
    126126
    127127=== Examples ===
    … …  
    140140
    141141Effective range for `-q:a` is around 0.1-2. This VBR is experimental and not guaranteed to give better results than the CBR.
    142 Native FFmpeg AAC Encoder does not really do CBR audio encoding. For Bluetooth Headphones an option was added to force CBR but that instead makes quality subpar (-bt:a 0). See b92af7b64e7acd015aea3ae1da2228c5a7e677bf.
     142Native FFmpeg AAC Encoder does not really do CBR audio encoding, just very close. For Bluetooth Headphones an option was added to force CBR but that instead makes quality subpar as the bitrate falls apart (-bt:a 0). See b92af7b64e7acd015aea3ae1da2228c5a7e677bf. Version 9.1 adds Apple NMR in  native encoder and is helps -bt:a 0 a little bit.
    143143
    144144----
    … …  
    146146When a build is configured with --enable-audiotoolbox, Apple's audioToolbox.framework (normally available only on macOS) will provide a series of codecs suffixed `_at`. Apple's encoder [[https://wiki.hydrogenaud.io/index.php?title=Apple_AAC|is even better than FDK-AAC according to HydrogenAudio]]. You may have come across this implementation on other platforms as "QAAC" or "audioToolboxWrapper", but licensing issues for these modifications is too much for FFmpeg to deal with.
    147147
    148 Bitrate control is done by global flags. `-q:a` can range from 0~14 for VBR and `-b:a` by default gives CBR. `-aac_at_mode` can be used to instead cause `-b:a` to provide AVR and CVBR. All profiles for `libfdk_aac`'s `-profile:a` option, including both versions of HE-AAC, are available.
     148Bitrate control is done by global flags. `-q:a` can range from 0~14 for VBR and `-b:a` by default gives CBR. `-aac_at_mode` can be used to instead cause `-b:a` to provide AVR and CVBR. All profiles for `libfdk_aac`'s `-profile:a` option, including both versions of HE-AAC, are available, e.g. AOT_MP2_AAC_LC pseudo-profile number 129 which is AOT_AAC_LC with PNS disabled.
    149149
    150150{{{#!comment
    … …  
    195195== Which encoder provides the best quality? ==
    196196
    197 For AAC-LC: `aac_at` ≥ `libfdk_aac` > Native FFmpeg AAC encoder (`aac`).
     197For AAC-LC: 9.1 native FFmpeg AAC encoder (`aac`) using Apple's NMR and other coding tools > `aac_at` > `libfdk_aac`.
    198198
    199199For HE-AAC it's unclear whether `aac_at` or `libfdk_aac` is better.