Stuttering audio in iOS #75

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

Originally created by @argash on GitHub (Feb 10, 2022).

Steps to reproduce

  1. open ABS iOS app
  2. pick audiobook
  3. begin playback

Expected behavior

  • Buttery smooth audio

Actual behavior

  • video of the behavior
  • I think this is only happening with mp3 files. So far I have tested with 2 books that use mp3 and replicated the issue, and one book using mp4 and was not able to replicate. I don't have time at the moment for further testing but if/when I find the time I will update with the results.

Environment data

Audiobookshelf Version: v1.6.66
Audiobookshelf iOS Beta: v0.9.40-beta

  • Android App?
  • [ X] iOS App?

iOS Issue

iOS Version: 15.2.1

iPhone model: 13 Pro Max

Originally created by @argash on GitHub (Feb 10, 2022). ### Steps to reproduce 1. open ABS iOS app 2. pick audiobook 3. begin playback ### Expected behavior - Buttery smooth audio ### Actual behavior - [video of the behavior](https://files.eriksplex.xyz/s/ez4N64M7ProWrkY) - I think this is only happening with mp3 files. So far I have tested with 2 books that use mp3 and replicated the issue, and one book using mp4 and was not able to replicate. I don't have time at the moment for further testing but if/when I find the time I will update with the results. ### Environment data Audiobookshelf Version: v1.6.66 Audiobookshelf iOS Beta: v0.9.40-beta - [ ] Android App? - [ X] iOS App? #### iOS Issue iOS Version: 15.2.1 iPhone model: 13 Pro Max
adam added the bug label 2026-04-24 23:05:49 +02:00
adam closed this issue 2026-04-24 23:05:49 +02:00
Author
Owner

@advplyr commented on GitHub (Feb 10, 2022):

I remember this happening and I think it was specific to when the audiobook was playing in the background. Can you check if you can pinpoint when the stutter starts happening?
I also remember fixing it btw, so maybe I messed something up on the last update.

@advplyr commented on GitHub (Feb 10, 2022): I remember this happening and I think it was specific to when the audiobook was playing in the background. Can you check if you can pinpoint when the stutter starts happening? I also remember fixing it btw, so maybe I messed something up on the last update.
Author
Owner

@argash commented on GitHub (Feb 10, 2022):

If you watch that video you can see it starts as soon as I start playing the book. I just tried another book with mp3 files and it played fine though. So I guess MP3 files are not the common denominator.

@argash commented on GitHub (Feb 10, 2022): If you watch that video you can see it starts as soon as I start playing the book. I just tried another book with mp3 files and it played fine though. So I guess MP3 files are not the common denominator.
Author
Owner

@argash commented on GitHub (Feb 11, 2022):

@advplyr were you able to watch that video before the link expired? I can reshare it if needed.

@argash commented on GitHub (Feb 11, 2022): @advplyr were you able to watch that video before the link expired? I can reshare it if needed.
Author
Owner

@dlahmad commented on GitHub (Mar 11, 2022):

I have the same problem. @advplyr it is definitely not specific to the app playing in the background. It happens as soon as I start an audiobook.

It makes the IOS app basically unusable for me, as a normal playback is not possible. It stops every 1 or 2 seconds.

Device: IPhone XR
IOS: 15.3.1 (Problem also existent with previous versions)

@dlahmad commented on GitHub (Mar 11, 2022): I have the same problem. @advplyr it is definitely not specific to the app playing in the background. It happens as soon as I start an audiobook. It makes the IOS app basically unusable for me, as a normal playback is not possible. It stops every 1 or 2 seconds. Device: IPhone XR IOS: 15.3.1 (Problem also existent with previous versions)
Author
Owner

@advplyr commented on GitHub (Mar 11, 2022):

@rasmuslos has done a lot of work on the ios app over the last week that may resolve this issue.

We are in the middle of a big rewrite of the data model so I can't really give an ETA on when that will be published. I'll be posting updates regularly in the discord server though.

@advplyr commented on GitHub (Mar 11, 2022): @rasmuslos has done a lot of work on the ios app over the last week that may resolve this issue. We are in the middle of a big rewrite of the data model so I can't really give an ETA on when that will be published. I'll be posting updates regularly in the discord server though.
Author
Owner

@rasmuslos commented on GitHub (Mar 20, 2022):

I am not entirely sure, but if the server transcodes on the fly it is possible that it isn't fast enough to keep up with your progress

@rasmuslos commented on GitHub (Mar 20, 2022): I am not entirely sure, but if the server transcodes on the fly it is possible that it isn't fast enough to keep up with your progress
Author
Owner

@advplyr commented on GitHub (Mar 20, 2022):

I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly.

@advplyr commented on GitHub (Mar 20, 2022): I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly.
Author
Owner

@rasmuslos commented on GitHub (Mar 22, 2022):

I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly.

I mean i could set a buffer size, but normally iOS does this automatically
https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration?preferredLanguage=occ

@rasmuslos commented on GitHub (Mar 22, 2022): > I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly. I mean i could set a buffer size, but normally iOS does this automatically https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration?preferredLanguage=occ
Author
Owner

@advplyr commented on GitHub (Mar 24, 2022):

I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly.

I mean i could set a buffer size, but normally iOS does this automatically https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration?preferredLanguage=occ

Android does it automatically too, I just increased the buffer size.
In android and HLS.js they have settings to set how long to wait before requesting a segment again after it fails. Maybe we need to find that setting so the audio player gives the server some more time to transcode.

@advplyr commented on GitHub (Mar 24, 2022): > > I didn't think of that. For android I configured the buffer time, maybe the iOS player just needs to be configured properly. > > I mean i could set a buffer size, but normally iOS does this automatically https://developer.apple.com/documentation/avfoundation/avplayeritem/1643630-preferredforwardbufferduration?preferredLanguage=occ Android does it automatically too, I just increased the buffer size. In android and HLS.js they have settings to set how long to wait before requesting a segment again after it fails. Maybe we need to find that setting so the audio player gives the server some more time to transcode.
Author
Owner

@rasmuslos commented on GitHub (Apr 15, 2022):

Maybe it is related to this ffmpeg warning

Cannot read BOM value, input too short
Error reading frame UFID, skipped
@rasmuslos commented on GitHub (Apr 15, 2022): Maybe it is related to this ffmpeg warning ``` Cannot read BOM value, input too short Error reading frame UFID, skipped ```
Author
Owner

@advplyr commented on GitHub (May 8, 2022):

Please test the latest iOS release, your audio files should direct play now.

@advplyr commented on GitHub (May 8, 2022): Please test the latest iOS release, your audio files should direct play now.
Author
Owner

@seefernando commented on GitHub (Jun 5, 2022):

I just downloaded the iOS app (0.9.47-Beta) and I'm seeing the same behaviour. Seems to only affect audiobooks that are one single file (only tested with 3 .mp3 files) but works file with .m4b files.

the MP3s play fine in firefox on windows and android, but also stutter when played in firefox on iOS.

@seefernando commented on GitHub (Jun 5, 2022): I just downloaded the iOS app (0.9.47-Beta) and I'm seeing the same behaviour. Seems to only affect audiobooks that are one single file (only tested with 3 .mp3 files) but works file with .m4b files. the MP3s play fine in firefox on windows and android, but also stutter when played in firefox on iOS.
Author
Owner

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

@seefernando I believe this is related to the browser not being able to direct play the audio files, so the server is transcoding the audio files in a streamable format (HLS).

Since the transcode is happening on the fly we are reporting back to the client that it is finished when it actually isn't so that the client can start playing right away.

The iOS audio player doesn't seem to handle this well and is trying to request segments that aren't yet created causing the stutter effect. Unfortunately the iOS audio player has very little documentation or just doesn't support any customization with how segments are requested (or I just haven't found it yet).

There must be a way to handle on-the-fly HLS transcoding eloquently since it seems other services handle this, but I'm still in the beginning of learning iOS development and hoping some iOS dev helps us out!

Fyi: Android HLS player (ExoPlayer) and the web HLS.js both allow customizing what happens when segments fail, how many segments ahead to request, etc. so we can handle it smoothly there.

@advplyr commented on GitHub (Jun 5, 2022): @seefernando I believe this is related to the browser not being able to direct play the audio files, so the server is transcoding the audio files in a streamable format (HLS). Since the transcode is happening on the fly we are reporting back to the client that it is finished when it actually isn't so that the client can start playing right away. The iOS audio player doesn't seem to handle this well and is trying to request segments that aren't yet created causing the stutter effect. Unfortunately the iOS audio player has very little documentation or just doesn't support any customization with how segments are requested (or I just haven't found it yet). There must be a way to handle on-the-fly HLS transcoding eloquently since it seems other services handle this, but I'm still in the beginning of learning iOS development and hoping some iOS dev helps us out! Fyi: Android HLS player (ExoPlayer) and the web HLS.js both allow customizing what happens when segments fail, how many segments ahead to request, etc. so we can handle it smoothly there.
Author
Owner

@seefernando commented on GitHub (Jun 5, 2022):

@advplyr thanks, its unfortunate for the lack of control. As a test I wanted to convert an MP3 to HLS (is that even a valid idea?), and to transfer the files I used nextcloud. Interestingly, from the nextcloud web ui (in firefox) I was able to stream the mp3 file without any stuttering.

I'm still looking for a way to convert from MP3 to HLS, will report back if I find anything. Though its interesting that the Nextcloud UI is able to play the file through browser while ABS stutters through the same browser.

@seefernando commented on GitHub (Jun 5, 2022): @advplyr thanks, its unfortunate for the lack of control. As a test I wanted to convert an MP3 to HLS (is that even a valid idea?), and to transfer the files I used nextcloud. Interestingly, from the nextcloud web ui (in firefox) I was able to stream the mp3 file without any stuttering. I'm still looking for a way to convert from MP3 to HLS, will report back if I find anything. Though its interesting that the Nextcloud UI is able to play the file through browser while ABS stutters through the same browser.
Author
Owner

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

I'm not sure the issue you are having is the transcode. If it is transcoding you will be able to see in the server logs that it is and when it's done you could save the HLS transcode that would be in /metadata/streams

@advplyr commented on GitHub (Jun 5, 2022): I'm not sure the issue you are having is the transcode. If it is transcoding you will be able to see in the server logs that it is and when it's done you could save the HLS transcode that would be in `/metadata/streams`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#75