Freeing Audible files with ffmpeg

Install dependencies:

apt-get install git python-requests python-selenium gpac

Get tool to acquire our activation bytes. These bytes will allow ffmpeg to decrypt the Audible aax files.

git clone https://github.com/inAudible-NG/audible-activator.git
cd audible-activator
wget http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip
unzip chromedriver_linux64.zip

Install a version of ffmpeg that supports the new feature -activation_bytes

mkdir /usr/local/ffmpeg
wget -O - http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | tar Jxf -
mv ffmpeg-3.0-64bit-static/* /usr/local/ffmpeg/
for m in ffmpeg ffmpeg-10bit ffprobe ffserver qt-faststart; do ln -s /usr/local/ffmpeg/$m /usr/local/bin/$m; done

Run audible_activator.py

./audible_activator.py
Username: user@example.com
Password:
CAFED00D

Audible aax files are encoded with aac so you can do the following to copy the stream out of the aax into an mpeg4 container and striping the DRM at the same time.

ACTIVATION_BYTES='CAFED00D'
ffmpeg -hide_banner -loglevel panic -activation_bytes ${ACTIVATION_BYTES} -i in.aax -c:v copy -c:a copy out.m4a