Listen to Audiobooks without the Audible App

As someone who’s reading all day long – mainly technical documentation, code, mails and chat messages – I enjoy the luxury of having someone else read a book to me very much. That’s why I have always been an avid audiobook user.

Listen to Audiobooks without the Audible App

After ten or twelve hours a day of reading through command line output, manual pages and source code my eyes crave for a break. Without audiobooks, it would be tough for me to get through most of the books I’m interested in.

Over the years, my digital library has therefore grown significantly in size, with Audible being my go-to provider for audiobooks. As with YouTube and so many other platforms, it’s a love-hate-relationship. I enjoy the content on Audible, but not so much so the service itself.

One reason for that is the rather unpolished Android mobile app. Also, considering that it’s an Amazon service, I don’t expect their mobile apps to be lacking privacy invasive features, that e.g. track a user’s listening patterns.

Unfortunately all audiobooks purchased through Audible are DRM protected, making it virtually impossible to find alternative audiobook players that could play the files out of the box. With my recent switch to GrapheneOS, things got even more complicated, as even if I wanted to, running the official Audible app on Graphene might not be feasible.

There are alternatives like OpenAudible, that promise easy management of Audible audiobooks and even conversion to a DRM-free format like MP3, however, these are – at least partially – closed source software and have a somewhat shady reputation.

Since I wouldn’t touch anything that’s 97.5% Java even with a ten foot pole – except Graphene, to which there is no alternative yet – I’d like to share a different way to free your Audible audiobooks, in order to be able to listen to them on any platform, with any player of your liking.

This solution requires three things:

  • A *n.x system, ideally a Linux machine
  • audible-cli, a Python 3 command line tool
  • AAXtoMP3, a Shell script that uses ffmpeg, libmp3lame and mp4art/mediainfo to convert Audible’s AAX/AAXC formats to MP3/M4A/M4B/Flac/OGG

With those things in place, we can first download our Audible library directly from the command line and afterwards convert every file/chapter to a format that’s understood by most media players.

I’m assuming you’ve read both projects’ README.md files and installed them (and their dependencies, e.g. ffmpeg) accordingly on your system. So let’s start by setting up access to Audible using the quickstart command:

audible quickstart

This will ask you a few questions in regard of your Audible account. You probably won’t need to authenticate using an external browser. In case you’re using 2FA, it will also ask for the code.

As soon as you’re logged in, audible-cli will write the data to ~/.audible/. This folder can be deleted at the end, if no further downloads are planned in future.

Next, let’s retrieve the activation bytes, a short alphanumeric string. You will require this later, so save the output somewhere:

audible activation-bytes

Now, let’s export the library as tab-separated values file. Create a folder in which it, as well as all downloaded files can reside for the time being:

mkdir audiobooks
cd audiobooks/
audible library export -o ./library.tsv

With that in place (and while still in the newly created audiobooks/ folder) we can download all audiobooks from Audible. I used the following command:

audible download \
  --all \
  --aax-fallback \
  -j 1 \
  -f ascii \
  --bunch-size 10 \
  -q best \
  --cover --cover-size 1215 \
  --chapter \
  -o ./

-j and --bunch-size are intentionally low as I’ve experienced connection drops with larger numbers, but you’re free to adjust these settings.

Hint: If you’re only looking to download specific audiobooks, replace --all with -a <ASIN>. You can find the ASIN by checking the library.tsv or by running audible library list.

Depending on the size of your library and your connection speed this process might take a while. In case things fail, don’t worry: You can simply re-run the command. It will only pick up the failed downloads and retry those.

There are specific books – in my case Herman Melville’s Moby-Dick – that are impossible to download through audible-cli. In such cases you can open Audible in your browser, go to your library and manually request a download of the AAX/AAXC files.

Once everything has been downloaded into the audiobooks/ folder, we can begin the conversion process. For that, we will require the activation bytes obtained previously. You are free to adjust conversion settings, however, keep in mind that even with the ones posted here the library will be of significant size. As a rough estimate, a regular library containing of one hundred audiobooks will probably end up at ~30GB. If that’s storage you can’t spare, feel free to change the quality settings for conversion or take a step back and change the download settings (-q best).

Let’s convert the files:

AAXtoMP3 \
  -e:mp3 \
  --level 0 \
  -c \
  -A YOUR-ACTIVATION-BYTES-HERE \
  -l 1 \
  --use-audible-cli-data \
  --audible-cli-library-file ./library.tsv \
  ./*.{aax,aaxc}

Make sure to replace YOUR-ACTIVATION-BYTES-HERE with your actual activation bytes. Again, feel free to adjust conversion settings to your needs, in case you’d want a different output format, lower or higher quality.

This process can take hours, depending on your hardware and the size of your library. Ideally launch it in tmux/screen to be able to detach from it. Also keep in mind that AAXtoMP3 won’t delete converted files, so make sure to have enough storage available.

As soon as this is done, double-check the conversion by inspecting file sizes and listening into a few files. As soon as the converted files are deemed good to go, we can remove the *.aax and *.aac files to free up some space.

Now usually that’s where this tutorial would end. We’ve downloaded and converted the entirety of our Audible library into MP3 and can now listen to it on whatever device/player we’d prefer. However, I’d like to share some further insights on how to manage the files and how to play them especially on a de-Googled Android device.

First of all, the player. I’m going to pick Voice for that, because it’s open source, it’s actively maintained, lightweight, good-looking and has some nice features. Voice might not be able to work with the structure that the converter has put in place, though. The reason for that is that Voice either expects audiobooks to be inside a flat structure (meaning, all files dumped into one directory) or in a per-audiobook structure. However, what we have in place is a author/audiobook/ structure. In order to change that, we can use the following shell command inside the folder containing all author folders:

find ./ -mindepth 1 -maxdepth 1 -type d | \
  while read author; do /bin/ls -1 "$author" | \
    while read book; do mv -i \
      "$author/$book/" \
      "$book-$(basename "$author")"; \
    done; \
  done

This snippet converts the existing structure from author/audiobook/ into audiobook-author. If you’re looking forward to synchronize your audiobooks to Android using e.g. Syncthing, you might also want to insert a sed -E 's/[^0-9a-zA-Z.-]/_/g' command, which cleans the folder and filenames:

find ./ -mindepth 1 -maxdepth 1 -type d | \
  while read author; do /bin/ls -1 "$author" | \
    while read book; do mv -i \
      "$author/$book/" \
      $(echo "$book-$(basename "$author")" | sed -E 's/[^0-9a-zA-Z.-]/_/g'); \
    done; \
  done

Hint: You can prefix the mv -i command with echo (echo mv -i ...) to dry-run these snippets and see what they would do.

With this new structure in place, it is now possible to configure a Syncthing folder that sends the whole audiobooks folder content to an Android device’s Audiobooks/ folder. From there, Voice would pick up the files, add them to its library, and Bob’s your uncle. Voice will even display correct titles and cover photos for the audiobooks.

Voice Audiobook Player

Anti-Piracy Notice: The purpose of this post is not to circumvent DRM restrictions for audiobooks that you don’t own, but rather to show a method that would allow you to use your legally purchased Audible audiobooks in ways that make them work for you. The tools shown herein do not crack the DRM, but rather use your personal Audible encryption key to decrypt the DRM-protected files the same way official Audible apps do it.

Please only use this information for gaining full access to your own ebooks for archiving/conversion/convenience. De-DRMed ebooks should not be uploaded to open servers, torrents, or other methods of mass distribution. No help will be given to people doing such things. Authors, retailers and publishers all need to make a living, so that they can continue to produce books for us to read. Don’t be a parasite. (This message is borrowed in part from the https://apprenticealf.wordpress.com page)


Enjoyed this? Support me via Monero, Bitcoin, Lightning, or Ethereum!  More info.