Converting Audible files to mp3
I sometimes listen to audiobooks through audible. I pay 14.95$ a month for this service. Every month you get a book “credit” and with that credit you can “purchase” a book. This is actually a pretty good deal because some audiobooks cost way more that 14.95$
According to audible you “own” these books and they are “yours to keep forever”
and they even say you can cancel your membership and still have access to the books you purchased on any device.
However in the wording of this statement they make sure to
use the words cancel and membership. Not close and account, like they do on this page about deleting your audible account.
An audible membership is not the same thing as an audible account. According this page you will permanently loose access to any audible title you purchased if you close your account. This means you will always need an account to listen to your audiobooks. But if you log into your account on a browser you’ll notice that they provide an option to download the entire book to your local device.
Problem solved right? Just spend 16 hours downloading your entire library while never being able to close the window, and you’ll finally “own” your library.
Well it turns out these files are DRM protected Audible Enhanced Audiobook
files, not mp3. Audible “enhances” these files by making any non proprietary client that tries to listen to them destroy their users ears with the screams of amazon wear house employees.
Even if you open these files using a propriety client like apple’s books app, it still requires you to sign in to your audible account to listen to them. This means you can’t listen to your audio books on an mp3 player or any client that doesn’t first ping audible servers to make sure you own the book before listening to it.
If I buy a book from barns and noble and had to call the manager to read my book every time I went to a different coffee shop I wouldn’t say I “own” that book. Fortunately there is a way to liberate these audio books into mp3 files but unfortunately it takes a some effort.
Normally converting files into another codec can be done with ffmpeg
ffmpeg -i input.mp4 output.avi
But if we run the same command on our .aax
file it fails to convert the file.
If we look at ffmpegs documentation they have a section that seems to allow
you to convert aax
files but you need to use this -activation_bytes
flag with an eight character string as it’s argument.
These activation bytes are a unique string associated to your audible
account that allows ffmpeg to decode the audio files. This is similar
to an authentication token for an API. But audible doesn’t have a public
facing API and they don’t provide a way for you to get your activation bytes
from your audible account, so we need to use third party software to
get the activation bytes.
There are a couple of ways to get these activation bytes and depending on your situation the method to retrieve them might differ. If you still have access to the account that purchased the book then you can use the audible-cli which communicates with the non public facing audible API to retrieve your activation bytes and will even let you bulk download everything from your library.
If for some reason you don’t have access to your account but still have
access to the audible files you can use this audible plugin for rainbow crack
which will brute-force your activation bytes from the file. There’s also
audible-tools which does the same thing with javascript. I should also
note that audible recently started serving aaxc
files to users which
add an extra layer of encryption that only audible cli will be able to bypass.
I had over 40 audiobooks in my library and only about 5 of them were aaxc
but this might change in the future.
One option you should definitely not use is OpenAudible which despite it’s name it will try to charge you 20$ to convert the files on your machine. I don’t know how this is legal or why anyone would pay money to some to use a product they already own. But I guess enough people have had difficulty converting the books into mp3s that this is one of the first results that pops up when searching audible files to mp3. I even found a tutorial on how to crack OpenAudible by changing the time settings on your machine but’s they seem to have patched it.
For this post I’m assuming you have access to you’re audible account.
The first problem you need to solve with liberating your library is
actually getting all the .aax
files on your local device. If you have
massive library like I do manually saving from the browser is not even
an picture, I’m pretty sure audible intentionally throttles downloads
from the browser to discourage people trying to convert their library because
on mobile it takes a fraction of the time (probably because they know
It’s a lot harder to access local storage iOS without really jumping
through some hoops).
I’m gonna use the audible-cli project and this AAXtoMP3 script
which automates the process of splitting up the audiobook into chapters via ffmpeg.
first install audible-cli with pip3 install audible-cli
or
if you’re paranoid you can clone it from this repo and locally install with pip.
after that run audible quickstart
.
This will do is walk you through a the process of configuring the command line tool to communicate with audibles un-offical api. It will eventually ask you if you want to “login” with an external browser, type yes and it will spit out a sketchy url for you to copy and paste into your browser.
login to your account when prompted. After logging, in copy the url from the browser and paste it back into the program. you should get a message that says something like “successfully register your name’s audible for iPhone”.
When this is is done program will have made a hidden folder in your home
directory named .audible
with an audible.json
and config.toml
file in it. You should then be able to run audible library list
and it will list out every book you have in your audible library.
After that you can run audible library export
and it will
download a tab separated file with your whole library and some useful data in it.
To download your entire library run audbile download --all --aax-fallback
--aax-fallback
is very important because it will download those aaxc
files
if it can’t find the normal aax
file along with a .voucher
file that it will use
to decrypt them.
If you just want to save a specific audio book you can open up that .tsv
file
and find the title and asin
number associated to it.
Add that asin
number as an argument for the --asin
flag and it will do it’s thing.
audible download --asin [asin of book] --aax-fallback
After everything is downloaded run audible activation-bytes
and it
will print out your activation bytes that can be used to decrypt all non aaxc
files.
After saving your activation bytes the next step is to clone this script AAXtoMP3
make it executable.
git clone https://github.com/KrumpetPirate/AAXtoMP3
mv AAXtoMP3/AAXtoMP3 .
chmod +x AAXtoMP3
This script is a wrapper around ffmpeg that handles the process of decrypting
splitting the file up into chapters and extracting the cover art and other meta data.
It will also use the voucher files to decrypt aaxc
files.
Run the script in the same directory as your Audible files with the following arguments:
./AAXtoMP3 --authcode [activation-bytes]\
-e:mp3\ # codec
--level 4\ # compression level 0-9
--chaptered\ # splits up the audio files by chapter
--loglevel 1\
*.aax
To decode the aaxc
files run the same command but make sure you have the corresponding
.voucher
files in the directory as well. It might tell you your missing a chapter
cover file, if that happens find the asin
of the audio book and run audible
download with the chapter
and cover
flags and run the script again.
After this you should have a new directory named Audiobook
name of author with your
several mp3 files split up by chapter along with any cover art that was found
You can now load these files this on to any device and listen to it on what ever client you want. Theres probably a link in the description of this video to blog post with all the commands I used in this video.