linuxserver / docker-jellyfin

GNU General Public License v3.0
647 stars 97 forks source link

i965 driver not loading, HW acceleration issue with i965 drivers #144

Closed skoulof closed 2 years ago

skoulof commented 2 years ago

linuxserver.io


Expected Behavior

I followed the guidelines to set up hardware acceleration on my server running an i7-3820qm (i965 video drivers) Groups video and render are set correctly, drivers are installed on host, devices is passed via "/dev/dri/:/dev/dri/".

Hardware acceleration should be working when I turn it on in the playback section of the configuration.

Current Behavior

When I try to play a video that should be transcoded, I get the message "client is incompatible with the media, and the server does not provide a compatible format" (in French, translated...). The video does not play.

Steps to Reproduce

  1. Set up the jellyfin server with hardware acceleration configuration on a server running an i7-3820qm
  2. Try to play a video that needs decoding
  3. Get the error

Environment

OS: Debian 11 bullseye CPU architecture: x86_64, i7-3820qm How docker service was installed: From the official repo, latest version

Command used to create docker container (run/create/compose/screenshot)

docker-compose.yml:

services: jellyfin: container_name: jellyfin image: lscr.io/linuxserver/jellyfin:latest restart: unless-stopped network_mode: host environment:

  • PUID=1003
  • PGID=1003

    - LIBVA_DRIVERS_PATH="/usr/lib/jellyfin-ffmpeg/lib/dri"

    - LIBVA_DRIVER_NAME="i965"

    - TZ=Europe/Paris

    volumes:

  • /mnt/raid1/config-docker/jellyfin:/config
  • /mnt/raw1/movies:/data/movies
  • /mnt/raw2/series:/data/tvshows
  • /mnt/raw2/documentaries:/data/documentaries
  • /mnt/raid5/music/:/data/music
  • /mnt/maxard/media/:/data/maxard/ ports:
  • '8096:8096'
  • '7359:7359/udp'
  • '1900:1900/udp' devices:
  • /dev/dri/:/dev/dri/

I tried adding environment variables to specify driver path/name as shown in the docker-compose but with or without them makes no difference. I tried removing the iHD driver and replacing it with the correct driver. It is then loaded but I get an MFX error. I tried installing vainfo inside the container to check if the device is available:

root@CTM:/# vainfo error: XDG_RUNTIME_DIR not set in the environment. error: can't connect to X server! libva info: VA-API version 1.13.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_13 libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed libva info: va_openDriver() returns 1 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit

Actually there is no "i965_drv_video.so" in /usr/lib/x86_64-linux-gnu/dri/ so I copied the one from "/usr/lib/jellyfin-ffmpeg/lib/dri/". The result is:

root@CTM:/usr/lib/x86_64-linux-gnu/dri# vainfo error: XDG_RUNTIME_DIR not set in the environment. error: can't connect to X server! libva info: VA-API version 1.13.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function vaDriverInit_1_13 libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed libva info: va_openDriver() returns 1 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so has no function vaDriverInit_1_0 libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit

Seeing that I copied the driver from the host to the docker container which resulted in a correct recognition by vainfo:

root@CTM:/usr/lib/x86_64-linux-gnu/dri# vainfo error: XDG_RUNTIME_DIR not set in the environment. error: can't connect to X server! libva info: VA-API version 1.13.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_13 libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed libva info: va_openDriver() returns 1 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_1_8 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.13 (libva 2.13.0) vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.1 vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264StereoHigh : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc VAProfileJPEGBaseline : VAEntrypointVLD

If I then replace the iHD driver by the i965 driver, fmmpeg goes one step farther but raises a new error:

Stream mapping: Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> h264 (h264_qsv)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help [hevc_qsv @ 0x560fe715b600] Error querying IO surface: unsupported (-3) Error while decoding stream #0:0: Function not implemented [hevc_qsv @ 0x560fe715b600] Error initializing the MFX video decoder: invalid video parameters (-15) Error while decoding stream #0:0: Invalid argument

I think there are multiple issues:

I spent a considerable time researching this issue but to no solution...

Docker logs

[01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for vsalvator. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, Path: /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv, isEligibleForDirectPlay: True, isEligibleForDirectStream: True [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, No video direct play profiles found for /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv with codec hevc [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, Path: /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv, isEligibleForDirectPlay: True, isEligibleForDirectStream: True [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, No video direct play profiles found for /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv with codec hevc [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, Path: /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv, isEligibleForDirectPlay: True, isEligibleForDirectStream: True [01:13:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: Profile: Unknown Profile, No video direct play profiles found for /data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv with codec hevc [01:13:42] [INF] [32] Jellyfin.Api.Controllers.DynamicHlsController: Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request [01:13:42] [INF] [32] Jellyfin.Api.Helpers.TranscodingJobHelper: /usr/lib/jellyfin-ffmpeg/ffmpeg -c:v hevc_qsv -hwaccel qsv -i file:"/data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -preset 7 -look_ahead 0 -b:v 5198333 -maxrate 5198333 -bufsize 10396666 -profile:v:0 high -level 41 -g:v:0 72 -keyint_min:v:0 72 -sc_threshold:v:0 0 -vf "vpp_qsv=format=nv12" -start_at_zero -vsync -1 -codec:a:0 aac -ac 6 -ab 640000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/data/transcodes/1301378ac4711c874bbcc1b0d1f39c6f%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcodes/1301378ac4711c874bbcc1b0d1f39c6f.m3u8" [01:13:46] [ERR] [81] Jellyfin.Api.Helpers.TranscodingJobHelper: FFmpeg exited with code 1 [01:13:46] [WRN] [81] Jellyfin.Api.Controllers.DynamicHlsController: cannot serve /config/data/transcodes/1301378ac4711c874bbcc1b0d1f39c6f0.ts as transcoding quit before we got there [01:13:46] [ERR] [81] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request: Could not find file '/config/data/transcodes/1301378ac4711c874bbcc1b0d1f39c6f0.ts'. URL GET /videos/968d7292-b409-3c45-6b75-5da80d90e0f2/hls1/main/0.ts.

ffmpeg logs:

/usr/lib/jellyfin-ffmpeg/ffmpeg -c:v hevc_qsv -hwaccel qsv -i file:"/data/movies/The Dark Knight (2008)/[zza]The.Dark.Knight.2008.1080p.x265.AC3.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -preset 7 -look_ahead 0 -b:v 5198333 -maxrate 5198333 -bufsize 10396666 -profile:v:0 high -level 41 -g:v:0 72 -keyint_min:v:0 72 -sc_threshold:v:0 0 -vf "vpp_qsv=format=nv12" -start_at_zero -vsync -1 -codec:a:0 aac -ac 6 -ab 640000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/data/transcodes/ee5370d5def51d5a8b9f6834e374f968%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcodes/ee5370d5def51d5a8b9f6834e374f968.m3u8"

ffmpeg version 4.4.1-Jellyfin Copyright (c) 2000-2021 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04) configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --arch=amd64 --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-vdpau --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 [extract_extradata @ 0x55d09928db40] Invalid NAL unit 0, skipping. [hevc @ 0x55d09926f5c0] Invalid NAL unit 0, skipping. [hevc @ 0x55d09926f5c0] PPS id out of range: 47 [hevc @ 0x55d09926f5c0] Error parsing NAL unit #1. [matroska,webm @ 0x55d099240780] decoding for stream 5 failed [matroska,webm @ 0x55d099240780] Could not find codec parameters for stream 5 (Video: hevc, none): unspecified size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". Last message repeated 1 times ... [AVHWDeviceContext @ 0x55d0992a4740] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed [AVHWDeviceContext @ 0x55d0992a4740] Failed to initialise VAAPI connection: 1 (operation failed). Device creation failed: -5. [hevc_qsv @ 0x55d099280600] No device available for decoder: device type qsv needed for codec hevc_qsv. Stream mapping: Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> h264 (h264_qsv)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Device setup failed for decoder on input stream #0:0 : Input/output error

github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j0nnymoe commented 2 years ago

Should've been fixed by #136