[Enhancement]: Fix _Slightly_ misplaced chapters via silence detection #470

Open
opened 2026-02-20 01:04:04 -05:00 by deekerman · 4 comments
Owner

Originally created by @samosbor on GitHub (Jun 17, 2022).

Fix Slightly misplaced chapters via silence detection

I find that often, the chapter matching feature gets very close to the correct timestamps for chapter marks. However, usually there is a slight offset by a few seconds. Sometimes the offset is consistent, sometimes it is not (maybe due to encoding at slightly different speed).

M4B-tool has a feature to adjust chapters via silence detection. With the current chapter fix features getting us most of the way there, I think the silence detection would work very well.

Originally created by @samosbor on GitHub (Jun 17, 2022). ### Fix _Slightly_ misplaced chapters via silence detection I find that often, the chapter matching feature gets very close to the correct timestamps for chapter marks. However, usually there is a slight offset by a few seconds. Sometimes the offset is consistent, sometimes it is not (maybe due to encoding at slightly different speed). [M4B-tool](https://github.com/sandreas/m4b-tool) has a feature to adjust chapters via silence detection. With the current chapter fix features getting us most of the way there, I think the silence detection would work very well.
Author
Owner

@advplyr commented on GitHub (Jun 17, 2022):

That silence detection for chapters is a good idea. I can see how to detect the silence using ffmpeg and grab those timestamps, but I think the difficult part here will be the UI/UX.

Do you have a UI in mind for how this would be done?

There are a lot of edge cases I can think of, like you may not find matching chapters from audible but you still want to detect the chapter timestamps using silence. The number of silences might not match up with the chapters from audible.
Like how it was done in m4b-tool, we will probably want to add some way for the user to adjust the length of the silence.

On a similar note, the chapter editor was planned to have the ability to shift all chapter times X seconds. That would be separate from silence detection but seems relevant to mention here.

@advplyr commented on GitHub (Jun 17, 2022): That silence detection for chapters is a good idea. I can see how to detect the silence using ffmpeg and grab those timestamps, but I think the difficult part here will be the UI/UX. Do you have a UI in mind for how this would be done? There are a lot of edge cases I can think of, like you may not find matching chapters from audible but you still want to detect the chapter timestamps using silence. The number of silences might not match up with the chapters from audible. Like how it was done in m4b-tool, we will probably want to add some way for the user to adjust the length of the silence. On a similar note, the chapter editor was planned to have the ability to shift all chapter times X seconds. That would be separate from silence detection but seems relevant to mention here.
Author
Owner

@SpeakingOfBrad commented on GitHub (Nov 30, 2024):

I know this is an older request, so I hope it's okay to add my thoughts here.

For the UI aspect I imagine a simple "Adjust via silence detection" button near the top of the chapter edit page that will do its best to adjust the chapter timestamps to the end of the nearest silence of at least 1.5 seconds (or whatever you decide the default should be).
That would probably be enough for most use cases where the chapters are just slightly off.

@SpeakingOfBrad commented on GitHub (Nov 30, 2024): I know this is an older request, so I hope it's okay to add my thoughts here. For the UI aspect I imagine a simple "Adjust via silence detection" button near the top of the chapter edit page that will do its best to adjust the chapter timestamps to the end of the nearest silence of at least 1.5 seconds (or whatever you decide the default should be). That would probably be enough for _most_ use cases where the chapters are just slightly off.
Author
Owner

@ZLoth commented on GitHub (Mar 13, 2025):

This is one of serveral improvements that need to be made to the Chapter Editor.

@ZLoth commented on GitHub (Mar 13, 2025): This is one of serveral improvements that need to be made to the Chapter Editor.
Author
Owner

@andrew-hill commented on GitHub (Dec 23, 2025):

I think 2 actions are warranted here:

  1. Creation of chapters from silence >= N seconds. This could be achieved with a button + text box to set N. It would insert chapters unless an existing chapter marker exists within ~N seconds of new mark (or some other box to set minimum chapter length).
  2. Fine-tuning of chapters to nearby silence. Either longest silence found within X seconds of existing chapter mark, nearest silence >= N seconds, or some combination. The locking function in current UX would let you start small and increase X or N.

For fine-tuning chapter marks, an alternate UX could be to display the waveform around the chapter mark, so the user can see/pick the silence.

For books with very short silences, you'll be forced to use a small value of N from method 1 above. But it's easier to delete chapter markers than tune them manually.

For books where lookup is close but not quite right, method 2 will be useful. I had some books where the audible release was seemingly remastered from the same source (a fairly old narration), but with a very slightly differnet pace (~0.5% faster). Incrementally shifting, tuning 1 chapter, locking it, then re-shifting remaining, etc was pretty slow. I think either suggestion above would have done a pretty good job in this case as they had ~3 second silence between chapters.

An option to scale chapters proportionally to the local audiobook's duration could be useful too (as part of the lookup dialogue if you get the mistmatched duration error). Though I'm not sure how common my issue really is.

@andrew-hill commented on GitHub (Dec 23, 2025): I think 2 actions are warranted here: 1. Creation of chapters from silence >= N seconds. This could be achieved with a button + text box to set N. It would insert chapters unless an existing chapter marker exists within ~N seconds of new mark (or some other box to set minimum chapter length). 2. Fine-tuning of chapters to nearby silence. Either longest silence found within X seconds of existing chapter mark, nearest silence >= N seconds, or some combination. The locking function in current UX would let you start small and increase X or N. For fine-tuning chapter marks, an alternate UX could be to display the waveform around the chapter mark, so the user can see/pick the silence. For books with very short silences, you'll be forced to use a small value of N from method 1 above. But it's easier to delete chapter markers than tune them manually. For books where lookup is close but not quite right, method 2 will be useful. I had some books where the audible release was seemingly remastered from the same source (a fairly old narration), but with a very slightly differnet pace (~0.5% faster). Incrementally shifting, tuning 1 chapter, locking it, then re-shifting remaining, etc was pretty slow. I think either suggestion above would have done a pretty good job in this case as they had ~3 second silence between chapters. An option to scale chapters proportionally to the local audiobook's duration could be useful too (as part of the lookup dialogue if you get the mistmatched duration error). Though I'm not sure how common my issue really is.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/audiobookshelf#470
No description provided.