-
Notifications
You must be signed in to change notification settings - Fork 42
Encoder configuration
You have to pick one of the following output modes, that are mutually exclusive:
output mode | option |
---|---|
AAC TVBR | --tvbr, -V (default) |
AAC CVBR | --cvbr, -v |
AAC ABR | --abr, -a |
AAC CBR | --cbr, -c |
ALAC | --alac, -A |
PCM(decode) | --decode, -D |
Playback | --play |
Scan and compute peak | --peak |
The last two are exceptional in a sense that they don't output to a file.
AAC output mode options take integer value (option argument) to specify bitrate or quality. --tvbr takes quality value between 0 to 127 (bigger result in better quality, larger file size). Others take bitrate in kbps. For example, "-a 128" means ABR 128kbps. When you don't specify output mode at all, "--tvbr 91" is chosen as default configuration.
For AAC output mode, there exists an another option named --quality, and you might be confused. Unlike bitrate or TVBR quality, this option controls not quality/size trade off but quality/speed trade off. Bigger value means higher quality (or smaller file size), and slower encoding speed. By default, qaac chooses --quality 2. Probably you don't have to touch this option unless you have a special reason to do so.
As for AAC output mode other than TVBR, you can additionally set --he to enable HE encoding mode.
m4a is the default output file format for AAC and ALAC output mode, and WAV is the dafault output file format for PCM output mode. You can additionally set --adts(for AAC) or --caf(for everything) to change output file format.
Although TVBR option allows arbitrary value in 0-127 range, internally AAC codec has only 15 actually functional quality steps, therefore the value is get rounded to one of the following:
0 | 9 | 18 | 27 | 36 | 45 | 54 | 63 | 73 | 82 | 91 | 100 | 109 | 118 | 127 |
You can see this "actual quality value" written in the tool tag (in case of M4A output).
63 might be a good place to start with. Since it's positioned at mid center, you might take it as "mid quality". However, it's typical bitrate for redbook format is around 128kbps or so, which is usually considered to be good for AAC (remember iTunes music store has been using 128kbps ABR, before iTunes plus has come out). Of course, noboby but you can decide which setting is appropriate for you. Decide by yourself using your ears.
Available bitrate value for CVBR/ABR/CBR varies with number of channels, sample rate, and SBR option. You can see available combinations of channel layout, sample rate, and bitrate by the following command:
qaac --formats
0 as bitrate means "highest bitrate available". Therefore, "--CVBR 0" is equal to "--CVBR 320" for 2ch, 44.1kHz input.
Just for your information, the following is the iTunes import setting, and it's equivalence for qaac (at 2011/10/11, iTunes 10.4.1).
iTunes setting | equivalence for qaac |
---|---|
High Quality(128k) | -a128 -q1 |
iTunes Plus(256k) | -v256 -q2 |
Custom (VBR on) | -v <bitrate> -q2 |
Custom (VBR off) | -a <bitrate> -q2 |
As you can see, iTunes is only using either ABR or CVBR. If you want the same result as iTunes Plus, just use -v256 -q2 (-q2 is set by default, so actually -v256 is enough).
Like other MDCT based lossy coders such as MP3, Vorbis or Opus, AAC has certain amount of encoder/decoder delay, and also padding at ending due to constantly sized frames. In other words, without proper handling on player/decoder side, a certain amount of silence is prepended/appended to the beginning/ending of the output. This of course is problematic when you want gapless playback, therefore a special tag named "iTunSMPB" is written into m4a container, in which amount of delay (and padding) is stored, and player uses them to achieve gapless playback.
As long as you are just encoding music to m4a and listen to them with music players such as foobar2000 or iTunes, you don't have to care much about it. However, when you are working with video soundtrack, you can experience video/audio sync issue. For one thing, delay information can be lost on (re)multiplexing with video track, due to software implementation or container format limitation. For another, video player might not be supporting handling of audio encoder delay at all.
The most simple option for dealing with video/audio sync issue is to use --no-delay option, which (as the name implies) exactly eliminates the delay. However, note that it also means that certain amount of signals in the very first frame cannot be reconstructed correctly. Since video usually starts with silence, it will (usually) be safe. However, don't rely on / abuse this option too much.
qaac also offers --gapless-mode option to control the way of writing delay/padding value in m4a container. Usually you should not touch it unless you know what you are doing. By default, qaac writes iTunSMPB tag, which is iTunes/iPod compatible, and the most widely supported way (at least by music players).