_   _          _  ____      
    | | | |        (_)/ ___|     
    | |_| |__   ___ _/ /___  ___ 
    | __| '_ \ / _ \ | ___ \/ __|
    | |_| | | |  __/ | \_/ |\__ \
     \__|_| |_|\___| |_____/|___/
                  _/ |           
                 |__/            

             ┌─────────┐
             │ hire me │
             └─────────┘


Converting Audible *.aax files

Audible has a great selection of audiobooks that can be downloaded and listened to on the go. However, there is one big caviat: All audiobooks have DRM on them and can only be listened to using the official audible app.

Wan’t to listen to the audiobook using your car’s stereo? Good luck. Wan’t to preserve the audiobook because you want to listen to it in 10 years time? Nope. Wan’t to use an android device without google play services or (heaven forbid) are looking forward to the linux smartphones landing in 2019? Amazon is laughing at you.

Luckily, things are not as dire as my last paragraph would lead you to believe. If you have googled a bit you will most certainly have seen this blogpost on code-bude.net which outlines how to convert aax file to mp3. Since 2017 however things have gotten easier:

What do we need?

To go forward we need to install 2 pieces of software:

inAudible-NG/tables will provide us with a activation hash that is needed to decrypt the files. This hash is unique per account - meaning you only need to generate it once for all of your audiobooks.

ffmpeg will convert the files from the propriatary .aax format to whatever you like. I recommend using opus (for best compression) or mp3 (for best support).

Getting the activation bytes

To extract the ‘activation bytes’ we first need a file hash of an aax file:

$ ffprobe audiobook.aax
[...]
[aax] file checksum == 27ae5bf7df0bab8401776657d90dca85XXXXXXXX
[aax] activation_bytes option is missing!
[...]

This hash is then passed to rcrack (from inAudible-NG/tables):

$ ./rcrack . -h 27ae5b47df0bab6401776657d90dca85XXXXXXXX
[...]
result
----------------------------------------------------------------
27ae5b47df0bab6401776657d90dca85XXXXXXXX  [...]  hex:c345eXXX

Converting the file

Converting the file can be done with all of the usual ffmpeg options with an additional -activation_bytes option containing the hex hash from above. Example:

$ ffmpeg \
    -i audiobook.aax \
    -activation_bytes c345eXXX \
    freedom.mp3

Notes

  • All steps shown here are meant for file preservation. If you want to listen to quality audiobooks then buy, don’t pirate.
  • The hashes and activation bytes in the examples above are obviously anonymized.