| 13 | | 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 --enable-nonfree`. But beware, it defaults to a low-pass filter of around 15kHz. If you want to preserve higher frequencies, use `-cutoff 19000`. Adjust the number to the upper frequency limit you prefer. |
| | 13 | 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 --enable-nonfree`. But beware, it defaults to a low-pass filter of around 14kHz. If you want to preserve higher frequencies, use `-cutoff 18000`. Adjust the number to the upper frequency limit you prefer. |
| | 14 | |
| | 15 | === Constant Bit Rate (CBR) mode ===#fdk_cbr |
| | 16 | |
| | 17 | 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` flag. |
| | 18 | |
| | 19 | ==== Examples ==== |
| | 20 | |
| | 21 | Convert and audio file to AAC in an M4A (MP4) container: |
| | 22 | |
| | 23 | {{{ |
| | 24 | ffmpeg -i input.wav -c:a libfdk_aac -b:a 128k output.m4a |
| | 25 | }}} |
| | 26 | |
| | 27 | Convert 5.1 surround sound audio of a video, leaving the video alone: |
| | 28 | |
| | 29 | {{{ |
| | 30 | ffmpeg -i input.mp4 -c:v copy -c:a libfdk_aac -b:a 384k output.mp4 |
| | 31 | }}} |
| | 32 | |
| | 33 | Convert the video with [[x264EncodingGuide#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`): |
| | 34 | |
| | 35 | {{{ |
| | 36 | ffmpeg -y -i input.mp4 -c:v libx264 -b:v 933k -preset:v veryfast -pass 1 -an /dev/null && \ |
| | 37 | ffmpeg -i input.mp4 -c:v libx264 -b:v 933k -preset:v veryfast -pass 2 \ |
| | 38 | -ac 2 -c:a libfdk_aac -b:a 128k output.mp4 |
| | 39 | }}} |
| 17 | | These settings target a ''quality'', rather than a specific ''bit rate''. 1 is lowest quality (though still pretty good) and 5 is highest quality. For some people with some files claim even a VBR of 1 is indistinguishable from CD-quality audio; test it out and use the lowest setting that works for you. This mode is not compatible with [[#fdk_he|AAC-HE]], but for AAC-LC (the default for ffmpeg, and most compatible [[http://en.wikipedia.org/wiki/Advanced_Audio_Coding#Modular_encoding|AAC profile]]) it should probably be preferred, since it allows the encoder greater flexibility to distribute bits as it sees fit: high-tempo, large dynamic range audio (like dubstep or rock music) requires more bits to encode then low-tempo, low dynamic range audio (like whalesong, or a recorded lecture - though there are special speech codecs that you should consider for the latter). Set the VBR level with the `-vbr` flag. |
| | 43 | These settings target a ''quality'', rather than a specific ''bit rate''. 1 is lowest quality (though still pretty good) and 5 is highest quality. Test it out and use the lowest setting that works for you. This mode is not compatible with [[#fdk_he|AAC-HE]], but for AAC-LC (the default for ffmpeg, and most compatible [[http://en.wikipedia.org/wiki/Advanced_Audio_Coding#Modular_encoding|AAC profile]]) it should probably be preferred, since it allows the encoder greater flexibility to distribute bits as it sees fit: high-tempo, large dynamic range audio (like dubstep or rock music) requires more bits to encode then low-tempo, low dynamic range audio (like whalesong, or a recorded lecture - though there are special speech codecs that you should consider for the latter). Set the VBR level with the `-vbr` flag. |
| 49 | | === Constant Bit Rate (CBR) mode ===#fdk_cbr |
| 50 | | |
| 51 | | These settings target a specific bit rate, with less variation between samples. It will get you slightly lower quality for the bit rate it gives than the VBR mode would; but 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` flag. |
| 52 | | |
| 53 | | ==== Examples ==== |
| 54 | | |
| 55 | | Convert and audio file to AAC in an M4A (MP4) container: |
| 56 | | |
| 57 | | {{{ |
| 58 | | ffmpeg -i input.wav -c:a libfdk_aac -b:a 128k output.m4a |
| 59 | | }}} |
| 60 | | |
| 61 | | Convert 5.1 surround sound audio of a video, leaving the video alone: |
| 62 | | |
| 63 | | {{{ |
| 64 | | ffmpeg -i input.mp4 -c:v copy -c:a libfdk_aac -b:a 384k output.mp4 |
| 65 | | }}} |
| 66 | | |
| 67 | | Convert the video with [[x264EncodingGuide#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`): |
| 68 | | |
| 69 | | {{{ |
| 70 | | ffmpeg -y -i input.mp4 -c:v libx264 -b:v 933k -preset:v veryfast -pass 1 -an /dev/null && \ |
| 71 | | ffmpeg -i input.mp4 -c:v libx264 -b:v 933k -preset:v veryfast -pass 2 \ |
| 72 | | -ac 2 -c:a libfdk_aac -b:a 128k output.mp4 |
| 73 | | }}} |
| 74 | | |