Changes between Version 51 and Version 52 of Encode/AAC
- Timestamp:
- Oct 31, 2017, 11:02:12 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Encode/AAC
v51 v52 1 1 [[PageOutline(1, Contents)]] 2 2 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 .m4aextension 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 theGPL, 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 5 FFmpeg 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. 6 6 7 7 See also [[Encode/HighQualityAudio]] for general guidelines on FFmpeg audio encoding (which also includes a comparison of which AAC encoder is best quality). … … 9 9 ---- 10 10 11 = libfdk_aac=#fdk_aac12 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 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`). 14 14 15 15 Detailed 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]. 16 16 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 17 22 == Constant Bit Rate (CBR) mode ==#fdk_cbr 18 23 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. 24 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 64 kBit/s for each channel (so 128 kBit/s for stereo, 384 kBit/s for 5.1 surround sound). 25 26 Set the bit rate with the `-b:a` option. 20 27 21 28 === Examples === … … 33 40 }}} 34 41 35 Convert the video with [[Encode/H.264#twopass|libx264]], with a target of fitting a 90-minute movie on a 700 MB(=5734400kb) CD-ROM, mixing the audio down to two channels (Windows users should use `NUL` rather than `/dev/null`):42 Convert 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 `\`): 36 43 37 44 {{{ … … 43 50 == Variable Bit Rate (VBR) mode ==#fdk_vbr 44 51 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 }}} 52 Target a ''quality'', rather than a specific bit rate. 1 is lowest quality and 5 is highest quality. 53 54 Set the VBR level with the `-vbr` flag. 51 55 52 56 VBR modes gives roughly the following bit rates per channel ([[http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes|details]]): … … 61 65 HE bit rates will be much lower. 62 66 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 63 72 === Examples === 64 73 … … 69 78 }}} 70 79 71 Convert the audio only of a video:80 From a video file, convert only the audio stream: 72 81 73 82 {{{ … … 87 96 88 97 {{{ 89 #!div style="border: 1p t dotted; margin: 1em; background-color: #fffff9;"98 #!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 90 99 '''Note:''' HE-AAC version 2 only handles stereo. If you have mono, or want to down-mix to mono, use HE-AAC version 1. 91 100 }}} … … 94 103 95 104 96 === HE-AAC version 1 === 105 === Examples === 106 107 HE-AAC version 1: 97 108 98 109 {{{ … … 100 111 }}} 101 112 102 === HE-AAC version 2 === 113 HE-AAC version 2: 103 114 104 115 {{{ … … 108 119 ---- 109 120 110 = Native FFmpeg AAC encoder =121 = Native FFmpeg AAC Encoder = 111 122 112 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. 113 124 114 125 {{{ 115 #!div style="border: 1p t dotted; margin: 1em; background-color: #fffff9;"126 #!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #ffd;" 116 127 '''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. 117 128 }}} 118 129 119 == Example using `-b:a` == 130 === Examples === 131 132 Constant bit rate using `-b:a`: 120 133 121 134 {{{ … … 123 136 }}} 124 137 125 == Example using `-q:a` == 138 Variable bit rate (using `-q:a`: 126 139 127 140 {{{ … … 133 146 ---- 134 147 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 150 Support 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. 148 157 149 158 ---- … … 154 163 155 164 {{{ 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 = 165 ffmpeg -i input ... \ 166 -metadata author="FFmpeg Bayou Jug Band" \ 167 -metadata title="Decode my Heart (Let's Mux)" \ 168 output.mp4 169 }}} 170 171 For 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 = 162 176 163 177 By 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.
