Creating an Audiobook on Linux

| | Comments (4)
Categories: , ,
It wasn't until I had already gotten my first iPod about a month ago (in black, of course, because if you're anything like me, you know that black isn't a color but an attitude) that I discovered its audio book support. Audio books can be read aloud via the iPod at normal rate or at a slightly reduced or increased rate without changing the speach pitch. The iPod also remembers where I left off in an audio book, resuming from that position the next time I decide to listen to the audio book.

audiobook-ipod.jpgSince we have a number of audio books in tape or CD format for our kids, it only made sense to convert them to audio book format for the iPod to bring along on long rides by car, for example.

The creation of an audio book from existing files isn't straightforward, unfortunately, as the iPod audio book format relies on Apple's proprietary formats.

It took me a while of searching and reading online until I learned how to easily convert a collection of MP3 files into an audio book suitable for an iPod.

First, get the following support software:

  • mp3wrap, for combining multiple MP3 files into one,
  • mplayer, for decoding MP3 files to PCM format, and
  • faac, for converting audio to the audio book format.
Use your Linux distribution's preferred method for downloading and installing these free (of course!) utilities. On my Ubuntu Feisty 7.04 distribution, aptitude was able to locate, download, and install all three utilities.

You probably have multiple chapters or books in MP3 format from your CD or tape rip of the audiobook. Make sure they're named sequentially, e.g., "chapter001.mp3," "chapter002.mp3," etc. Combine these MP3 files into one single MP3 file using mp3wrap as follows:

mp3wrap outputfilename *.mp3

where outputfilename is the name of the combined MP3 files. You could call it "audiobook," for example.

Next, convert the file to PCM. This requires lots of disk space:

mplayer -vc null -vo null -ao pcm:nowaveheader:fast:file=outputfilename.pcm \
 outputfilename_MP3WRAP.mp3

where outputfilename is the same name as you chose for the mp3wrap utility. I'm using mplayer for the conversion, because several other MP3-to-PCM conversion utilities fail as soon as the PCM file size exceeds two Gigabytes.

When you start mplayer, look for a line in the status output that looks something like this:

AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)

This output indicates that the audio is output at a sample rate of 44,100 Hz (the sample rate of an audio CD), has two channels (i.e., it's stereo), and that sample in each channel is encoded in 16 bits, or 2 bytes, as "little-endian" (Intel mode).

Assuming that the parameters are 44,100 Hz, two channels, and 16 bits per sample, convert the PCM file to an audio book using faac:

faac -R 44100 -B 16 -C 2 -X -w -q 80 --artist "author" --album "title" \
--title "title" --track "1" --genre "Spoken Word" --year "year" \
-o outputfilename.m4b outputfilename.pcm

Again, outputfilename is your audio book filename. You probably want to rename it to reflect the title of the book by now if you didn't already specify that as an output filename. In the above syntax, author, title, and year are the author, the title, and the year of publishing of the book. You can put anything as genre, but "Spoken Word" is probably a good choice.

If the output of mplayer says anything else than 44,100 Hz, 2 ch, and s16le, such as 22050 Hz or 1 ch, then you must modify the appropriate parameters for faac. Instead of specifying "-R 44100," specify "-R 22050" in case the sample rate was 22050 Hz, and "-C 1" in case there was only one channel (1 ch) in the above command line example.

Once faac has finished encoding, which is by far the most time consuming part of the conversion process, you may safely delete outfilename.pcm. You can also delete your MP3 files, but you may want to hold on to the original MP3 files.

Audio books can be purchased and downloaded from a variety of online stores, but you might want to see if you can get one for free first. Check out Librivox, Project Gutenberg, Free Classic Audio Books, or Audiobooks.org for free audio books. These were just some of the suppliers of free audio books that came up on a Google search, so perhaps you'd like to add additional sources of free audio books in the comments?
  • Currently 4.6/5
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 4.6/5 (12 votes cast)

If you liked this post, share it with others:
  • Digg it!
  • Add to Del.Icio.Us
  • Add to Technorati
  • Stumble It!
  • NewsVine
  • Slashdot
  • Google Bookmarks
  • YahooMyWeb
  • Live
  • Facebook
  • Facebook
  • Add this post to Ma.gnolia
  • Add this post to Reddit
  • Thoof it

Categories

, ,

4 Comments

doomchild said:

Everything in this progression works except that faac hangs near the end of running. It gets with ten or fifteen seconds of finishing and then just stops. The process monitor makes it look as if it's still running, but it never finishes running on the command line. Any idea?

DC

Ole Wolf said:

If you're running faac version 1.24, then probably that's why. There is a known problem that causes faac v. 1.24 to hang which appears to have been fixed in version 1.25.

steven65 said:

one wolf thanks for your great info.

I came across
http://www.hear-now-audio-books.com
where Audio files from this website are compatible with the software that is already installed on most modern computers.

Once again thanks for your info.

Ole Wolf said:

I realized that some people have problems compiling faac version 1.25 on Linux. Here's what you do:

Download faac from SourceForge and extract the archive to a directory. (Well, duh. You knew this already if you ran into problems compiling what you downloaded.)

Get the "dos2unix" tool. On Ubuntu, it's part of the "tofrodos" package, which you can install with "sudo aptitude install tofrodos".

Change to the faac directory, and type:

dos2unix bootstrap
dos2unix configure.in
./bootstrap
./configure --with-mp4v2
make
sudo make install

And you're all set.

Leave a comment

Sign In

About This Entry

This page contains a single entry by Ole Wolf published on September 12, 2007 9:08 AM.

Previous entry: Single Dad's Burger Treat.

Next entry: Time for a Synthesis.

Find recent content on the main index or look in the archives to find all content.

Subscribe to Comments

Creative Commons License
This weblog is licensed under a Creative Commons License.