[Bug]: Encoding for stream fails when playing m4b on iOS #539

Closed
opened 2026-02-20 01:05:16 -05:00 by deekerman · 3 comments
Owner

Originally created by @0xcd0e on GitHub (Jul 14, 2022).

Describe the issue

When continuing an audiobook on safari on iOS, the stream starts playing all the way at the beginning and the elapsed time in the player is frozen.
The Logs show some warnings:

2022-07-14 18:58:33 INFO [Server] Socket Connected IUK4SgpYEaQLBWuiAAAF

2022-07-14 18:58:49 INFO [PlaybackSessionManager] startSession: Closing open session "Audiobook 123" for user "username"

2022-07-14 18:58:49 INFO [STREAM] START STREAM - Num Segments: 6479

2022-07-14 18:58:49 INFO [STREAM] Starting Stream at startTime 5:27:15.0 (User startTime 5:27:45.0) and Segment #3272

2022-07-14 18:58:49 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -ss 19635.4s -noaccurate_seek -i /metadata/streams/play_tei3ov6i7l60nhv83i/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 3272 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/play_tei3ov6i7l60nhv83i/output-%d.ts /metadata/streams/play_tei3ov6i7l60nhv83i/final-output.m3u8

2022-07-14 18:58:50 WARN File path does not exist /metadata/streams/play_tei3ov6i7l60nhv83i/output-0.ts

2022-07-14 18:58:50 WARN [STREAM] Segment #0 Request @0:00.0 is before start time (5:27:45.0) - Reset Transcode

2022-07-14 18:58:50 INFO [FFMPEG] Transcode Killed

2022-07-14 18:58:51 INFO Stream Reset New Start Time 0:00.0

2022-07-14 18:58:51 INFO [STREAM] START STREAM - Num Segments: 6479

2022-07-14 18:58:51 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i /metadata/streams/play_tei3ov6i7l60nhv83i/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/play_tei3ov6i7l60nhv83i/output-%d.ts /metadata/streams/play_tei3ov6i7l60nhv83i/final-output.m3u8

2022-07-14 18:58:51 INFO 2022-07-14 18:58:51 INFO [STREAM] Clearing isResetting

2022-07-14 18:58:53 INFO [STREAM] play_tei3ov6i7l60nhv83i notifying client that stream is ready

2022-07-14 18:58:53 INFO [STREAM-CHECK] Check Files 2163 of 6479 33.38% Furthest Segment: 3943

2022-07-14 18:58:55 INFO [Server] Socket IUK4SgpYEaQLBWuiAAAF disconnected from client "username" after 22574ms

Steps to reproduce the issue

  1. Open abs on an iOS device
  2. Resume any audiobook that is in m4b format
  3. The audiobook always starts at the very beginning

Audiobookshelf version

v2.0.23

How are you running audiobookshelf?

Docker

Originally created by @0xcd0e on GitHub (Jul 14, 2022). ### Describe the issue When continuing an audiobook on safari on iOS, the stream starts playing all the way at the beginning and the elapsed time in the player is frozen. The Logs show some warnings: ``` 2022-07-14 18:58:33 INFO [Server] Socket Connected IUK4SgpYEaQLBWuiAAAF 2022-07-14 18:58:49 INFO [PlaybackSessionManager] startSession: Closing open session "Audiobook 123" for user "username" 2022-07-14 18:58:49 INFO [STREAM] START STREAM - Num Segments: 6479 2022-07-14 18:58:49 INFO [STREAM] Starting Stream at startTime 5:27:15.0 (User startTime 5:27:45.0) and Segment #3272 2022-07-14 18:58:49 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -ss 19635.4s -noaccurate_seek -i /metadata/streams/play_tei3ov6i7l60nhv83i/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 3272 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/play_tei3ov6i7l60nhv83i/output-%d.ts /metadata/streams/play_tei3ov6i7l60nhv83i/final-output.m3u8 2022-07-14 18:58:50 WARN File path does not exist /metadata/streams/play_tei3ov6i7l60nhv83i/output-0.ts 2022-07-14 18:58:50 WARN [STREAM] Segment #0 Request @0:00.0 is before start time (5:27:45.0) - Reset Transcode 2022-07-14 18:58:50 INFO [FFMPEG] Transcode Killed 2022-07-14 18:58:51 INFO Stream Reset New Start Time 0:00.0 2022-07-14 18:58:51 INFO [STREAM] START STREAM - Num Segments: 6479 2022-07-14 18:58:51 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i /metadata/streams/play_tei3ov6i7l60nhv83i/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/play_tei3ov6i7l60nhv83i/output-%d.ts /metadata/streams/play_tei3ov6i7l60nhv83i/final-output.m3u8 2022-07-14 18:58:51 INFO 2022-07-14 18:58:51 INFO [STREAM] Clearing isResetting 2022-07-14 18:58:53 INFO [STREAM] play_tei3ov6i7l60nhv83i notifying client that stream is ready 2022-07-14 18:58:53 INFO [STREAM-CHECK] Check Files 2163 of 6479 33.38% Furthest Segment: 3943 2022-07-14 18:58:55 INFO [Server] Socket IUK4SgpYEaQLBWuiAAAF disconnected from client "username" after 22574ms ``` ### Steps to reproduce the issue 1. Open abs on an iOS device 2. Resume any audiobook that is in m4b format 3. The audiobook always starts at the very beginning ### Audiobookshelf version v2.0.23 ### How are you running audiobookshelf? Docker
deekerman 2026-02-20 01:05:16 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

On my iphone 10 I can direct play m4b audiobooks so when I tested this it started at my last position fine.
What is the version of your iOS device?

If you looked further up in your logs then what you shared we could see if the iOS device first attempted to direct play and that failed. It should have attempted to direct play first before it switched to transcoding.

@advplyr commented on GitHub (Jul 14, 2022): On my iphone 10 I can direct play m4b audiobooks so when I tested this it started at my last position fine. What is the version of your iOS device? If you looked further up in your logs then what you shared we could see if the iOS device first attempted to direct play and that failed. It should have attempted to direct play first before it switched to transcoding.
Author
Owner

@0xcd0e commented on GitHub (Jul 15, 2022):

Im on iOS 15.5 on my iPhone12.
Those are the first logs from that session, there is nothing before that

@0xcd0e commented on GitHub (Jul 15, 2022): Im on iOS 15.5 on my iPhone12. Those are the first logs from that session, there is nothing before that
Author
Owner

@advplyr commented on GitHub (Oct 25, 2022):

I wasn't able to reproduce this. Until there is more info there is nothing to be done.

@advplyr commented on GitHub (Oct 25, 2022): I wasn't able to reproduce this. Until there is more info there is nothing to be done.
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#539
No description provided.