jellyfin / jellyfin-android

Android Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
1.48k stars 244 forks source link

Incorrect/frequent buffering in speeds over 1x #1259

Closed cegfault closed 1 week ago

cegfault commented 9 months ago

Describe the bug

EDIT 2024-05-02: originally I thought this issue was related to network speeds; this was incorrect. I've edited for clarity: this is an issue on Direct

  1. Enable or force direct playing on server and client
  2. Open Jellyfin app on Android (tablet) with "Integrated player"
  3. Start playing a video
  4. Increase speed to 2x
  5. Observe annoyingly frequent buffering
  6. (optional) pause to allow app to buffer, wait for buffering to stop, then resume playback and observe frequent buffering still continues

TL;DR - the Jellyfin app does not buffer correctly when streaming at rates greater than 1x. The only way to avoid frequent stalling/buffering is to decrease speed to 1x.

Logs

*NONE* (nothing appears in the log after `StreamBuilder.BuildvideoItem(...) => (PlayMethod=DirectPlay, TranscodeReason=0 )` )

Application version

2.5.3

Where did you install the app from?

F-Droid

Device information

Pixel 5 and Galaxy A tab

Android version

Android 13 (LineageOS 20)

Jellyfin server version

10.8.13

Which video player implementations does this bug apply to?

cegfault commented 9 months ago

P.S. seeking works quickly, but playing still stalls/buffers afterword. I suspect this indicates that the initial stream/jumping to a timestamp shows the connection is fast enough to get the first few seconds loaded quickly, but is not able to sustain playback at that rate.

Ideally, Jellyfin should detect this and either (a) switch from direct play to a lower-rate transcode (ie, this should be fixed in the "Auto" bitrate algorithm), or (b) increase the buffer size and/or time to decrease the number of stalls.

Personally, I'd like an option to increase buffer size on the app, as I prefer video quality and don't mind buffers a few times across a movie. But right now a high-Mbps movie I'm testing is averaging a buffer every minute (so 80+ pauses across the entire film)

rlbr commented 9 months ago

I'm noticing this issue at normal playback speeds. I'm able to play the file with no pausing via sftp in VLC mobile app, so I can rule out network/IO issues. I'll see which version of the server/app has pause free playback.

cegfault commented 9 months ago

@rlbr can you try using the web player?

I just played around with the web player, and it appears the server is transcoding my test file for codec reasons. If I cripple the network speed, the server does a good job of changing the transcoding to a lower bitrate. After 1-2 buffers there is continual playback for me.

I'm beginning to wonder if this is a codec issue in ExoPlayer....

rlbr commented 9 months ago

@cegfault My use case is mostly through LAN since my uplink is very slow. I had assumed I was on LAN, but as it turned out I was going through my uplink. (🤦)

My uplink is about 7mbit/s. I was trying to play a file at 10mbit/s. Obviously it has to transcode. I'm not sure if I changed some settings but it didn't automatically opt to transcode. I use the ExoPlayer for the android client.

cegfault commented 9 months ago

I can confirm this is NOT a network rate issue, but an ExoPlayer issue. VLC (external app) and web player both perform flawless at 2x, but exo frequently buffrers.

I'm at my wit's end - how does one debug this?

jellyfin-bot commented 5 months ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

cegfault commented 5 months ago

This is still an issue. DirectPlay streams constantly buffer.

cegfault commented 5 months ago

I updated the original post to clarify this is a DirectPlay issue with ExoPlayer, and not at all network related.

jellyfin-bot commented 1 month ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.