A TypeScript library and CLI tool for converting Audible AAX audiobooks to standard MP3, M4A, or M4B formats.
- Convert AAX files to MP3, M4A, or M4B formats
- Preserve chapter information
- Automatically detect Audible activation code
- Split audiobooks by chapters
- Simple command-line interface
# Install globally
npm install -g @stacksjs/aax
# Or use with npx
npx @stacksjs/aax
ffmpeg
&audible
must be installed and available in your PATH
Please read Using the Audible CLI Integration for more information.
aax convert /path/to/audiobook.aax
aax convert /path/to/audiobook.aax --format m4b --output ./my-audiobooks --bitrate 192
aax split /path/to/audiobook.aax
-o, --output <dir>
- Output directory (default: ./converted)-f, --format <format>
- Output format: mp3, m4a, m4b (default: mp3)-c, --code <code>
- Audible activation code (auto-detected if not provided)--chapters
- Preserve chapter information (default: true)-b, --bitrate <kbps>
- Audio bitrate in kbps (default: 'source' to match the original file)-v, --verbose
- Enable verbose logging--flat-folder-structure
- Use flat folder structure--series-title-in-folder-structure
- Include series title in folder structure--variable-bit-rate
- Apply variable bit rate--aac-encoding-44-1
- Fix AAC encoding for 44.1 kHz--use-named-chapters
- Use named chapters if available--skip-short-chapters-duration <seconds>
- Skip short chapters between book parts--skip-very-short-chapter-duration <seconds>
- Skip very short chapters at begin and end
import { convertAAX } from 'aax'
async function convertBook() {
const result = await convertAAX({
inputFile: '/path/to/audiobook.aax',
outputFormat: 'mp3',
outputDir: './converted',
chaptersEnabled: true,
bitrate: 128,
})
if (result.success) {
console.log(`Conversion complete: ${result.outputPath}`)
}
else {
console.error(`Conversion failed: ${result.error}`)
}
}
You can create an aax.config.ts
or aax.config.js
file in your project root to customize default settings:
export default {
verbose: true,
outputFormat: 'mp3',
outputDir: './my-audiobooks',
chaptersEnabled: true,
bitrate: 192,
// Optional: manually set the activation code
// activationCode: '1a2b3c4d',
// Optional: specify a custom FFmpeg path
// ffmpegPath: '/usr/local/bin/ffmpeg',
// New options
flatFolderStructure: false,
seriesTitleInFolderStructure: true,
fullCaptionForBookFolder: false,
partFolderPrefix: 'standard',
sequenceNumberDigits: 2,
customSearchWords: [],
additionalPunctuation: '',
intermediateFileCopy: false,
aacEncoding44_1: false,
variableBitRate: false,
reduceBitRate: 'no',
fileType: 'm4a',
useISOLatin1: false,
extractCoverImage: true,
useNamedChapters: true,
skipShortChaptersDuration: 25,
skipVeryShortChapterDuration: 10,
verifyChapterMarks: 'all',
preferEmbeddedChapterTimes: true,
}
This tool integrates with the Audible CLI to automatically retrieve activation bytes (activation codes) from Audible's servers using your account credentials. This makes it much easier to convert your AAX audiobooks without manually finding activation codes.
- Download the Audible CLI binary and place it in the root of your project:
- Audible CLI Releases
- Choose the appropriate version for your OS (e.g.,
audible-cli-0.2.0-windows-amd64.exe
for Windows) - Rename it to
audible
and place it in the project root
Run the setup command:
aax setup-audible
This will:
- Check if the audible binary exists
- Make it executable
- Run the quickstart wizard (you'll need to follow the interactive prompts to log in to your Audible account)
- Retrieve your activation bytes from Audible's servers
- Save them for future use
During the setup process, you'll see something like this:
Setting up Audible CLI and retrieving activation bytes...
Note: You may be prompted to log in to your Audible account.
Follow the prompts in the terminal to complete the setup.
Attempting to get activation bytes from Audible CLI...
Audible CLI is not configured. Setting up...
Starting Audible CLI quickstart. Please follow the prompts to log in to your Audible account.
# ... (interactive login process) ...
Fetching activation bytes from Audible server...
β
Found activation bytes from Audible CLI: 2c******
β
Successfully retrieved activation bytes: 2c******
You can now use this activation code with the convert command:
aax convert your-audiobook.aax -c 2c1eeb0a
The activation code has been saved and will be used automatically for future conversions.
Once set up, your activation code will be automatically used for all future conversions, so you don't need to specify it manually.
If the automated setup fails, you can do it manually:
-
Run:
./audible quickstart
-
Follow the prompts to log in to your Audible account
-
Once set up, run:
./audible activation-bytes
-
Note the activation code (a 8-character hex string like
2c1eeb0a
) -
Use this code with the convert command:
aax convert your-audiobook.aax -c YOUR_ACTIVATION_CODE
Note that this software does not 'crack' the DRM or circumvent it in any other way. The application simply applies the user's own activation code (associated with their personal Audible account) to decrypt the audiobook in the same manner as the official audiobook playing software does.
Please only use this application for gaining full access to your own audiobooks for archiving / conversion / convenience. De-DRMed audiobooks must 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 listen to and enjoy.
Amazon's lack of Mac support requires us to act.
Please see CONTRIBUTING for details.
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States π
- @audiamus for the original AaxAudioConverter
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
The MIT License (MIT). Please see LICENSE for more information.
Made with π