How do I produce great quality AAC files under Xenial Xerus?

I would like to produce high quality AAC files from a small library of wav files under Xenial Xerus 16.04 LTS.

I am keen to be able to select between AAC-LC, HE-AAC and HE-AAC v2 for the output files. I am not all that fussed if either a commandline or gui tool does a better job...


Under Xenial Xerus the best choice is to use fdkaac:

sudo apt-get install fdkaac

Then the following syntax should be helpful, all examples are for Constant Bitrate Mode (CBR) although I have included a section at the bottom concerning Variable Bitrate Mode (VBR):

1. AAC-LC

For a single file try this:

fdkaac --bitrate 128k --moov-before-mdat --afterburner 1 -o output.m4a input.wav

and for a directory of wav files try the following:

mkdir aac && \
for j in *.wav
do 
fdkaac --bitrate 128k --moov-before-mdat --afterburner 1 -o aac/"${j%.wav}.m4a" "$j"
done

Tested and working well on my system.

2. HE-AAC

For a single file try this:

fdkaac -p 5 --bitrate 64k --moov-before-mdat --afterburner 1 -o output.m4a input.wav

and for a directory of wav files try the following:

mkdir aac && \
for j in *.wav
do 
fdkaac -p 5 --bitrate 64k --moov-before-mdat --afterburner 1 -o aac/"${j%.wav}.m4a" "$j"
done

Tested and working well on my system.

3. AAC-HEv2

For a single file try this:

fdkaac -p 29 --bitrate 32k --moov-before-mdat --afterburner 1 -o output.m4a input.wav

and for a directory of wav files try the following:

mkdir aac && \
for j in *.wav
do 
fdkaac -p 29 --bitrate 32k --moov-before-mdat --afterburner 1 -o aac/"${j%.wav}.m4a" "$j"
done

Tested and working well on my system.

4. VBR Note:

If you wish to use Variable Bitrate (VBR) mode instead of Constant Bitrate (CBR) simply omit the --bitrate setting and use --bitrate-mode instead. bitrate-mode takes a setting from 1 to 5 with a higher value producing a higher bitrate.

Further Reading:

  • Hydrogen Audio: Fraunhofer FDK AAC
  • abcde: Encoding with fdkaac
  • GitHub: fdkaac