Convert Audible Files to mp3 — aa2mp3.sh (and, on the way, some comments about Mageia Linux)

I have a particular thing I want to do:

I want to use aa2mp3.sh to convert my audible content. It needs to use Audible Manager — this is not a method to convert Audible (.aa) files if you do not have an Audible log in! I have a Linux box but the wine installation of the Audible Manager is not working properly. It might be the rather old version of wine in Debian stable, it might be something else; I don’t know. So rather than mess with a nicely working installation, I am trying to set it up in VirtualBox.  This also means that, if it works, I have a solution that will work for people using Windows.

I’m looking at Mageia (v5) as the Linux – why?  Just because I haven’t played with it before.  This is what I did:

(1) Went to http://mirror.aarnet.edu.au/pub/mageia/iso/5/Mageia-5-LiveCD-KDE4-en-i586-CD/ and got the KDE CD.

(2) Created a default Linux 32-bit VM in VirtualBox, though went up to 512MB RAM.  Here is my Fedora walk-through.

(3) Put the iso in the virtual CD drive (in ‘Storage’ menu).

(4) Booted.

(5) Selected ‘Install’.

(6) Waited…chose language…

(7) Accepted licence…

(8) Set time zone (Mageia really holds your hand…)

(9) US Keyboard.

(10) Entered install wizard…

(11) Accepted defaults…

(12) Let it remove unrequired packages due to my hardware configuration…

(13) Waited while there was nothing to see but a splash screen…

(14) Just clicked accept or next or whatever until it asked me to halt machine and remove install media. Did so. Restarted.

(15) It booted … threw some errors but then I was able to add root password and create a user.

(16) Logged in as the user.

(17) Start button -> Tools -> System Tools -> enter root password.

(18) Clicked on ‘Update Your System’.

Mageia Control Center, with 'centre' spelled incorrectly.

Mageia Control Center, with ‘centre’ spelled incorrectly.

(19) Clicked my way through and let it update.

(20) Inside the guest, fired up browser, went to https://github.com/itayperl/aa2mp3.

(21) Clicked ‘Download zip’ and unpacked in ~/installs (after making ~/installs).

(22) In Mageia, went to ‘Start button -> Tools -> System Tools -> entered root password -> Configure Media Sources’ and added aarnet mirror…File -> Specific media mirror -> select aarnet (wow, easy!) except did not work… oh well, go ahead with existing config…

(23) Used ‘Install & Remove Software’ to install wine, mingw32-gcc, libav, ffmpeg.

Mageia Add/Remove Software interface.

Mageia Add/Remove Software interface — note the green circles; make sure ‘All’ is selected in both menus or the search will not look at all possible packages.

(24) Inside Mageia, went to audible.com, logged in and  and downloaded Audible Manager.

(25) Double-clicked on the installer and let Mageia’s version of wine install it. NOTE added later: Please see my reply to a comment on this post for more instructions on how to download Audible Manager; it is not obvious! Also, I can’t say whether a particular version of Manager will work on not, I just used the one that was current at the time…

(26) OK, good. Started Audible Download manager — how?  Well, opened a terminal window and typed:

dolphin ~/.wine/drive_c/Program\ Files/Audible/Bin

Then double clicked AudibleDownloadHelper.exe.

(27) No, I don’t want to activate a device. Then I got the menu and selected podcasts.

(28) Logged in with my Audible credentials, but it did not work… tried a reboot and tried again, after confirming by logging in to my Audible account that my password for Audible was correct.  Still no luck.  But…

(29) Audible sent me a passkey and that worked — probably this was necessary because I use an old Audible rather than an Amazon login.

(30) Ok, installed guest additions on Mageia… This turned out to be unnecessary, but I’ve left the steps in.

(31) Installed kernel headers and dkms.

(32) Went to the VirtualBox devices menu at the top of the guest: Devices -> Insert Guest additions CD image

(33) Made sure the CD was mounted, open a terminal, went there, logged in as superuser (su or sudo, if sudo is being used) and ran the VBoxLinuxAdditions script.

(34) It says is already has one installed. OK, let it go and set up the shares.

(35) (Actually, I stopped the VM, and exported it (File -> Export Appliance) and moved it to a different computer, but that is not relevant.)

(36) Imported it, set up sharing in accordance with Fedora post.  Used the ‘Music‘ folder on the host as the shared drive, since I just want to convert Audible files.

(37) So to mount the shared folder, on the guest (Mageia) type:

sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) sharehost /mnt/shareguest

(38) On guest,

cd ~/installs/aa2mp3-master

(39) Following instructions in the aa2mp3 bundle, I copied the DLL into the aa2mp3_master directory:

cp ~/.wine/drive_c/Program\ Files/Audible/Bin/AAX* .

(40) Ran make:

make

this created dump.exe, needed by the script. OK, gave it a whirl

(41) Copied an Audible ‘.aa‘ file into my work space:

cp ~/mnt/shareguest/Music/AudibleBackups/file.aa .

(42) Installed ffmpeg, avconv (tried both) — no avconv on Mageia?

(43) Ran the conversion, got an error:

Encoder (codec mp3) not found for output stream

OK, tried an ffmpeg static build from http://johnvansickle.com/ffmpeg/

wget http://johnvansickle.com/ffmpeg/builds/ffmpeg-git-32bit-static.tar.xz

(44) Unpacked the static build of ffmpeg in my ~/installs directory:

xz -d ffmpeg-git-32bit-static.tar.xz
tar x -vf ffmpeg-git-32bit-static.tar

(45) Put the new, statically-linked ffmpeg into the aa2mp3.sh script, path and all — I made a copy called aa2p3_static.sh. The only difference from the original is that I explicitly tell it where to find the ffmpeg binary. ‘username’ here is my username:

FFMPEG=/home/username/installs/ffmpeg/ffmpeg-git-20160317-32bit-static/ffmpeg

(46) Now, try again:

./aa2mp3_static.sh file.aa file.mp3

(47) Works!

This method will work on any platform that runs VirtualBox, I would think, which is the big three (Win, Lin, Mac) at least.

YMMV, and all the usual caveats.

The mp3 came out quite large compared to the .aa (about 3 times the size) so perhaps there’s an ffmpeg option or two that could be used to tune it.

As a final note, I would rate Mageia as one of the easiest out-of-the-box experiences I have had with a Linux.  I don’t know how extensive the package repository is, because I only had a very specific task in mind and did not do a general install, but it could hardly have been easier and everything I needed ‘just worked’ (well, except for needing the ffmpeg static build).  Given that it was easier than usual to get the VirtualBox guest additions to work, it looks like it is an absolutely ideal distribution to use in VB when a Windows or Mac user needs some Linux functionality or wants to gain some Linux experience.  I have only looked at this, the KDE version, so I won’t make broader comments.

Bon voyage!

Advertisements

Tags: , , , , , , , , , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

10 responses to “Convert Audible Files to mp3 — aa2mp3.sh (and, on the way, some comments about Mageia Linux)”

  1. John says :

    Hi

    This is great, but it omits two rather important pieces of information: how to download Audible Manager, and which version of that software you used successfully. From audible.com I found myself here:

    https://www.microsoft.com/en-us/store/p/audiobooks-from-audible/9wzdncrfj1cr

    Even if I spoof my user agent I just see with an odd URL scheme (ms-windows-store://…), and I don’t know what to do with that kind of link on Linux.

    Thanks!

    • Darren says :

      (1) Log in to Audible.
      (2) Top right of screen it says ‘Hi _name_”. Hover mouse over it an select ‘How to listen’.
      (3) Find “Don’t see your device listed? We have more, learn more here.” and click on :learn more here”
      (4) Select Microsoft from the drop down and then select install software. It should take you to https://www.audible.com/sw?pageFlowType=PC_WIZARD, which perhaps you could go to directly once logged in, I’m not sure.
      (5) Select ‘download to my computer’ and you should finally get a button called ‘Audible Manager’.

      There is probably a more direct route, but that is the only one I know. The file is called ‘ActiveSetupN.exe”. The direct link that MIGHT work is http://download.audible.com/AM50/ActiveSetupN.exe .

      • John says :

        Thanks, that got me unstuck!

        Your navigation instructions got me to a page headed “Audible Mobile Apps” — no “Don’t see your device listed”.

        However, I since managed to find the same file you did by browsing elsewhere — here’s what worked for me (to get the download: I’ll report back later re overall success…), but it boils down to downloading from the same link you found except it’s .co.uk – but I verified it is the same file for me as I get from the .com link:

        http://download.audible.co.uk/AM50/ActiveSetupN.exe

        In case they move it around here’s how I found that:

        * Visit audible.co.uk
        * Near top right, click “Hi ”
        * Select Help from the menu that pops up
        * Near bottom right, click “Audible Manager”
        * That page instructed me to do something else that did not work for me. Instead I clicked a link labelled “Software”, which took me to https://www.audible.co.uk/sw
        * Click “Download” button under “Windows PC Windows 8, 7, Vista, XP, 2000 and Windows based handheld devices”
        * Select “Download to my computer”
        * Click “Install Audible Manager”, which is a link to http://download.audible.co.uk/AM50/ActiveSetupN.exe

        At the time I had my user-agent string set to “Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)” (using the Firefox User Agent Switcher addon by Chris Pederick) – perhaps that makes a difference, I don’t know.

        As you rightly said, this is not going to help anybody who has not signed up for audible, as one should, authors need to get paid 🙂

    • John says :

      I appreciate your help on this Darren. May I ask for one more thing? Well, two I guess!

      1 Run wine –version and post the output
      2. Run AudibleDownloadHelper.exe and select “About Audible Download Manager…” from the “Options” menu (top of window)

      Here’s what I got, and my own results:

      wine-1.9.14 (this is the latest wine development version at the time of writing 2016-07-23)
      AudibleDownloadHelper (also known as “Audible Download Manager”) 6.6.0.19

      With those versions I got as far as clicking “Audible Podcasts” and entering my amazon login details (step 28), but that then gave me an error popup “Failed to send HTTP request.” Same error for for the wine 1.6.2 that comes with ubuntu 14.04 (1:1.6.2-0ubuntu4), so I’m guessing the problem is related to the version of AudibleDownloadHelper (i.e. the version ActiveSetupN.exe that I downloaded today is newer than your copy).

      If I don’t find a different combination of wine and ActiveSetupN.exe that work for me, I may try what you did and ask for a “passkey”, though I’m already using an active amazon login, not an old audible one…

      Thanks again

      • Darren says :

        Also, here are my outputs. Keep in mind these are from the Mageia virtual machine inside VirtualBox, that I use to do the conversion because my main machine is running Debian oldstable and some things have moved on…

        wine –version

        1.7.20

        Audible Manager — help -> About -> Version 5.5.0.8

        If you send me an email I might be able to help…

      • Simon says :

        I have the same problem, did you find a solution?

      • Darren says :

        The post outlines my solution. I thought it did, anyway.

      • Darren says :

        Hi Simon. I have not done anything new since this post, since it works for me. It may be a lucky/unlucky combination of versions of the different programs and scripts — wine, download manager, Linux. I can’t try combinations that I don’t have access to (I am not a Linux expert, just a user), and I don’t want to screw up the working system I’ve got running on Mageia. I don’t use that Mageia VM for anything else. All I can suggest is trying the whole process the same as what I did, making sure the VM has web access, and so on. The ‘passkey’ thing might help, or not. I know it does not help much, but I just tried things until they worked. Sorry.

    • John says :

      I tried running it in Windows 8. On attempting to log in, I get “This version of software is no longer supported. Please visit the Audible website for the most recent update.” Apparently it has been unsupported for over a year:

      http://www.windowscentral.com/audible-windows-8-gone-its-not-all-bad-news

      http://audible.custhelp.com/app/answers/detail/a_id/4601/~/the-audible-for-windows-8-app-no-longer-works-on-my-device

      I draw the line at installing Windows 10 and using their app store (AND itunes as well? not sure!), so I guess that’s that for me and audible…

      • Darren says :

        Hi John — I can’t say, I’ve never used Windows with Audible. As I note in the post, I use wine on Linux to install the download manager, and I dno’t use an ‘App’ for anything. I found that when I bought Audible content I could just download it from my library through Firefox, then copy the .aa or .aax files to my Audible-compatible mp3 player, and that was that. When I wanted to convert to mp3 I did that via wine (a Windows environment for Linux) and aa2mp3 as outlined in the post; I made no use of Windows at all. I’m no longer an Audible subscriber anyway. Their DRM is a real pain.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: