How to convert series of MP3 to a M4B in a batch

9

4

I have a batch of MP3 based books. Some of them divide into files according to book's own structure: chapters and so on. Some of them was just divided into equally lengthened parts.

So. I've bought an iPhone, and I want to convert them all to M4B format. How could I convert them in a batch? I mean how cold I set up a process once, for each book, and then, after couple of weeks, receive totally converted library.

The only able program for such conversion I've found was Audiobook Builder for a Mac. But it is pretty slow and do not support batching in principle.

Solutions for any platform, please.

Artem Tikhomirov

Posted 2009-10-18T14:46:41.187

Reputation: 487

Answers

5

To concatenate the MP3s to an M4B, you could use ffmpeg. Download a recent version, then run:

ffmpeg -i "concat:input0.mp3|input1.mp3|input2.mp3" -c:a libfdk_aac -b:a 64k -f mp4 output.m4b

Your ffmpeg might not have fdk_aac enabled; if that's the case, you can try using

  • -c:a libfaac (high quality)
  • -c:a aac -strict experimental (decent quality, but use higher bitrates)
  • -c:a libvo_aacenc (rather bad quality)

See the AAC encoding guide for more info.


If you want to use neroAacEnc instead, you could use:

ffmpeg -i "concat:input0.mp3|input1.mp3|input2.mp3" -f wav - | neroAacEnc -if - -ignorelength -q 0.3 output.m4b

Neither of these will add chapter metadata, I'm afraid.

evilsoup

Posted 2009-10-18T14:46:41.187

Reputation: 10 085

@slhck when i use "-c:a libfaac" the error message "Unknown encoder 'libfaac'" appears, similar to libfdk_aac , any suggestion pls? – athos – 2014-10-03T10:07:18.233

@athos either use one of the other ffmpeg options, or download neroAacEnc and use that (I'd recommend neroAacEnc if you don't have libfdk_aac).

– evilsoup – 2014-10-03T11:29:23.170

@athos The aac encoder should always work as it's built into ffmpeg. You can also build ffmpeg yourself if you're on Linux, or install it through Homebrew on OS X, which gives you the libfdk_aac encoder, and that's the one with the best quality. – slhck – 2014-10-03T12:15:14.250

@slhck is there a Windows solution? – athos – 2014-10-04T05:11:04.367

@athos It is possible (see here https://trac.ffmpeg.org/wiki/CompilationGuide#Windows) but probably a little more complicated. But just use the internal aac encoder—it's quite decent.

– slhck – 2014-10-04T08:38:42.757

1

Open a Terminal. Change to the directory the MP3 files are in. Type:

for i in *mp3 ; do ffmpeg -i $i -qscale 0 $i.m4a ; done

Of course, ffmpeg must be installed.

Note that I've used "m4a" above. The m4b format appears to be the same, just with a letter changed to indicate that it's a book. You can rename them all later if the one-letter difference bugs you. They play the same.

EDIT: I'm assuming you use a Mac. The above will also work on a PC if you run a Unix-like OS, or install Cygwin under Windows.

CarlF

Posted 2009-10-18T14:46:41.187

Reputation: 8 576

This will not add chapter metadata to result file, will it? – Artem Tikhomirov – 2009-10-18T17:27:38.497

2And it will not merge those mp3 files into one. What's the point? – Artem Tikhomirov – 2009-10-18T19:50:55.733

I didn't see a requirement to combine the chapters in your original question. You want to combine all the MP3 files for each audiobook into a single file, including adding metadata that marks the beginning and end of each chapter? That's not the question you originally asked. Unless that metadata is in the original MP3 files, I'm fairly sure you'll have to add it manually. – CarlF – 2009-10-19T14:47:18.333

My ffmpeg on Ubuntu 12.04 did not seem to know how to convert to .m4b but I worked around that by converting to .m4a and then renaming. – tripleee – 2013-10-03T07:54:36.163

0

If you're a Mac user, try Audiobook Binder http://bluezbox.com/audiobookbinder.html

tnq177

Posted 2009-10-18T14:46:41.187

Reputation: 111

tried to install, but it write that software damaged... – MrSmile – 2018-09-09T20:57:59.610