sandreas / m4b-tool

m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b
MIT License
1.12k stars 78 forks source link

Splitting book adds extra chapters #219

Closed gazpachoking closed 1 year ago

gazpachoking commented 1 year ago

It seems when I run the split command to split a book, each resulting file contains more than one chapter, which is confusing my audio player (audiobookshelf.) (Not sure if this is related to #218, I did get those errors when doing this split.)

For example, here is the metadata for the first 3 files created by the split command for one book: image image image

The rest of the files follow the same pattern, where they mark the previous and current chapter as starting at 00:00, and also mark the next chapter as starting right at the end of the file.

I'm not 100% confident on how the embedded chapters in an m4b file work, but it seems to me that each file should only contain 1 chapter starting at 00:00:00, since I've just run the command to split the book on chapter lines. The second two files seem especially wrong, since they mark 2 separate chapters as starting at the beginning of the track.

The result, is that when importing the book, I get a crazy amount more chapters marked than actually exist, and using the next/previous track buttons also requires redundant presses: image

sandreas commented 1 year ago

Confirmed, thanks for reporting. This is ffmpeg "behaviour" (maybe a bug), but I was able to workaround this in my tests. Fix follows hopefully in the next days.

gazpachoking commented 1 year ago

Awesome! Thanks so much for this project and all your work on it. 🍾