[Bug]: Long delay when pressing play on chapter marks in edit chapter screen with M4B media #406

Closed
opened 2026-04-24 23:08:07 +02:00 by adam · 5 comments
Owner

Originally created by @SenorSmartyPants on GitHub (Jun 1, 2022).

Describe the issue

Delay can be over a minute on a rockpi4.

Steps to reproduce the issue

  1. Select an M4B
  2. edit chapters
  3. click play on a later chapter in the book

Audiobookshelf version

2.0.18

How are you running audiobookshelf?

Docker

Originally created by @SenorSmartyPants on GitHub (Jun 1, 2022). ### Describe the issue Delay can be over a minute on a rockpi4. ### Steps to reproduce the issue 1. Select an M4B 2. edit chapters 3. click play on a later chapter in the book ### Audiobookshelf version 2.0.18 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:08:07 +02:00
adam closed this issue 2026-04-24 23:08:07 +02:00
Author
Owner

@Alumniminium commented on GitHub (Jun 7, 2022):

Content-Length: 235104494
Content-Range: bytes 65536-235170029/235170030

It appears that m4b's are getting downloaded in its entirety whenever you click play. Doesn't matter if you cllick a chapter or just play from the beginning.
That's whats causing the delay, its not streaming, its downloading.

I assume the experimental merge doesn't set some codec flag that allows fast start?

M4B is just MP4, so it will need -movflags +faststart for streaming. I assume it goes here:
https://github.com/advplyr/audiobookshelf/blob/master/server/managers/AbMergeManager.js#L124

very frustrating to discover this after merging half my library and replacing the original files

EDIT: -movflags +faststart did not seem to help at all. Starting playback, seeking still has insane delays. Time to go back to mp3
I did ffmpeg -i audiobookshelf-merged.m4b -c copy -movflags +faststart out.m4b and replaced the file in my library.

@Alumniminium commented on GitHub (Jun 7, 2022): `Content-Length: 235104494` `Content-Range: bytes 65536-235170029/235170030` It appears that m4b's are getting downloaded in its entirety whenever you click play. Doesn't matter if you cllick a chapter or just play from the beginning. That's whats causing the delay, its not streaming, its downloading. I assume the experimental merge doesn't set some codec flag that allows fast start? M4B is just MP4, so it will need `-movflags +faststart` for streaming. I assume it goes here: https://github.com/advplyr/audiobookshelf/blob/master/server/managers/AbMergeManager.js#L124 *very frustrating to discover this after merging half my library and replacing the original files* EDIT: `-movflags +faststart` did not seem to help at all. Starting playback, seeking still has insane delays. Time to go back to mp3 I did `ffmpeg -i audiobookshelf-merged.m4b -c copy -movflags +faststart out.m4b` and replaced the file in my library.
Author
Owner

@alexmaras commented on GitHub (Jun 29, 2022):

It may be worth pulling the latest image (advplyr/audiobookshelf:edge) and testing again. There was an issue with a Service Worker that has now been disabled. I was hitting this same issue and no longer have a problem - m4b filers play almost instantly no matter where in the file is requested.

@alexmaras commented on GitHub (Jun 29, 2022): It may be worth pulling the latest image (`advplyr/audiobookshelf:edge`) and testing again. There was an issue with a Service Worker that has now been disabled. I was hitting this same issue and no longer have a problem - m4b filers play almost instantly no matter where in the file is requested.
Author
Owner

@advplyr commented on GitHub (Jul 5, 2022):

This is in the latest release now. Please test again

@advplyr commented on GitHub (Jul 5, 2022): This is in the latest release now. Please test again
Author
Owner

@SenorSmartyPants commented on GitHub (Jul 5, 2022):

Plays right away.

@SenorSmartyPants commented on GitHub (Jul 5, 2022): Plays right away.
Author
Owner

@Alumniminium commented on GitHub (Jul 23, 2022):

it does not play right away for me. also there's very high cpu usage until it starts playing. I'm on the latest version using docker

@Alumniminium commented on GitHub (Jul 23, 2022): it does not play right away for me. also there's very high cpu usage until it starts playing. I'm on the latest version using docker
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#406