4

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?

6

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

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

1
  • 1
    Thanks for saving my day by answering to an old question!
    – froh42
    Jun 23 '20 at 21:16
3

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
2
  • (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? Jan 6 '18 at 16:31
  • 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...
    – Eh'den
    Jan 6 '18 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.