Converting an Audible aax file to m4b


First run the commands below. Run sudo -v first if you paste them all at once to a shell and you have not made sudo not require a password, or just remove the second line if you have already installed pip.

brew install chromedriver ffmpeg
sudo easy_install pip
pip install selenium requests
git clone
cd audible-activator
sed -i '' 's,chromedriver_path = "./chromedriver",chromedriver_path = "/usr/local/bin/chromedriver",'

Then enter your Audible username and password and wait for a while for the eight character activation key to be printed.

If you do not run the sed command that changes the value of the chromedriver_path variable, ./ results in an error like 'chromedriver' executable needs to be in PATH even if a chromedriver executable is on the path or in the audible-activator directory.

After that run a command like this:

ffmpeg -activation_bytes youractivationkey -i input.aax -vn -c:a copy output.m4a;mv output.m4{a,b}

If you try to use the ffmpeg command with an aa file instead of an aax file, it results in an error like Option activation_bytes not found. To download a book from Audible as aax instead of aa, choose "Enhanced" from the "Audio Quality" dropdown in the view for downloading a book.

aax files are encrypted mp4 / m4a / m4b files so the ffmpeg command does not re-encode audio and it preserves metadata such as chapters. mp4, m4a, and m4b are alternative filename extensions for the MPEG-4 Part 14 container format. One difference between the m4a and m4b extensions is that the option to remember the previous playback position in iTunes is enabled by default for files with an m4b extension but not for files with an m4a extension. iTunes also displays files with an m4b extension under audiobooks by default.