How to convert audible AAX file to M4B format, while preserving all information (including artwork)

5,548

Solution 1

I know this is old but I wanted to give an update to this. In FFmpeg 4.1 they added native support for copying album art and you no longer need a third party program. To convert your audiobooks, just use this simplified command:

ffmpeg -activation_bytes XXXXXXXX -i MyNiceBook.aax -c copy MyNiceBook.m4b

Specifically you should drop the -vn flag and remove the :a from -c:a copy

This took me a while to find as they still include the -vn flag in their official docs.

Source: https://gist.github.com/r15ch13/0c548be006431607bf1eaecefdc0591a#gistcomment-2800421

Solution 2

The solution is simple, and requires the following programs (Windows solution):

  1. FFmpeg
  2. AtomicParsley

With these programs (either located where the AAX files are or available via PATH), create the following Windows batch file:

FOR /r %%a IN (*.aax) DO (^
del cover.jpg /Q & del "%%~na.mp4" /Q & del "%%~na.m4b" /Q & ^
ffmpeg -activation_bytes XXXXXXXX -i "%%a" -vcodec copy cover.jpg & ^
ffmpeg -activation_bytes XXXXXXXX -i "%%a" -vn -c:a copy -map_metadata 0:g "%%~na.mp4" & ^
ren "%%~na.mp4" "%%~na.m4b" & ^
IF exist cover.jpg (AtomicParsley.exe "%%~na.m4b" --artwork cover.jpg --overWrite) & ^
del cover.jpg /Q )

Or in one line:

FOR /r %%a IN (*.aax) DO (del cover.jpg /Q & del "%%~na.mp4" /Q & del "%%~na.m4b" /Q & ffmpeg -activation_bytes XXXXXXXX -i "%%a" -vcodec copy cover.jpg & ffmpeg -activation_bytes XXXXXXXX -i "%%a" -vn -c:a copy -map_metadata 0:g "%%~na.mp4" & ren "%%~na.mp4" "%%~na.m4b" & IF exist cover.jpg (AtomicParsley.exe "%%~na.m4b" --artwork cover.jpg --overWrite) & del cover.jpg /Q )

where XXXXXXXX is the secret extracted using audible-activator, which is the same for all files owned (bought) by the same user.

What this batch file is doing:

  1. delete possible files from previous conversion attempts
  2. extract the audible album art (if available) into a file called "cover.jpg", using FFmpeg
  3. extract the AAC audio from the AAX file, and all metadata and save them into MP4 file, using FFmpeg
  4. rename MP4 file to M4B
  5. (if available) add album art to MP4 file using AtomicParsley
  6. delete the cover.jpg file
Share:
5,548
Eh'den
Author by

Eh'den

Updated on September 18, 2022

Comments

  • Eh'den
    Eh'den almost 2 years

    I tried to find a solution that will allow me to batch-process a whole bunch of AAX files (which I bought over the years) into M4B.

    I tried using the audible-activator in order to extract the secret, then use FFMPEG with -activation_bytes [secret], as follows:

    ffmpeg -activation_bytes xxxxxxxx -i BOOK.AAX -c:a copy book.mp4 
    

    The problem is: how to create a batch file that not only converts to MP4, but also copies all artwork?

    Any ideas?

  • G-Man Says 'Reinstate Monica'
    G-Man Says 'Reinstate Monica' over 6 years
    (1) I’m not familiar with manipulating audio/video files, so this may be a naïve question, but: is the “XXXXXXXX” secret the same for all the files?  (2) It might help it you showed the procedure for extracting the secret, or at least linked to an explanation.  (3) What am I missing?  It looks like your ren "%%~na.mp4" "%%~na.m4b" command is outside the FOR /r %%a IN (*.aax) loop.  Is that intentional?  Can you explain it?
  • Eh'den
    Eh'den over 6 years
    1) The XXXXXXXX is the special secret which encrypt the AAX files. Each user has its own secret. 2) I've excluded the section on how to extract the secret, perhaps I will include it in the answer. It's slightly more complicated, but once you got it, it is valid for all your audible books related to your account. 3) Hopefully I fixed the code...
  • froh42
    froh42 about 4 years
    Thanks for saving my day by answering to an old question!