[Bug] Audiobook length wrong (only some books) #1761

Closed
opened 2026-04-24 23:57:13 +02:00 by adam · 15 comments
Owner

Originally created by @pardofelis on GitHub (Feb 24, 2024).

Dear advplyr, dear folks who made this project possible,

first of all: Thank you for your time you put into this project.

Sadly, my library has sometimes a wrong audiobook length for some books.

Steps to reproduce - Type 1: Missing audio files

  1. I have scanned a folder containing multiple folders, each containing exactly 1 audiobook.
  2. The mp3 files in it are following always the same naming: %Author% %Album% - %Track%.mp3 [even renaming them to %Track% - %Album%.mp3 didn't help]
  3. When looking into the File Tab, there are all files visible and all audio files (e.g. 1-10) are shown as type "audio"
  4. When looking into the Chapter Tab, there is a length calculated that is way shorter than the length of all audio files and there are tracks "randomly" missing. E.g. chapter 1,2,4,5,6,7,9,10 is available, but chapters 3 and 8 are missing.
  5. This doesn't apply to every book, but in my case, I found 3 books (out of 30) that share this problem.

Ways I tried to get past this - and to add them to the library:

  • Delete the book in the library and rescan the whole library
  • Clicking the "Re-Scan" in the Edit Details Panel
  • Rename the files and Re-Scan
  • Retagging the files and Re-Scan
    Sadly, all of that didn't help.

Expected behaviour

  • Every audio file is added to the track list and the audiobook has the right playing length

Actual behaviour

  • Some audio files are not added and the audiobook is way shorter than the length of all audio files (because of the missing files)

Steps to reproduce - Type 2: Audiofiles with wrong length — Solved

  1. I have scanned a folder containing multiple audiobooks.
  2. The mp3 files in it are following always the same naming: %Author% %Album% - %Track%.mp3 [even renaming them to %Track% - %Album%.mp3 didn't help]
  3. When looking into the File Tab, there are all files visible and all audio files (e.g. 1-10) are shown as type "audio"
  4. When looking into the Chapter Tab, there is a length calculated that is way longer than the length of all audio files and some files show a length way more than when checking them on VLC Player, Windows Details or TagScanner. This results in my case in an audiobookt with twice the length than it actually has.
  5. This doesn't apply to every book, but in my case, I found 1 book with this problem.

Ways I tried to get past this - and to add them to the library:

  • using mp3val, I was able to repair the mp3 file.

Expected behaviour

  • Every audio file is added to the track list and the audiobook has the right playing length

Actual behaviour

  • Some audio files show an incorrect length and the audiobook is way longerthan the length of all audio files (because of the wrong times)

Environment data

Audiobookshelf Version:
v2.8.0 windows

Any suggestions how to solve these inconsistences is highly appreciated.
Have a nice day and thank you for your time

sincerely pardofelis

Originally created by @pardofelis on GitHub (Feb 24, 2024). Dear advplyr, dear folks who made this project possible, first of all: Thank you for your time you put into this project. Sadly, my library has sometimes a wrong audiobook length for some books. ### Steps to reproduce - Type 1: Missing audio files 1. I have scanned a folder containing multiple folders, each containing exactly 1 audiobook. 2. The mp3 files in it are following always the same naming: %Author% %Album% - %Track%.mp3 [even renaming them to %Track% - %Album%.mp3 didn't help] 3. When looking into the File Tab, there are all files visible and all audio files (e.g. 1-10) are shown as type "audio" 4. When looking into the Chapter Tab, there is a length calculated that is way *shorter* than the length of all audio files and there are *tracks "randomly" missing*. E.g. chapter 1,2,4,5,6,7,9,10 is available, but chapters 3 and 8 are missing. 5. This doesn't apply to every book, but in my case, I found 3 books (out of 30) that share this problem. Ways I tried to get past this - and to add them to the library: - Delete the book in the library and rescan the whole library - Clicking the "Re-Scan" in the Edit Details Panel - Rename the files and Re-Scan - Retagging the files and Re-Scan Sadly, all of that didn't help. ### Expected behaviour - Every audio file is added to the track list and the audiobook has the right playing length ### Actual behaviour - Some audio files are not added and the audiobook is way shorter than the length of all audio files (because of the missing files) ### Steps to reproduce - Type 2: Audiofiles with wrong length — Solved 1. I have scanned a folder containing multiple audiobooks. 2. The mp3 files in it are following always the same naming: %Author% %Album% - %Track%.mp3 [even renaming them to %Track% - %Album%.mp3 didn't help] 3. When looking into the File Tab, there are all files visible and all audio files (e.g. 1-10) are shown as type "audio" 4. When looking into the Chapter Tab, there is a length calculated that is way *longer* than the length of all audio files and *some files show a length way more than when checking them on VLC Player, Windows Details or TagScanner*. This results in my case in an audiobookt with twice the length than it actually has. 5. This doesn't apply to every book, but in my case, I found 1 book with this problem. Ways I tried to get past this - and to add them to the library: - using mp3val, I was able to repair the mp3 file. ### Expected behaviour - Every audio file is added to the track list and the audiobook has the right playing length ### Actual behaviour - Some audio files show an incorrect length and the audiobook is way longerthan the length of all audio files (because of the wrong times) ### Environment data Audiobookshelf Version: v2.8.0 windows Any suggestions how to solve these inconsistences is highly appreciated. Have a nice day and thank you for your time sincerely pardofelis
adam added the bug label 2026-04-24 23:57:13 +02:00
adam closed this issue 2026-04-24 23:57:13 +02:00
Author
Owner

@advplyr commented on GitHub (Feb 24, 2024):

The duration listed in the audio tracks column is incorrect for you?

image

@advplyr commented on GitHub (Feb 24, 2024): The duration listed in the audio tracks column is incorrect for you? ![image](https://github.com/advplyr/audiobookshelf-app/assets/67830747/8e6d23be-df07-4eac-b3a3-143216ba7061)
Author
Owner

@pardofelis commented on GitHub (Feb 25, 2024):

Hi advplyr,
thank you for your fast reply.
Yes, as for the second part (Type 2), it stated e.g. to be 5 hours in file 1 instead of 7 minutes it actually had. Meanwhile I searched around and - with the help of mp3val - found out that the audio files itself had an internal error regarding the length. After repairing them and re-scanned them, they now show the right length in the file panel. So that part seems to be solved.

Using the named tool mp3val I also checked the files of the Type 1 error. But sadly, the files didn’t show an error there. And I still cannot wait them to be shown as audio tracks.

@pardofelis commented on GitHub (Feb 25, 2024): Hi advplyr, thank you for your fast reply. Yes, as for the second part (Type 2), it stated e.g. to be 5 hours in file 1 instead of 7 minutes it actually had. Meanwhile I searched around and - with the help of mp3val - found out that the audio files itself had an internal error regarding the length. After repairing them and re-scanned them, they now show the right length in the file panel. So that part seems to be solved. Using the named tool mp3val I also checked the files of the Type 1 error. But sadly, the files didn’t show an error there. And I still cannot wait them to be shown as audio tracks.
Author
Owner

@nichwall commented on GitHub (Feb 25, 2024):

Steps to reproduce - Type 1: Missing audio files

  1. I have scanned a folder containing multiple audiobooks.

Is each book in its own folder? There can be multiple subfolders, but each book needs to be in its own directory.

So something like

Library/
  Author/
    Book1/
      Book1 files
    Book2/
      Book2 files

would work, but

Library/
  Author/
    Book1 files
    Book2 files

would not.

@nichwall commented on GitHub (Feb 25, 2024): > ### Steps to reproduce - Type 1: Missing audio files > > 1. I have scanned a folder containing multiple audiobooks. Is each book in its own folder? There can be multiple subfolders, but each book needs to be in its own directory. So something like ``` Library/ Author/ Book1/ Book1 files Book2/ Book2 files ``` would work, but ``` Library/ Author/ Book1 files Book2 files ``` would not.
Author
Owner

@pardofelis commented on GitHub (Feb 25, 2024):

Hi nichwall,
thank you for your reply.

Sorry for being unclear. What I meant was:

Scanned Folder Genre1/
— Folder Author1-Audiobook1
—— Files of audiobook1 (e.g. mp3, cover.jpg, playlist.m3u, details.html)
— Folder Author1-Audiobook 2
—— Files of audiobook2
— Folder Author2-Audiobook 3
—— Files of audiobook3
— Folder Author3-Audiobook 4
—— Files of audiobook1
….

So: yes, every audiobook is in its own folder, but there are multiple folders containing audiobooks in the scanned folder.

@pardofelis commented on GitHub (Feb 25, 2024): Hi nichwall, thank you for your reply. Sorry for being unclear. What I meant was: Scanned Folder Genre1/ — Folder Author1-Audiobook1 —— Files of audiobook1 (e.g. mp3, cover.jpg, playlist.m3u, details.html) — Folder Author1-Audiobook 2 —— Files of audiobook2 — Folder Author2-Audiobook 3 —— Files of audiobook3 — Folder Author3-Audiobook 4 —— Files of audiobook1 …. So: yes, every audiobook is in its own folder, but there are multiple folders containing audiobooks in the scanned folder.
Author
Owner

@advplyr commented on GitHub (Feb 25, 2024):

In the web client if you go to the book that has incorrect chapters and press "Edit Chapters" you can see more information about chapters.

My guess is the chapters were initially set before all the audio files were scanned in. Once the chapters are set they aren't going to be modified again when more audio files are scanned but you can go to "Edit Chapters" and map them again based on the audio tracks.

image

@advplyr commented on GitHub (Feb 25, 2024): In the web client if you go to the book that has incorrect chapters and press "Edit Chapters" you can see more information about chapters. My guess is the chapters were initially set before all the audio files were scanned in. Once the chapters are set they aren't going to be modified again when more audio files are scanned but you can go to "Edit Chapters" and map them again based on the audio tracks. ![image](https://github.com/advplyr/audiobookshelf-app/assets/67830747/5de67f69-2be5-4c22-a959-391c9e0e249b)
Author
Owner

@pardofelis commented on GitHub (Feb 26, 2024):

Hi advplyr,
attached I have taken two screenshots, one of the files page and one of the chapter page
As you can see, every audiofile is present in the files tab, but in the chapters page, some of them (e.g. 2,4,7,9) are missing in the files column

files tab

2024-02-26 08_01_19-Audiobookshelf - Chromium

chapter tab

2024-02-26 08_00_41-Audiobookshelf - Chromium

@pardofelis commented on GitHub (Feb 26, 2024): Hi advplyr, attached I have taken two screenshots, one of the files page and one of the chapter page As you can see, every audiofile is present in the files tab, but in the chapters page, some of them (e.g. 2,4,7,9) are missing in the files column ### files tab ![2024-02-26 08_01_19-Audiobookshelf - Chromium](https://github.com/advplyr/audiobookshelf-app/assets/59371182/a0effba7-a06e-4931-a20a-ef66400898de) ### chapter tab ![2024-02-26 08_00_41-Audiobookshelf - Chromium](https://github.com/advplyr/audiobookshelf-app/assets/59371182/35e14dbd-5964-4f9b-8355-08c6ca292d75)
Author
Owner

@pardofelis commented on GitHub (Feb 26, 2024):

Hi advplyr,

I have just copied the files out of the folder, deleted all files other than audio files and loaded them into mp3diags.
Afterwards I asked mp3diags to run several diagnoses. After having changed the files using that tool, I reloaded the folder.

When I looked into the logs, I found:

2024-02-26 09_19_28-Audiobookshelf - Chromium

which threw an error for every file that was already missing in the chapter tab before that step.

@pardofelis commented on GitHub (Feb 26, 2024): Hi advplyr, I have just copied the files out of the folder, deleted all files other than audio files and loaded them into mp3diags. Afterwards I asked mp3diags to run several diagnoses. After having changed the files using that tool, I reloaded the folder. When I looked into the logs, I found: ![2024-02-26 09_19_28-Audiobookshelf - Chromium](https://github.com/advplyr/audiobookshelf-app/assets/59371182/c8423cbe-b403-4fd2-b3c8-2e91d0905e65) which threw an error for every file that was already missing in the chapter tab before that step.
Author
Owner

@advplyr commented on GitHub (Feb 27, 2024):

Looks like there is an issue with those files. I would need a copy of them to determine what that issue is

@advplyr commented on GitHub (Feb 27, 2024): Looks like there is an issue with those files. I would need a copy of them to determine what that issue is
Author
Owner

@advplyr commented on GitHub (Mar 14, 2024):

This turned out to be an issue specific to ffprobe 6.1 so I updated the binary manager to only accept 5.1 for now until we can determine if it is a bug with ffprobe.

https://github.com/advplyr/audiobookshelf/commit/d2b006b909f2b3ab2569e3929f8018aeb342fe75

@advplyr commented on GitHub (Mar 14, 2024): This turned out to be an issue specific to ffprobe 6.1 so I updated the binary manager to only accept 5.1 for now until we can determine if it is a bug with ffprobe. https://github.com/advplyr/audiobookshelf/commit/d2b006b909f2b3ab2569e3929f8018aeb342fe75
Author
Owner

@advplyr commented on GitHub (Mar 17, 2024):

Fixed in v2.8.1

@advplyr commented on GitHub (Mar 17, 2024): Fixed in [v2.8.1](https://github.com/advplyr/audiobookshelf/releases/tag/v2.8.1)
Author
Owner

@cooperferguson42 commented on GitHub (Jan 12, 2025):

I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7.

@cooperferguson42 commented on GitHub (Jan 12, 2025): I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7.
Author
Owner

@nichwall commented on GitHub (Jan 12, 2025):

I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7.

This is most likely due to having bad metadata in the files. https://www.audiobookshelf.org/guides/ffprobe

@nichwall commented on GitHub (Jan 12, 2025): > I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7. This is most likely due to having bad metadata in the files. https://www.audiobookshelf.org/guides/ffprobe
Author
Owner

@unitedchic10 commented on GitHub (Mar 30, 2025):

I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7.

This is most likely due to having bad metadata in the files. https://www.audiobookshelf.org/guides/ffprobe

I also am having a similar issue however the audiobook in question is showing as 7hrs23mins when in fact the file is 36hrs03mins, Im currently using version 2.20.0

@unitedchic10 commented on GitHub (Mar 30, 2025): > > I'm having a similar issue. A single m4b file that is about 31 hours long is reading in Audiobookshelf as only about 4 hours. My current Audiobookshelf version is 2.17.7. > > This is most likely due to having bad metadata in the files. https://www.audiobookshelf.org/guides/ffprobe I also am having a similar issue however the audiobook in question is showing as 7hrs23mins when in fact the file is 36hrs03mins, Im currently using version 2.20.0
Author
Owner

@cshaa commented on GitHub (Apr 1, 2025):

I'm also having this problem. The penultimate chapter is listed as having the same length as the last one, even though it is, in fact, 49 minutes long.

Image

Downloading the penultimate chapter and checking it with ffprobe shows the correct length.

@cshaa commented on GitHub (Apr 1, 2025): I'm also having this problem. The penultimate chapter is listed as having the same length as the last one, even though it is, in fact, 49 minutes long. ![Image](https://github.com/user-attachments/assets/2d570bf5-dafe-45d7-a1d7-02524da117e6) Downloading the penultimate chapter and checking it with ffprobe shows the correct length.
Author
Owner

@kirillsimin commented on GitHub (Dec 8, 2025):

Not a fix, but a workaround I have found is to re-encode the mp3 with ffmpeg. I think audiobookshelf was getting tripped up by the header, even though I didn't see anything weird in ffprobe.

ffmpeg -i "original.mp3" \
  -codec:a libmp3lame -b:a 128k \
  -map_metadata -1 -map_chapters -1 \
  "original_clean.mp3"
@kirillsimin commented on GitHub (Dec 8, 2025): Not a fix, but a **workaround** I have found is to re-encode the mp3 with ffmpeg. I think audiobookshelf was getting tripped up by the header, even though I didn't see anything weird in ffprobe. ``` ffmpeg -i "original.mp3" \ -codec:a libmp3lame -b:a 128k \ -map_metadata -1 -map_chapters -1 \ "original_clean.mp3" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1761