Chapterz: A script to help create chapters for M4B audiobooks

I made a script to help me add chapters for M4B files in MusicBrainz. I’m calling it chapterz. It’s written in Nushell and available on GitHub here. It uses tone to extract the chapters from an M4B file and formats them in the MusicBrainz tracklist format. It can also fetch the chapters for a book from an Audible ASIN or MusicBrainz Release ID. A chapters.txt output format is also supported which can be passed to tone to embed the chapters in an M4B file.

Since it isn’t possible to add track lengths with millisecond precision in the editor, the script rounds the track lengths in a way that minimizes the cumulative rounding error. This should keep chapter offsets within half a second of accuracy.

I hope that someone finds it helpful!

5 Likes