Open ZLoth opened 3 weeks ago
I can see from your screenshot of the edit chapters page that each of the audio files have embedded chapters. I cannot see what the actual issue is because I would have to see what those embedded chapters are for each file.
When an audiobook has multiple audio files that have embedded chapters Abs will attempt to merge them if they are different. From what I can see in the screenshot it looks like the audio files have chapters embedded with different timestamps. If that is the case it would be something you would want to fix on the audio files since that would be inaccurate chapter times.
This is the logic for audio files with embedded chapters https://github.com/advplyr/audiobookshelf/blob/5b22e945dab1d31ecb7727d26e2456f75151d1d0/server/scanner/AudioFileScanner.js#L467-L492
I have sent you log files and an example book via WeTransfer. The link has been provided to your advplyr email address.
The following is my workflow in Windows 11:
Note that the issue also occurs when I did the conversion in OpenAudible as a MP3. I switched several months ago because of the small size.
Hmmm.... when I did an audio probe of the chapters, I see the following:
"chapters": [
{
"id": 0,
"time_base": "1/1000",
"start": 0,
"start_time": "0.000000",
"end": 0,
"end_time": "0.000000",
"tags": {
"title": "Part I"
}
},
{
"id": 1,
"time_base": "1/1000",
"start": 0,
"start_time": "0.000000",
"end": 906562,
"end_time": "906.562000",
"tags": {
"title": "Chapter I"
}
},
{
"id": 2,
"time_base": "1/10000000",
"start": 9065620000,
"start_time": "906.562000",
"end": 9066078910,
"end_time": "906.607891",
"tags": {
"title": "Chapter II"
}
}
],
This, this is probably being generated by OpenAudible. Can you confirm?
The audio files have the previous and next chapter embedded that are close to 0 duration. I've seen that once before. I don't know what the advantage is in doing that. Having chapters with 0 duration doesn't seem like a good practice (especially since they aren't exactly 0, they are like 1ms).
I made an update that will filter out those chapters before merging. This worked well when testing with your audiobook.
The audio files have the previous and next chapter embedded that are close to 0 duration. I've seen that once before. I don't know what the advantage is in doing that. Having chapters with 0 duration doesn't seem like a good practice (especially since they aren't exactly 0, they are like 1ms).
Me too. I have opened up OpenAudible issue When splitting audiobook file, the previous/next chapter is included in the split file #1461 and referenced this issue.
I made an update that will filter out those chapters before merging. This worked well when testing with your audiobook.
Thank you. I look forward to the update.
@advplyr , OpenAudible is now working on a fix. Once a beta is released, I can provide you with another test file.
And, issue is not fixed with the latest OpenAudible beta, although I'm wondering if we are looking in the right place.
Looking back at the example book provided... here is lines 153-187 (edited for brevity)...
"chapters": [
{
"id": 0,
"tags": {
"title": "Part I"
}
},
{
"id": 1,
"tags": {
"title": "Chapter I"
}
},
{
"id": 2,
"tags": {
"title": "Chapter II"
}
}
],
But, when we look at lines 188-218, specifically line 209, we see the following (edited for brevity):
"format": {
"filename": "/audiobooks/Audiobooks/Soundscapes/The Adventures of Tom Sawyer - After modification by MP3TAG/03 - The Adventures of Tom Sawyer (TEST) - Chapter I.m4b",
"start_time": "0.000000",
"duration": "906.607891",
"tags": {
"title": "Chapter I",
}
}
Thus the "title" in line 209 matches up with the title on line 173. Ok, fine. However, lets look at another book.
My second example is NPR Road Trips: Postcards from Around the Globe. The Metadata originally had just Chapters 1-16, but I located the actual chapter titles and replaced them with MP3Tag. Lets take a look at lines 103-126 (edited for brevity):
"chapters": [
{
"id": 0,
"tags": {
"title": "Chapter 4"
}
},
{
"id": 1,
"tags": {
"title": "Chapter 5"
}
}
],
Yet, when I look at line 149 from the section of lines 127-171, I see the following (edited for brevity):
"format": {
"filename": "/audiobooks/Audiobooks/Non-Fiction/NPR Road Trips (Series)/NPR Road Trips- Postcards from Around the Globe/04 - NPR Road Trips Postcards from Around the Globe - A New Passage to India.mp3",
"start_time": "0.023989",
"duration": "435.670204",
"tags": {
"title": "A New Passage to India",
}
}
This changed title was from when I edited the M4A file so that the chapter title was "A New Passage To India". That's what I'm expecting to import into ABS, not Chapter 4 (or Chapter 5) for that matter. I can understand the logic if you are importing a single-file MP3/M4B file into ABS as all of the chapters titles are embedded in a single file. But, I'm splitting the chapters, thus expecting one file to have a single chapter.
Not sure how you want to handle the logic, but it should be that if there is a single chapter exceeded .2ms in the chapters section, then check format → tags → title and pull that title instead
PROBE - 04 - NPR Road Trips Postcards from Around the Globe - A New Passage to India.txt
@advplyr : From OpenAudible:
Great report. Confirmed. It looks like a strange thing with ffmpeg. I am working on a fix -- but even when I tell ffmpeg to not map any meta data, it still seems to pull chapter meta from the existing full book. Will keep working on it.
Ffmpeg has a separate flag for map_chapters
.
-map_chapters -1
to not keep chapters
What happened?
I have a preference towards breaking my audiobooks into multiple files at the chapter level. This has been occurring ever since I installed ABS at the end of March, 2024. When I import an audiobook, the chapter labels are duplicated with the same identical time stamp.
What did you expect to happen?
When importing an audiobook, only one instance of a chapter label is being imported.
Steps to reproduce the issue
WHAT SHOULD HAPPEN: For each chapter, one chapter label is being created. WHAT REALLY HAPPENS: Multiple chapter labels are being created.
MP3TAG screenshot showing file name and titles:
ABS Settings:
ABS Library Settings: I turned off everything except metadata and the issue still occurs.
Chapter Lists:
Log File: Log Files.zip
Recording of issue: https://github.com/user-attachments/assets/270b16e3-f9c1-41a0-880b-08df23d001df
Audiobookshelf version
v2.12.3
How are you running audiobookshelf?
Docker
What OS is your Audiobookshelf server hosted from?
Linux
If the issue is being seen in the UI, what browsers are you seeing the problem on?
Chrome
Logs
Additional Notes
Also tested with "Store metadata with item" has been switched off without resolution.