This guide walks you through the process of downloading and converting your Audible audiobooks using audible-cli
and AAXtoMP3
.
You’ll need the following tools:
- audible-cli: A command-line tool for downloading Audible audiobooks.
- AAXtoMP3: A script to convert AAX files into MP3 or M4B formats.
-
Install audible-cli
Installaudible-cli
globally on your system usingpip
(make sure Python is installed):pip install audible-cli
-
Log in to Audible
Log in to your Audible account by running the following command. This starts the login process and saves your credentials:audible quickstart
-
Clone the Repository
Clone theAAXtoMP3
repository to save the script locally:git clone https://github.com/KrumpetPirate/AAXtoMP3.git
-
Change into the Directory
Navigate into the newly createdAAXtoMP3
directory:cd AAXtoMP3
-
Make the Script Executable
Set permissions to make theAAXtoMP3
script executable:chmod +x AAXtoMP3
Now AAXtoMP3
is ready for use.
-
Download Audiobooks
Use the following command to download all audiobooks from your Audible account in AAXC format, including cover images and chapter information:audible download --aaxc --cover --cover-size 1215 --chapter --all
This command:
- Downloads all available audiobooks (
--all
). - Saves files in AAXC format.
- Adds cover images and chapter data at the specified cover size (
--cover-size 1215
).
- Downloads all available audiobooks (
-
Retrieve Activation Bytes
You’ll need the activation bytes for conversion, which can be obtained with this command:audible activation-bytes
Save the output, as you’ll need it for the conversion.
-
Convert to M4B Format
Use theAAXtoMP3
script to convert the downloaded AAXC files to M4B format. Include your activation bytes as follows:bash AAXtoMP3 -e:m4b --use-audible-cli-data --authcode <activation-bytes> *.aaxc
Replace
<activation-bytes>
with the activation bytes retrieved in the previous step.This command:
- Converts the files to M4B format (
-e:m4b
). - Uses both
--use-audible-cli-data
and--authcode <activation-bytes>
for authentication and decryption.
- Converts the files to M4B format (
# Install audible-cli
pip install audible-cli
# Audible login
audible quickstart
# Download audiobooks
audible download --aaxc --cover --cover-size 1215 --chapter --all
# Retrieve activation bytes
audible activation-bytes
# Clone AAXtoMP3 repository and make executable
git clone https://github.com/KrumpetPirate/AAXtoMP3.git
cd AAXtoMP3
chmod +x AAXtoMP3
# Convert audiobooks
bash AAXtoMP3 -e:m4b --use-audible-cli-data --authcode <activation-bytes> *.aaxc
This should allow you to successfully download and convert your Audible audiobooks.
This script automates the process of downloading and converting Audible audiobooks to M4B format. It sets up a dedicated environment in a directory named
AudibleExporter
, manages dependencies, and runs each necessary step for a seamless audiobook export.Key Points
Here’s a brief explanation of each step in the script:
Check and Install
mp4art
: The script first checks ifmp4art
is installed, which is required to add cover art to M4B files. If it’s missing, it attempts to installmp4v2
(the package containingmp4art
) based on the operating system.Check and Install
mediainfo
: Similarly, it checks formediainfo
, which is needed to add narrator and description tags to M4B files. Ifmediainfo
is not found, it will try to install it.Create
AudibleExporter
Directory: The script then creates a directory namedAudibleExporter
to organize the downloaded files and output. This ensures that all relevant files are saved in a single location.Set Up Virtual Environment: The script sets up and activates a Python virtual environment (
venv
) withinAudibleExporter
to isolate the installation ofaudible-cli
.Install
audible-cli
: Inside the virtual environment, it installsaudible-cli
, a tool used to download Audible audiobooks in the AAXC format.Login to Audible: The script checks if the user is logged in to Audible via
audible-cli
. If not, it prompts for a one-time login.Download Audiobooks: The script initiates the download of all audiobooks in AAXC format, including cover images and chapter data.
Retrieve Activation Bytes: It retrieves the activation bytes required to decrypt the downloaded files, capturing only the last 8 characters of the output.
Clone and Set Up
AAXtoMP3
Script: The script clones theAAXtoMP3
repository to the parent directory, moves theAAXtoMP3
script intoAudibleExporter
, and cleans up the cloned repository.Convert Audiobooks to M4B: The
AAXtoMP3
script is used to convert the downloaded AAXC files into M4B format with cover art and tags, using the retrieved activation bytes for decryption.Deactivate Virtual Environment: Finally, the virtual environment is deactivated, and the script confirms the process is complete.
This workflow ensures that all necessary dependencies are installed, files are organized, and the conversion from AAXC to M4B is seamless.
Running the Script
Save the script as
audible_exporter.sh
, make it executable, and run it:This will ensure all downloads and conversions are contained within the
AudibleExporter
directory.