June 29, 2021

[Note] Converting Audible books to MP3 (legally)

GOAL

Audible runs on most of devices and via web browser.  Still some odd devices only support MP3.  This note is to convert Audible files you *own* to mp3 to listen to them on those odd devices.

 

REQUIRED S/W

Linux (Ubuntu 20), console, Chrome browser, Chrome driver

Optional: bash, ffmpeg, mid3v2


OVERVIEW

  1. Download Audible files from Audible site using your ID, PW.  The files are .aax format.
  2. Using an open source project, get "activation code" with your ID/PW.
  3. Using another open source project, convert AAX to MP3 with the activation code.

NOTE

  • When .aax is converted to mp3, the converter split them to multiple mp3 files, cover.jpg, and play list (.m3u).
  •  Optional S/W and steps are needed to do: merge all the mp3 into one mp3 file with cover image embedded.

STEPS

[1] Log onto Audible.com, click on 'Library' at the top.  Click on Download button.

[2] Get activation code

  1. $ git clone https://github.com/inAudible-NG/audible-activator.git
  2. Check your Chrome browser version
  3. Download an appropriate chrome driver version, https://chromedriver.storage.googleapis.com/index.html
  4. Unzip the download file.  Find and copy chromedriver executable into directory audible-activator
  5. cd audible-activator
  6. ./audible-activator.py -l us
    This will ask Amazon ID/PW.  Then it will give Player ID and activation_bytes:

$ ./audible-activator.py -l us
Username: [email protected]
Password:
[*] Player ID is SOME_PLAYER_ID

ATTENTION: Now you may have to enter a one-time password manually. Once you are done, press enter to continue...
activation_bytes: SOME_CODE

SOME_CODE is what you need for the next step, converting to MP3.

[3] Convert AAX to MP3

$ git clone https://github.com/KrumpetPirate/AAXtoMP3.git
$ cd AAXtoMP3
$ ./AAXtoMP3 --authcode SOME_CODE AUDIO_BOOK.AAX

It will create directory Audiobook/[AUTHOR]/[BOOK TITLE]/, and place .mp3, cover.jpg, play list file - .m3u files.

OPTIONAL STEPS

As mentioned, above step will create multiple mp3 files.  For some odd devices, you'd want to have only 1 mp3 file per book, and cover image embedded.

  • To merge mp3 files into one, use ffmpeg.
  • To add conver.jpg to the mp3, use mid3v2.  To obtain the s/w, do
    $ sudo apt install python3-mutagen

Sample Usage

Create a text file mp3list.lst, containing:

file '/path/to/file1.mp3'
file '/path/to/file2.mp3'
file '/path/to/file3.mp3'

$ ffmpeg -f concat -safe 0 -i mp3list.lst -metadata artist="$author" -metadata title="$book" -c copy $path/merged.mp3

Adding cover image:

$ mid3v2 -p cover.jpg merged.mp3

With a lot of AAX files, merging and adding cover image steps are tedious.  Here is a script I wrote to automate it (https://gist.github.com/keithkim/7c9ac8b7cd291bbcdb1a61ad29691048).  Save in Audiobook directory and run it from there:


 

REFERENCE

 

 

No comments: