<-- home

Listening to Audible books on Linux

After recently discovering that Amazon has a ‘whispersync for voice’ thing for kindle books, I decided to take the plunge and start buying audiobooks. This particular category of books lets you buy the kindle ebook and then buy the audio version for a few dollars more. On the whole, the total cost per book is less than $10 USD, which makes audiobooks about a million times more affordable for a poor person like me (given that average prices on audible are like between $15 – $20 USD).

Now. Because we are talking about Amazon we are also talking about proprietary formats and drm. And because we are talking about Amazon this also means they have zero support for linux. You can listen to your book on an iOS or Android device or on the web. Those are your only options if you are on linux. Not super great.

After a buttload of googling I finally found a way to listen do my books on my linux desktop. And it is relatively easy, so I’m going to detail the steps below.

Dependencies

  • python pip (not strictly necessary but it makes certain things easier)
  • a recent version of ffmpeg (depending on your distro you may end up having to compile it yourself. I did because the version available for Debian 8 isn’t high enough.).

Step 1: Buy a kindle book with the whispersync audio ‘upgrade’ on amazon.com.

Step 2: Send the book to an android device (or you have to use the audible download manager which only supports windows and apple).

Step 3: Download the audiobook to your android device.

Step 4: Connect your device to your linux computer.

Step 5: Find the .aax file in the kindle data directory in ‘audio’ and transfer this to your desktop.

Step 6: Clone this repo to get your activation bytes. You’ll have to follow the instructions in the repo (installing the dependencies, etc). And, most importantly, you only need to do this step once since your bytes authorize this particular computer for listening to the book and if you run this script multiple times, you’ll end up having one device occupying many of your authorization slots.

Step 7: Run this command to decrypt the audiobook:

ffmpeg -activation_bytes <your bytes> -i <audible file>.aax -vn -c:a copy <output>.m4a

And now you can listen to your legally purchased book on your linux device. 😀

Things to note about the resulting file, aac/m4a is the encoding for the encrypted .aax file. If you want it on an iOS device as an audiobook, just change the extension to ‘m4b’. If you want to play it on some non-android, non-iOS media player, you’ll have to convert it accordingly. You can, if you know you want an mp3 for example, change the audio codec to the desired output (instead of -c:a copy use -c:a libvorbis or whatever). The bitrate for audible files is 64k, so if you decide to transcode it to another format, keep that in mind.

For people who don’t feel like remembering the above, I do have a short script for decrypting your .aax file:

#!/bin/bash

audible4linux () {
  file=$1
  #this takes the current file name and strips the extension.
  name=$( basename $file .aax)
  #your ffmpeg to decrypt your .aax file.
  ffmpeg -activation_bytes <your bytes> -i $file  -vn -c:a copy $name.m4a
  #i don't use iOS but there isn't a difference between these two extensions, so I just switch it to m4b right away (and then usually transcode it to ogg vorbis).
  mv $name.m4a $name.m4b
}

#calls the function and takes the file as input.
audible4linux $1

Save the code as .sh in the same directory as the .aax files. Run the code like so:

. audible4linux.sh <audiblefile>.aax

And it should spit out your decrypted book for listening on linux.