Audiobooks often come in the .m4b format, which is a convenient container for holding an entire book with chapter markers. However, not all audio players handle these large files or their chapters correctly. Sometimes, you just want individual MP3 or FLAC files for each chapter to play on your legacy MP3 player, car stereo, or specialized audio device.
In this post, I'll introduce splitm4b, a simple Python tool that solves this exact problem.
Quick Start
If you already have Python and FFmpeg installed, here is the fastest way to get started:
# Install the tool
pip install git+https://github.com/ShinChven/splitm4b.git
# Split your audiobook
splitm4b your-audiobook.m4b
Prerequisites
Under the hood, splitm4b relies on FFmpeg to handle audio conversion and processing. You need to have it installed on your system.
macOS:
brew install ffmpeg
Ubuntu/Debian:
sudo apt install ffmpeg
Installation
The tool is hosted on GitHub. You can install it directly using pip:
pip install git+https://github.com/ShinChven/splitm4b.git
Usage Guide
Basic Splitting
To split an audiobook into MP3 files (the default format), simply run the command with your file path:
splitm4b "The Hobbit.m4b"
This will:
- Read the chapter markers from the
.m4bfile. - Create a directory named after the book.
- Extract each chapter into a separate file inside that directory.
- Automatically attempt to match the source bitrate.
High-Quality Output (FLAC)
If you prefer lossless quality for archiving or high-end audio setups, you can export to FLAC:
splitm4b "The Hobbit.m4b" --format flac
Supported formats include: mp3 (default), aac, and flac.
Custom Bitrate
By default, splitm4b tries to detect the bitrate of the source file to avoid unnecessary bloat. However, if you want to force a specific bitrate (e.g., to reduce file size for a small player), you can specify it:
splitm4b "The Hobbit.m4b" --bitrate 64k
Metadata and Artwork Preservation
One of the best features of splitm4b is that it doesn't just cut the audio. It also carries over the album metadata and cover art from the original .m4b file to every single split chapter.
This means that when you load these files into your player:
- The book title will appear as the album name.
- The chapter titles will be correctly set as track names.
- The cover art will display beautifully on your screen, making for a much more polished experience.
Why Split?
While .m4b is great for Apple Books and capable players, splitting offers several advantages:
- Compatibility: Play your books on any device that supports standard audio files, from old MP3 players to smart speakers.
- Granular Control: Easily manage, share, or backup specific parts of a book.
- Navigation: Using file-based navigation is sometimes easier than seeking through a 20-hour file on devices with poor UI.
Give splitm4b a try and liberate your audiobooks from their single-file containers!
