I have single large M4B container with audio book split into multiple chapters.
Is there quick way to extract chapters as separate files that will not require re-encoding to another format?
+ Reply to Thread
Results 1 to 7 of 7
Not sure if it works (never seen a M4B container, guess it's standard AAC audio with some kind of dedicated metadata), but I would try to import it in MKVToolNix, then in the "Output" tab, select "Split mode: Before chapters". If MKVToolNix does recognize the format, should produce one MKV (or MKA) file for each chapter. If not, you'd have to re-create a chapter template.
m4b is a mp4 audio container, it should be possible to extract the chapters to .m4a / .aac files without reencoding.
split audio into 20 min equal time interval segments split00.mp3, split01.mp3, split02.mp3, split03.mp3
ffmpeg -i input.m4b -c copy -f segment -segment_time 20:00 -reset_timestamps 1 split%02d.mp3
-reset_timestamps 1 is critical as for each segment it recalculates the time
%02d outputs 00, 01, 02, 03, etc. change to %03d for 000, 001, 002, 003, etc.
split an m4b audiobook into multiple mka or mkv audio files for each chapter (if it already has chapters) with MKVToolnix. Drag m4b file into MKVToolnix into Multiplexer then choose Output
[Attachment 60825 - Click to enlarge]
Note: same can be done with Freac by importing m4b and outputting an mp3 for each chapter
also probably best just done with m4b-tool
m4b-tool split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "data/my-audio-book.m4b"
m4b seems to be m4a + chapters. If this holds the following is possible via script:
- extract a section losslessly with ffmpeg using timestamps
- or extract chapters to mka with mkvtoolnix/mkvmerge then remux to .aac/m4a losslessly with ffmpeg.
- audiobooks don't typically have same length chapters.
- any conversion to mp3 implies recompression.
It turns out you can easily do this from the command line using MKVToolNix (specifically mkvmerge) and FFMPEG. This is in Windows; other OSes would just need to change the syntax of the "for" loop accordingly.
This first step will split the m4b file into individual mka (Matroska audio) files at each chapter marker in the m4b. This is lossless as you are only changing from an MP4 container to a Mastroska container; the actual audio stream is not transcoded.
C:\> C:\path\to\mkvmerge -o output.mka --split chapters:all input.m4b
C:\> for %f in (*.mka) do C:\path\to\ffmpeg -i "%f" -c:a copy -vn -f mp4 "%~nf.m4b"
I know it's not sexy, but it's got teeth.
Last I checked, MP4Box of the GPAC Framework will split at specific times and not chapter metadata just like FFMPEG. But this feature has been requested to be added to MP4Box, so maybe it will appear some time soon.