Home

Awesome

AAXtoMP3

The purpose of this software is to convert AAX (or AAXC) files to common MP3, M4A, M4B, flac and ogg formats through a basic bash script frontend to FFMPEG.

Audible uses the AAX file format to maintain DRM restrictions on their audio books and if you download your book through your library it will be stored in this format.

The purpose of this software is not to circumvent the DRM restrictions for audio books that you do not own in that you do not have them on your personal Audible account. The purpose of this software is to create a method for you to download and store your books just in case Audible fails for some reason.

Requirements

Usage(s)

bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|--aac] [-s|--single] [--level <COMPRESSIONLEVEL>] [-c|--chaptered] [-e:mp3] [-e:m4a] [-e:m4b] [-A|--authcode <AUTHCODE>] [-n|--no-clobber] [-t|--target_dir <PATH>] [-C|--complete_dir <PATH>] [-V|--validate] [--use-audible-cli-data]] [-d|--debug] [-h|--help] [--continue <CHAPTERNUMBER>] <AAX/AAXC INPUT_FILES>...

or if you want to get guided through the options

bash interactiveAAXtoMP3 [-a|--advanced] [-h|--help]

Options for AAXtoMP3

Options for interactiveAAXtoMP3

AUTHCODE

Your Audible auth code (it won't correctly decode otherwise) (not required to decode the aaxc format).

Determining your own AUTHCODE

You will need your authentication code that comes from Audible's servers. This will be used by ffmpeg to perform the initial audio convert. You can obtain this string from a tool like audible-activator or like audible-cli.

Specifying the AUTHCODE.

In order of precidence.

  1. --authcode [AUTHCODE] The command line option. With the highest precedence.
  2. .authcode If this file is placed in the current working directory and contains only the authcode it is used if the above is not.
  3. ~/.authcode a global config file for all the tools. And is used as the default if none of the above are specified. Note: At least one of the above must be exist if converting aax files. The code must also match the encoding for the user that owns the AAX file(s). If the authcode does not match the AAX file no transcoding will occur.

MP3 Encoding

Ogg/Opus Encoding

AAC Encoding

FLAC Encoding

M4A and M4B Containers

Validating AAX files

Defaults

Custom naming scheme

The following flags can modify the default naming scheme:

Each flag takes a string as argument. If the string contains a variable defined in the script (eg. artist, title, chapter, narrator...), the corresponding value is used. The default options correspond to the following flags:

Additional notes:

Installing Dependencies.

In general, take a look at command-not-found.com

FFMPEG,FFPROBE

Ubuntu, Linux Mint, Debian

sudo apt-get update
sudo apt-get install ffmpeg libav-tools x264 x265 bc

In Debian-based system's repositories the ffmpeg version is often outdated. If you want to convert .aaxc files, you need at least ffmpeg 4.4. So if your installed version needs to be updated, you can either install a custom repository that has the newer version, compile ffmpeg from source or download pre-compiled binaries. You can then tell AAXtoMP3 to use the compiled binaries with the --ffmpeg-path flag. You need to specify the folder where the ffmpeg and ffprobe binaries are. Make sure they are both executable.

If you have snapd installed, you can also install a recent version of 4.4 from the edge channel:

snap install ffmpeg --edge

In this case you will need to confiure a custom path and binary name for ffprobe, --ffmpeg-path /snap/bin/ --ffprobe-name ffmpeg.ffprobe.

Fedora

Fedora users need to enable the rpm fusion repository to install ffmpeg. Version 22 and upwards are currently supported. The following command works independent of your current version:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Afterwards use the package manager to install ffmpeg:

sudo dnf install ffmpeg

RHEL or compatible like CentOS

RHEL version 6 and 7 are currently able to use rpm fusion. In order to use rpm fusion you have to enable EPEL, see http://fedoraproject.org/wiki/EPEL

Add the rpm fusion repositories in version 6

sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-6.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-6.noarch.rpm

or version 7:

sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm

then install ffmpeg:

sudo yum install ffmpeg

MacOS

brew install ffmpeg
brew install gnu-sed
brew install grep
brew install findutils

mp4art/mp4chaps

Note: This is an optional dependency, required for adding cover art to m4a and b4b files only.

Ubuntu, Linux Mint, Debian

sudo apt-get update
sudo apt-get install mp4v2-utils

On Debian and Ubuntu the mp4v2-utils package has been deprecated and removed, as the upsteam project is no longer maintained. The package was removed in Debian Buster, and Ubuntu Focal [ 20.04 ].

CentOS, RHEL & Fedora

# CentOS/RHEL and Fedora users make sure that you have enabled atrpms repository in system. Let’s begin installing FFmpeg as per your operating system.
yum install mp4v2-utils

MacOS

brew install mp4v2

mediainfo

Note: This is an optional dependency.

Ubuntu, Linux Mint, Debian

sudo apt-get update
sudo apt-get install mediainfo

CentOS, RHEL & Fedora

yum install mediainfo

MacOS

brew install mediainfo

AAXC files

The AAXC format is a new Audible encryption format, meant to replace the old AAX. The encryption has been updated, and now to decrypt the file the authcode is not sufficient, we need two "keys" which are unique for each audiobook. Since getting those keys is not simple, for now the method used to get them is handled by the package audible-cli, that stores them in a file when downloading the aaxc file. This means that in order to decrypt the aaxc files, they must be downloaded with audible-cli. Note that you need at least ffmpeg 4.4.

Audible-cli integration

Some information are not present in the AAX file. For example the chapters's title, additional chapters division (Opening and End credits, Copyright and more). Those information are avaiable via a non-public audible API. This repo provides a python API wrapper, and the audible-cli packege makes easy to get more info. In particular the flags --cover --cover-size 1215 --chapter downloads a better-quality cover (.jpg) and detailed chapter infos (.json). More info are avaiable on the package page.

Some books might not be avaiable in the old aax format, but only in the newer aaxc format. In that case, you can use audible-cli to download them. For example, to download all the books in your library in the newer aaxc format, as well as chapters's title and an HQ cover: audible download --all --aaxc --cover --cover-size 1215 --chapter.

To make AAXtoMP3 use the additional data, specify the --use-audible-cli-data flag: it expects the cover and the chapter files (and the voucher, if converting an aaxc file) to be in the same location of the AAX file. The naming of these files must be the one set by audible-cli. When converting aaxc files, the variable is automatically set, so be sure to follow the instructions in this paragraph.

For more information on how to use the audible-cli package, check out the git page audible-cli.

Please note that right now audible-cli is in dev stage, so keep in mind that the naming scheme of the additional files, the flags syntax and other things can change without warning.

Anti-Piracy Notice

Note that this project does NOT ‘crack’ the DRM. It simply allows the user to use their own encryption key (fetched from Audible servers) to decrypt the audiobook in the same manner that the official audiobook playing software does.

Please only use this application for gaining full access to your own audiobooks for archiving/conversion/convenience. DeDRMed audiobooks 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 audiobooks for us to hear, and enjoy. Don’t be a parasite.

This blurb is borrowed from the https://apprenticealf.wordpress.com/ page.

License

Changed the license to the WTFPL, do whatever you like with this script. Ultimately it's just a front-end for ffmpeg after all.

Need Help?

I'll help out if you are having issues, just submit and issue and I'll get back to you when I can.