Converting mp3 audio books to m4b

Problem
When downloading audio books from the Internet they are usually in mp3 format, which is fine if you're only going to listen to them using your computer. But if you want to use your iPod/iPhone they will show up as music files and when using shuffle you might end up hearing a chapter from an audio book.

Solution
Using id3v2, faac and mpg321 you can convert the mp3's to the format used by iPod; m4b.

Setup
Start by emerging id3v2, faac and mpg321:

Emerge needed software: Now you have the tools needed.

Manually
Start by creating a play list for the audio book. Some versions of the iPod crashes when trying to play HUGE audio book files so split them into one file per CD:

Get all mp3 files:

Use the file "inputfile" as input for mpg321 and pipe it to faac: (In this case it's the first CD out of ten being encoded; --disc 1/10). Replace text within <> with the applicable info.

Encode m4b:

Automatic
In the manual example we did not use the earlier emerged id3v2, it's quite useful when creating files from multiple CDs. And as usual, it can be done with a script:

m3u2m4b.pl

This perl script uses a directory with mp3 and m3u files as input. It excludes m3u files starting with "0000" since these are (usually) the full collection of mp3's.