audiobookshelf icon indicating copy to clipboard operation
audiobookshelf copied to clipboard

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

Open 0xcd0e opened this issue 2 years ago • 2 comments

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

0xcd0e avatar Jul 14 '22 17:07 0xcd0e

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 avatar Jul 14 '22 22:07 advplyr

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

0xcd0e avatar Jul 15 '22 04:07 0xcd0e

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

advplyr avatar Oct 25 '22 22:10 advplyr