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.15k stars 76 forks source link

MP3's added in wrong order and skipped files #223

Open kanjieater opened 1 year ago

kanjieater commented 1 year ago

A bunch of files with name column, track number, artist, and album properly tagged, and in alphabetical order by file name: image

Resulting output starts with the 13th track there which loses about 5 hours of audio image

It seems like the Chapter names might be alphabetically sorted? Chapter 1.1 goes to chapter 2.1, then later 1.2, 2.2 etc image image

I can privately share with you files for testing purposes to reproduce if need be.

kanjieater commented 1 year ago

Renaming the files to simple 01.mp3-47.mp3 at leasts gets them all included. image

Unfortunately, the chapters are still shuffled.

UPDATE: It seems like the chapter titles seem shuffled but the files seem to be playing in order inside of the m4b.

ffprobe for the 2nd track image

ffprobe for the m4b image image

sandreas commented 1 year ago

Phew, this is interesting and needs more investigation. m4b-tool tries to "naturally" sort files and names, which probably means it does not (fully) support your character set.

Instead of sharing the audio files, you could first share a list of chapter names generated with tone, so we may prevent sharing files under copyright:

tone dump --format=json --query='$.meta.title' /path/to/your/audiobook

It should show something like this:

Opening Credits
Kapitel 1
...
Kapitel 17
Kapitel 18
End Credits

Then the chapters of the output file with:

tone dump --format=chptfmtnative "/path/to/output.m4b"
## total-duration: 10:33:58.094
00:00:00.000 Intro
00:00:04.483 Opening Credits
00:00:26.749 Kapitel 1 (1/5)
...
10:18:32.829 Kapitel 17 (7/8)
10:23:38.843 Kapitel 17 (8/8)
10:32:58.181 Kapitel 18
10:33:34.125 End Credits
10:33:54.361 Outro

Comparing these two outputs should show significant differences in chapter name order. With these I can hopefully reproduce the issue.

Maybe you are also able to fix / workaround your issue with a text editor ;)

kanjieater commented 1 year ago

Individual audio files docker run -it -v ${PWD}:/mnt sandreas/tone:v0.1.3 dump --format=json --query="$.meta.title" "./"

第一部 五月【1】
第一部 五月【2】
第一部 五月【3】
第一部 五月【4】
第一部 五月【5】
第一部 六月【1】
第一部 六月【2】
第一部 六月【3】
第一部 六月【4】
第一部 七月【1】
第一部 七月【2】
第一部 七月【3】
第一部 八月【1】
第一部 八月【2】
第一部 八月【3】
第一部 八月【4】
第一部 八月【5】
第二部 九月【1】
第二部 九月【2】
第二部 十月【1】
第二部 十月【2】
第二部 十一月【1】
第二部 十一月【2】
第二部 十二月【1】
第二部 十二月【2】
第二部 十二月【3】
第三部 一月【1】
第三部 一月【2】
第三部 一月【3】
第三部 一月【4】
第三部 二月【1】
第三部 二月【2】
第三部 二月【3】
第三部 三月【1】
第三部 三月【2】
第三部 三月【3】
第三部 三月【4】
第三部 三月【5】
第三部 三月【6】
第三部 三月【7】
第三部 三月【8】
第三部 三月【9】
第三部 三月【10】
第三部 閉城【1】
第三部 閉城【2】
第三部 閉城【3】
第三部 エピローグ

docker run -it -v ${PWD}:/mnt sandreas/tone:v0.1.3 dump --format=json --query="$.meta.title" "./かがみの孤城.m4b"

第一部 五月【1】

MPV shows chapters as ffprobe gets them, Chapter 1.1 etc image

sandreas commented 1 year ago

Ok thanks, I see what I can do here. May take some time.

daelmo commented 6 months ago

I have the same issue with the latest docker container version on windows.

Edit: I am using Docker image 3.14 .