jellyfin / jellyfin-androidtv

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

Media playback speed/smoothness bad #1160

Closed sambartik closed 3 years ago

sambartik commented 3 years ago

Describe the bug After the 12 update the video playback is slower and crappier than in version 11. Over LAN, based on jellyfin dashboard, the container bitrate was about 4-8mbps (it varied) and video was being actively transcoded, which was caused by media exceeding the client container bitrate limit (Automatic on Android TV).

So I tried setting the limit manually to 100mbps. And it worked - the video was playing directly. The annoying part was that it was pausing all the time as if it was buffering.

Clicking back on TV remote from the video player caused a crash and it was annoying.

I feel like this is a bug because this is the only Jellyfin client that caused me these errors. On the very same TV it works perfectly when using Kodi with a Jellyfin plugin.

To Reproduce

  1. Change to manual bitrate limit
  2. Play a high quality media
  3. (click back on tv remote)

Expected behavior My bitrate shouldnt be limited that much in the first place since I am on the same LAN with fairly good connection.

After changing bitrate manually to more realistic limit, the video should play smoothly - without weird pauses.

Logs Dont have access to logs. The crashes have been reported online automatically.

System (please complete the following information):

Additional context The jellyfin server is running behind a HTTP reverse proxy.

sambartik commented 3 years ago

I tried testing TV - Jellyfin server LAN speeds. iPerf3 measured 111Mbps/94Mbps.

ManuLinares commented 3 years ago

You need to share some logs: go to the server dashboard like http://127.0.0.1:8096/web/index.html#!/log.html and share the log and the ffmpeg log.

nikhil96widhani commented 3 years ago

There is stuttering and audio Lag observer on my 2 tv's after this update. Please fix

sambartik commented 3 years ago

Thank you, @ManuLinares, for your help with logs. I have collected clean logs in a few scenarios, restarting jellyfin and cleaning logs after each test to keep things clean:

  1. Android TV Jellyfin app: Direct stream (bitrate limit set manually to 100Mbps) - stuttering
  1. Android TV Jellyfin app: Transcoding (bitrate limit set to automatic) - smooth but bad quality
  1. Android TV Kodi plugin: Direct stream - no problem (just for reference)

Hopefully that is enough information for now.

ManuLinares commented 3 years ago

Hopefully that is enough information for now.

Which client of iperf3 did you use? (This is my own curiosity as-well as troubleshooting)

So, the media is a 53gb mkv, HEVC, Colorspace: bt2020nc (HDR), bitrate: 55.226Kbps and resolution 3840x2160.

Tanscoding ffmpeg command-line: /usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"/data/media/movies/[redacted].mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -force_key_frames "expr:gte(t,n_forced*5)" -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=1920:h=1080:format=nv12" -copyts -avoid_negative_ts disabled -start_at_zero -b:v 19186517 -maxrate 19186517 -bufsize 38373034 -profile:v:0 high -level 41 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 ac3 -ac 6 -ab 640000 -y "/config/data/transcodes/46017e7ceeccb37ad33cf37834e747dc.mkv"

vaapi encoding at an average of 100 fps. So I guess encoding to 4k, not possible in realtime with vaapi.

Try 50Mbps in settings so it forces to transcode but at a higher quality

What GPU do you have in your server?

Have you tried libVLC, is the stutter only with Exoplayer?

sambartik commented 3 years ago

Which client of iperf3 did you use? (This is my own curiosity as-well as troubleshooting)

I used analiti SpeedTest WiFi Analyzer app from Google Play Store. It has among some other tools an iperf3 client built-in.

Since I have Intel's GPU (Intel Corporation CoffeeLake-U GT3e [Iris Plus Graphics 655]) I could use Intel Quick Sync, however I had problems after switching to IQS while transcoding the very same film. The playback looked normal for a minute and then the video started glitching weirdly (black and grey rectangles, colour noise) with audio playing fine in the background. It looked like some kind of transcoding error. Here are logs from this scenario:

Setting manually 50Mbps limit increased the streaming bitrate, there was no stuttering, but it was still transcoding instead of direct streaming because of that limit. Which is not favourable.

I use only libVLC player because some codecs the exoplayer just doesn't support.

nielsvanvelzen commented 3 years ago

Closing this issue as duplicate of #1035. See my comment (https://github.com/jellyfin/jellyfin-androidtv/issues/1061#issuecomment-939736611) in another issue for some additional information.

Let me know if this issue is different (not about stuttering / laggy playback) so I can re-open it.