At the end of the steps below, when you've generated your m4b file, you want to drag it into Apple Books app. This is actually the only way to get the file to show up on Garmin Express Manager under Audiobooks.
So... onto intructions...
First run these commands:
Notes:
- FYI, if you already have pip3 installed, use pip3 instead.
brew install chromedriver ffmpeg
sudo easy_install pip
pip install selenium requests
git clone https://github.com/inAudible-NG/audible-activator
cd audible-activator
sed -i '' 's,chromedriver_path = "./chromedriver",chromedriver_path = "/usr/local/bin/chromedriver",' audible-activator.py
python3 ./audible-activator.py
Then enter your Audible username and password and wait for a while for the eight character activation key to be printed.
If you do not run the sed command that changes the value of the chromedriver_path variable, ./audible-activator.py results in an error like 'chromedriver' executable needs to be in PATH even if chromedriver is on the path or in the audible-activator directory. If your sed is GNU sed, replace sed -i '' with sed -i.
After that run a command like this:
ffmpeg -activation_bytes youractivationkey -i input.aax -c copy output.m4b
(I edited the command above based on the comments by LiWang and marcus erronius to replace output.m4a;mv output.m4{a,b} with output.m4b and to replace -vn -c:v copy with -c copy.)
If you try to use the ffmpeg command above with an aa file instead of an aax file, it results in an error like Option activation_bytes not found. To download a book from Audible as aax instead of aa, choose "Enhanced" from the "Audio Quality" dropdown in the view for downloading a book.
aax files are encrypted mp4 / m4a / m4b files so the ffmpeg command above does not re-encode audio and it preserves metadata such as chapters. mp4, m4a, and m4b are alternative filename extensions for the MPEG-4 Part 14 container format. The m4a and m4b extensions were originally introduced by Apple. One difference between the m4a and m4b extensions is that the option to remember the previous playback position in iTunes is enabled by default for files with an m4b extension but not for files with an m4a extension. iTunes also displays files with an m4b extension under audiobooks by default.
Old versions of iTunes did not have the checkbox to enable remembering the previous playback position, but remembering the previous playback position was always enabled for files with an m4b extension, so even Wikipedia still incorrectly states that "an .m4a audio file cannot "bookmark" (remember the last listening spot), whereas .m4b extension files can." (Even though I don't know if there are still other media players which behave like old versions of iTunes in that respect.)
The UTI for the m4b extension is com.apple.protected-mpeg-4-audio and Finder shows the kind of all m4b files as "protected MPEG-4 audio" even though all files with an m4b extension do not have copy protection.
Source: https://apple.stackexchange.com/questions/222917/how-do-i-use-ffmpeg-to-convert-audible-files
You can use this to obtain the activation bytes and even convert smaller sized audiobooks (upto 1.8GB): Audible Tools