Changes between Version 51 and Version 52 of Encode/AAC


Ignore:
Timestamp:
Oct 31, 2017, 1:02:12 PM (4 weeks ago)
Author:
slhck
Comment:

formatting, additional links for metadata, remove big headings for unsupported encoders

Legend:

Unmodified
Added
Removed
Modified
  • Encode/AAC

    v51 v52  
    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 can support two AAC-LC encoders (`aac` & `libfdk_aac`) and one HE-AAC(v1/2) encoder (`libfdk_aac`). The license of `libfdk_aac` is not compatible with the 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 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 
     5FFmpeg supports two AAC-LC encoders (`aac` and `libfdk_aac`) and one HE-AAC (v1/2) encoder (`libfdk_aac`). 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). 
     
    99---- 
    1010 
    11 = libfdk_aac =#fdk_aac 
    12  
    13 The Fraunhofer FDK AAC codec library. This is currently the highest-quality AAC encoder available with ffmpeg. Requires ffmpeg to be configured with `--enable-libfdk-aac` (and additionally `--enable-nonfree` if you're also using `--enable-gpl`). But beware, it defaults to a low-pass filter of around 14kHz ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bandwidth|details]]). If you want to preserve higher frequencies, use `-cutoff 18000`.  Adjust the number to the upper frequency limit only if you need to; keeping in mind that a higher limit may audibly reduce the overall quality. 
     11= Fraunhofer FDK AAC (`libfdk_aac`) =#fdk_aac 
     12 
     13The Fraunhofer FDK AAC codec library. This is currently the highest-quality AAC encoder available with ffmpeg. Requires ffmpeg to be configured with `--enable-libfdk-aac` (and additionally `--enable-nonfree` if you're also using `--enable-gpl`). 
    1414 
    1515Detailed information about the FDK AAC library (not FFmpeg specific) can be found at [http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC HydrogenAudio Knowledgebase: Fraunhofer FDK AAC]. 
    1616 
     17{{{ 
     18#!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 
     19'''Note:''' `libfdk_aac` defaults to a low-pass filter of around 14kHz ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bandwidth|details]]). If you want to preserve higher frequencies, use `-cutoff 18000`.  Adjust the number to the upper frequency limit only if you need to; keeping in mind that a higher limit may audibly reduce the overall quality. 
     20}}} 
     21 
    1722== Constant Bit Rate (CBR) mode ==#fdk_cbr 
    1823 
    19 These settings target a specific bit rate, with less variation between samples. It gives you greater control over file size, and it is compatible with the HE-AAC profile. As a rule of thumb, for audible transparency, use 64kb/s for each channel (so 128kb/s for stereo, 384 kb/s for 5.1 surround sound). Set the bit rate with the `-b:a` option. 
     24These settings target a specific bit rate, with less variation between samples. It gives you greater control over file size, and it is compatible with the HE-AAC profile. As a rule of thumb, for audible transparency, use 64 kBit/s for each channel (so 128 kBit/s for stereo, 384 kBit/s for 5.1 surround sound). 
     25 
     26Set the bit rate with the `-b:a` option. 
    2027 
    2128=== Examples === 
     
    3340}}} 
    3441 
    35 Convert the video with [[Encode/H.264#twopass|libx264]], with a target of fitting a 90-minute movie on a 700MB(=5734400kb) CD-ROM, mixing the audio down to two channels (Windows users should use `NUL` rather than `/dev/null`): 
     42Convert the video with [[Encode/H.264#twopass|libx264]], with a target of fitting a 90-minute movie on a 700 MB (=5734400 KB) CD-ROM, mixing the audio down to two channels (Windows users should use `NUL` rather than `/dev/null` and `^` instead of `\`): 
    3643 
    3744{{{ 
     
    4350== Variable Bit Rate (VBR) mode ==#fdk_vbr 
    4451 
    45 Target a ''quality'', rather than a specific ''bit rate''. 1 is lowest quality and 5 is highest quality. Set the VBR level with the `-vbr` flag. 
    46  
    47 {{{ 
    48 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;" 
    49 '''Note:''' A bug exists in libfdk-aac 0.1.3 and earlier that will cause a crash when using high sample rates, such as 96kHz, with VBR mode 5. ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Issues|details]]). 
    50 }}} 
     52Target a ''quality'', rather than a specific bit rate. 1 is lowest quality and 5 is highest quality. 
     53 
     54Set the VBR level with the `-vbr` flag. 
    5155 
    5256VBR modes gives roughly the following bit rates per channel ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes|details]]): 
     
    6165HE bit rates will be much lower. 
    6266 
     67{{{ 
     68#!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 
     69'''Note:''' A bug exists in libfdk-aac 0.1.3 and earlier that will cause a crash when using high sample rates, such as 96kHz, with VBR mode 5. ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Issues|details]]). 
     70}}} 
     71 
    6372=== Examples === 
    6473 
     
    6978}}} 
    7079 
    71 Convert the audio only of a video: 
     80From a video file, convert only the audio stream: 
    7281 
    7382{{{ 
     
    8796 
    8897{{{ 
    89 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;" 
     98#!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 
    9099'''Note:''' HE-AAC version 2 only handles stereo. If you have mono, or want to down-mix to mono, use HE-AAC version 1. 
    91100}}} 
     
    94103 
    95104 
    96 === HE-AAC version 1 === 
     105=== Examples === 
     106 
     107HE-AAC version 1: 
    97108 
    98109{{{ 
     
    100111}}} 
    101112 
    102 === HE-AAC version 2 === 
     113HE-AAC version 2: 
    103114 
    104115{{{ 
     
    108119---- 
    109120 
    110 = Native FFmpeg AAC encoder = 
     121= Native FFmpeg AAC Encoder = 
    111122 
    112123The 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.  
    113124 
    114125{{{ 
    115 #!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;" 
     126#!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 
    116127'''Note:''' `-strict experimental` (or `-strict -2`) was previously required for this encoder, but it is [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=d9791a8656b5580756d5b7ecc315057e8cd4255e no longer experimental] and these options are unnecessary since 5 December 2015. 
    117128}}} 
    118129 
    119 == Example using `-b:a` == 
     130=== Examples === 
     131 
     132Constant bit rate using `-b:a`: 
    120133 
    121134{{{ 
     
    123136}}} 
    124137 
    125 == Example using `-q:a` == 
     138Variable bit rate (using `-q:a`: 
    126139 
    127140{{{ 
     
    133146---- 
    134147 
    135 = Deprecated/removed encoders = 
    136  
    137 = libfaac = 
    138  
    139 Freeware Advanced Audio Coder. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=dc0f711459e0c682bf9f94ba38d26736e90cff45 Support for this library has been removed]. 
    140  
    141 == libvo_aacenc == 
    142  
    143 !VisualOn AAC encoding library. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=e07e88cd82f78644ddcb10d7d3e0dd624fffe274 Support for this library has been removed]. Use the native FFmpeg encoder instead: it provides better quality and supports more than 2 channels. 
    144  
    145 == libaacplus == 
    146  
    147 [http://tipok.org.ua/node/17 AAC+] encoding library. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=9ba54c1b82a81581e5283da75c153a76f04324c0 Support for this library has been removed]. Use `libfdk_aac` instead for HE-AAC: it is consistently better in all bitrates. 
     148= Deprecated / Removed Encoders = 
     149 
     150Support for a number of AAC encoders has been removed in ffmpeg due to the availability of better encoders or licensing issues: 
     151 
     152* `libfaac`: Freeware Advanced Audio Coder. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=dc0f711459e0c682bf9f94ba38d26736e90cff45 Support for this library has been removed]. 
     153 
     154* `libvo_aacenc`: !VisualOn AAC encoding library. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=e07e88cd82f78644ddcb10d7d3e0dd624fffe274 Support for this library has been removed]. Use the native FFmpeg encoder instead: it provides better quality and supports more than 2 channels. 
     155 
     156* `libaacplus`: [http://tipok.org.ua/node/17 AAC+] encoding library. [http://git.videolan.org/?p=ffmpeg.git;a=commit;h=9ba54c1b82a81581e5283da75c153a76f04324c0 Support for this library has been removed]. Use `libfdk_aac` instead for HE-AAC: it is consistently better in all bitrates. 
    148157 
    149158---- 
     
    154163 
    155164{{{ 
    156 ffmpeg -i input ... -metadata author="FFmpeg Bayou Jug Band" -metadata title="Decode my Heart (Let's Mux)" output.mp4 
    157 }}} 
    158  
    159 ---- 
    160  
    161 = Progressive download = 
     165ffmpeg -i input ... \ 
     166-metadata author="FFmpeg Bayou Jug Band" \ 
     167-metadata title="Decode my Heart (Let's Mux)" \ 
     168output.mp4 
     169}}} 
     170 
     171For more info, see [https://www.ffmpeg.org/doxygen/3.2/group__metadata__api.html the Metadata API description] and the [https://wiki.multimedia.cx/index.php/FFmpeg_Metadata MultimediaWiki entry on FFmpeg metadata]. 
     172 
     173---- 
     174 
     175= Progressive Download = 
    162176 
    163177By default the MP4 muxer writes the 'moov' atom after the audio stream ('mdat' atom) at the end of the file. This results in the user requiring to download the file completely before playback can occur. Relocating this moov atom to the beginning of the file can facilitate playback before the file is completely downloaded by the client.