Changes between Version 18 and Version 19 of Encode/AAC


Ignore:
Timestamp:
Sep 29, 2013, 8:58:39 PM (4 years ago)
Author:
Kamedo2
Comment:

For FDK-AAC, CBR is probably better.

Legend:

Unmodified
Added
Removed
Modified
  • Encode/AAC

    v18 v19  
    1111== libfdk_aac ==#fdk_aac 
    1212 
    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. 
     13Fraunhofer 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 
     17These 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 
     21Convert and audio file to AAC in an M4A (MP4) container: 
     22 
     23{{{ 
     24ffmpeg -i input.wav -c:a libfdk_aac -b:a 128k output.m4a 
     25}}} 
     26 
     27Convert 5.1 surround sound audio of a video, leaving the video alone: 
     28 
     29{{{ 
     30ffmpeg -i input.mp4 -c:v copy -c:a libfdk_aac -b:a 384k output.mp4 
     31}}} 
     32 
     33Convert 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{{{ 
     36ffmpeg -y -i input.mp4 -c:v libx264 -b:v 933k -preset:v veryfast -pass 1 -an /dev/null && \ 
     37ffmpeg -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}}} 
    1440 
    1541=== Variable Bit Rate (VBR) mode ===#fdk_vbr 
    1642 
    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. 
     43These 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. 
    1844 
    1945According to [[http://www.hydrogenaudio.org/forums/index.php?showtopic=95989|this hydrogenaudio post]], the VBR modes (on average, over a number of files) give the following bit rates per channel (so for stereo, double the bit rate; for 5.1 surround sound, multiply it by six): 
     
    4773}}} 
    4874 
    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  
    7575=== High-Efficiency AAC ===#fdk_he 
    7676 
     
    9797== Native FFmpeg AAC encoder == 
    9898 
    99 The native FFmpeg AAC encoder is included with ffmpeg and is does not require an external library like the other AAC encoders described here. Note that you will not get as good results as with `libfdk_aac`. The `-cutoff` option may improve quality according to [http://d.hatena.ne.jp/kamedo2/20120729/1343545890 Quality Assessment of FFmpeg AAC]. This is considered an experimental encoder, so `-strict experimental` or `-strict -2` is required. 
     99The native FFmpeg AAC encoder is included with ffmpeg and is does not require an external library like the other AAC encoders described here. Note that you will not get as good results as with `libfdk_aac`. This is considered an experimental encoder, so `-strict experimental` or `-strict -2` is required. 
    100100 
    101101==== Example using `-q:a` ==== 
     
    188188Determine actual `-q:a` range for `aac` 
    189189}}} 
     190 
     191{{{#!comment 
     192For libfdk_aac, cbr may be better than vbr. vbr 3 sets lowpass around 14.4k, which is too low and the effect is very audible. So I flipped the cbr and the vbr so that the cbr comes first. Maybe I should do a formal blind test later. 
     193}}}