Background and Tools
An audiobook for iPod or a "m4b" file, is nothing more than a chapter-index audio file (usually encoded to aac). Multiple tools can be used to create these: Template:Wikipedia
- AUR, used to combine a group of already ripped audiofiles into a single m4b file with chapter marks. AUR - Available from the
- - Available from [community], this collection of CLI tools are more flexible than m4baker and can be used to create chapter marks for existing m4b files that are without them.
- - Available from [extra], used to split a single, large mp3 file into smaller mp3 files.
- AUR, used to generate a chapters file for MP4Box (part of gpac). AUR - Available from the
Scenario 1: Make an m4b file from individual mp3 files
- Use m4baker to combine many mp3 files into a single m4b file
Scenario 2: Make an m4b file from individual mp4 files
- Concatenate several mp4 files with MP4Box
Details: Individual mp4 files are easily cat'ed together using MP4Box's cat mode:
$ MP4Box -cat file1.mp4 -cat file2.mp4 output.mp4
The cat switch works with all streams supported in MP4Box, like ASP, AVC, AAC, MPEG-1/2 Audio and Video (eg MP3), TTXT and even on Vobsubs and ALAC.
Scenario 3: Make an m4b file from a single mp3 file
- Split the single mp3 file into even breaks constituting chapters
- Use m4baker to combine into a single m4b file
Scenario 4: Add chapter marks to an existing m4b file without them
- Generate a chapter list which defines the chapter marks
- Merge the chapter list with the audio data
- Convert the file to qt format
- Rename the file to the finalized m4b
Details: First, determine how long the mp4 file is using mediainfo:
$ mediainfo --inform="Audio;%Duration/String3%" book.mp4 19:04:53.874
In this example, the mp4 file is 19h 4m and 54 s.
Next, create a chapter list to break up the file into "chapters" or more digestible parts. The list itself is nothing more than a text file in a specific format (Nero chapter format to be precise). Use
makechapterlist to make this automatically.
The example file calls for roughly 19h 5m of content, but the script uses 10 m intervals so a sane value is simply 19x6=114 chapters.
$ makechapterlist Writes chapter files using a 10 min interval for each chapter
How many chapters are needed: 114 Done! /home/facade/chapter.list written.
The next step is to make the metadata in
chapter.list with the audio mp4 file. This is accomplished using
$ MP4Box -add book.mp4 -chap chapters.list book1.mp4
The resulting file now needs to be converted to Quicktime chapter markers using
$ mp4chaps –convert –chapter-qt book1.mp4
The final step is to simply rename the mp4 file to the m4b extension:
$ mv book1.mp4 book1.m4b