jellyfin-media-player icon indicating copy to clipboard operation
jellyfin-media-player copied to clipboard

Hardware decoding is disabled when set to enabled, and vice-versa

Open loquinator3000 opened this issue 3 years ago • 3 comments

Describe the bug There does not seem to be any way to enable hardware decoding of video in Jellyfin Media Player. There is no such option in the interface, and creating mpv.conf with hwdec=vaapi does not seem to work either.

To Reproduce

Steps to reproduce the behavior:

  1. Create ~/.local/share/jellyfinmediaplayer/mpv.conf and add hwdec=vaapi
  2. Open Jellyfin Media Player and play a video that would be intensive if not for hardware decoding
  3. Stuttering, A/V desync, 100% processor time, ...

Desktop (please complete the following information): Arch Linux AUR Package

Additional context When opening an h265 video in standalone mpv, ~/.config/mpv/mpv.conf containing hwdec=vaapi is read, and video plays smoothly and with ~30% processor time.

jellyfinmediaplayer.log

loquinator3000 avatar Dec 26 '21 07:12 loquinator3000

What happens if you just leave it on default settings? (hwdec=auto) I just tested a 4k HEVC movie and CPU usage was basically zero.

Your logs also say it is actually using hardware decode, albeit in copy mode. 2021-12-26 01:34:10 [ INFO ] PlayerComponent.cpp @ 587 - vd: Using hardware decoding (vaapi-copy).

I guess you could also try adding vo=gpu and hwdec-codecs=all if the default settings aren't working.

TheFeelTrain avatar Dec 26 '21 10:12 TheFeelTrain

You can change the hardware decoding mode through the client settings menu in the UI.

iwalton3 avatar Dec 26 '21 14:12 iwalton3

So this is funny. Thanks @iwalton3 for making me look again for the UI for hardware decoding mode setting. I've deleted the mpv.conf, and changed the decoding mode from "copy" to "enabled" and got the same result. Then, when I tried setting it to disabled, the video plays smoothly with no stuttering, as if hardware decoding is actually enabled!

ghost avatar Dec 26 '21 21:12 ghost

Hardware decoding is disabled when set to enabled, and vice-versa

I can't see this happening.

But with hardware decoding "enabled", it falls back to hardware decoding in "copy" mode, for some reason:

2022-10-27 14:22:15 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Looking at hwdec h264-vaapi...
2022-10-27 14:22:15 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Could not create device.
...
2022-10-27 14:22:15 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Looking at hwdec h264-vaapi-copy...
2022-10-27 14:22:15 [ ERROR ] PlayerComponent.cpp @ 594 - vaapi: libva: /run/opengl-driver/lib/dri/iHD_drv_video.so init failed
2022-10-27 14:22:15 [ DEBUG ] PlayerComponent.cpp @ 588 - vaapi: Initialized VAAPI: version 1.15
2022-10-27 14:22:15 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Trying hardware decoding via h264-vaapi-copy.
...
2022-10-27 14:22:15 [ INFO  ] PlayerComponent.cpp @ 590 - vd: Using hardware decoding (vaapi-copy).

With "disabled", it uses software decoding:

2022-10-27 14:28:24 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Opening decoder h264
2022-10-27 14:28:24 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: No hardware decoding requested.
2022-10-27 14:28:24 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Using software decoding.
2022-10-27 14:28:24 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Detected 8 logical cores.
2022-10-27 14:28:24 [ DEBUG ] PlayerComponent.cpp @ 588 - vd: Requesting 9 threads for decoding.

@loquinator3000 did you check the logs whether it was using hardware/software decoding when you had it set to "enabled"/"copy"/"disabled"? I'm thinking if it could be so that hardware decoding in copy mode is slower than software decoding, and then your hardware decoding just always falls back to copy mode, so it's always slow? That happens to me, and I don't know how to fix it. (I mean, the fallback happens for me, can't say about the performance..)

jluttine avatar Oct 27 '22 11:10 jluttine

You could try running JMP as:

QT_XCB_GL_INTEGRATION="xcb_egl" jellyfinmediaplayer

and set hardware decoding to "enabled", not "copy".

Does that help? See: https://github.com/jellyfin/jellyfin-media-player/issues/231#issuecomment-1293408450

jluttine avatar Oct 31 '22 08:10 jluttine