Jellyfin Forum
Hardware acceleration not working on Debian 12 through Docker - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Hardware acceleration not working on Debian 12 through Docker (/t-hardware-acceleration-not-working-on-debian-12-through-docker)



Hardware acceleration not working on Debian 12 through Docker - trustedtomato - 2025-01-24

First of all, thank you for the amazing software, it's amazing that I can watch my movies remotely in sync with my gfSmiling-face
However, for my TV which uses webOS, I need transcoding, but hardware acceleration (VA-API, since I'm using Intel 3rd Gen Core) doesn't seem to work for me. On the host machine, vainfo works:
Code:
error: can't connect to X server!
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
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.17 (libva 2.12.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

However, when I try to execute sudo docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo, I get libva error: /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so init failed:
Code:
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva error: /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.0.pre1 ()
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

I added the render, video, and input groups to the Docker process, I also mapped renderD128 and card0. Here's my compose.yml file:
Code:
name: jellyfin
services:
  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    user: $DOCKER_USER
    group_add: # by id as these may not exist within the container. Needed to provide permissions to the VAAPI Devices
      - $GROUP_ID_RENDER #render
      - $GROUP_ID_VIDEO #video
      - $GROUP_ID_INPUT #video
      - $GROUP_ID_AUDIO #video
    network_mode: 'host'
    volumes:
      - ./config:/config
      - ./cache:/cache
      - type: bind
        source: ../filebrowser/content/public
        target: /media
      # Optional - extra fonts to be used during transcoding with subtitle burn-in
      - type: bind
        source: /usr/share/fonts
        target: /usr/local/share/fonts/custom
        read_only: true
    restart: 'unless-stopped'
    devices:
      # VAAPI Devices
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/dri/card0:/dev/dri/card0
    # Optional - alternative address used for autodiscovery
    environment:
      - PUID=$DOCKER_UID
      - PGID=$DOCKER_GID
      - JELLYFIN_PublishedServerUrl=https://jellyfin.tamashalasi.com
    # Optional - may be necessary for docker healthcheck to pass if running in host network mode
    extra_hosts:
      - 'host.docker.internal:host-gateway'

Check OpenCL runtime status with docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va -init_hw_device opencl@va returns:
Code:
[AVHWDeviceContext @ 0x561e01f77640] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x561e01f77640] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x561e01f77640] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x561e01f77640] libva: Found init function __vaDriverInit_1_22
[AVHWDeviceContext @ 0x561e01f77640] libva: /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so init failed
[AVHWDeviceContext @ 0x561e01f77640] libva: va_openDriver() returns 1
[AVHWDeviceContext @ 0x561e01f77640] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x561e01f77640] libva: Found init function __vaDriverInit_1_22
[AVHWDeviceContext @ 0x561e01f77640] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x561e01f77640] Initialised VAAPI connection: version 1.22
[AVHWDeviceContext @ 0x561e01f77640] VAAPI driver: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.0.pre1 ().
[AVHWDeviceContext @ 0x561e01f77640] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x561e01fb36c0] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl@va' for option 'init_hw_device': No such device
Error parsing global options: No such device

What could be going wrong? Let me know if I should provide more details.


RE: Hardware acceleration not working on Debian 12 through Docker - TheDreadPirate - 2025-01-24

Because of the older architecture, it is falling back to the i965 driver instead of the modern iHD driver. But it does work from that perspective, as you can see from the output at the end with the codec support.

Also because of the older architecture, OpenCL support is not available. But that is only needed for HDR to SDR tone mapping. Your CPU doesn't have HEVC codec support anyway for that to work.

From what you've shared, as long as you checked the correct boxes in Dashboard > Playback > Transcoding, plain SDR to SDR transcoding should work.

https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding

Check VC1, MPEG2, H264 for decoding.


RE: Hardware acceleration not working on Debian 12 through Docker - trustedtomato - 2025-01-24

Something is definitely off, and it has to do with transcoding and ffmpeg. When I check the docker logs, this error repeats multiple times there, and the videos are unable to start:
Code:
jellyfin  | [19:42:30] [INF] [40] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -f matroska -init_hw_device vaapi=va:/dev/dri/renderD128,driver=i965 -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -i file:"/media/videos/movies/The.Northman.2022.Hybrid.720p.BluRay.DD5.1.x264.HUN-PTHD/The.Northman.2022.Hybrid.720p.BluRay.DD5.1.x264.HUN-PTHD.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:2 -map -0:s -codec:v:0 hevc_vaapi -tag:v:0 hvc1 -rc_mode CBR -b:v 7360000 -maxrate 7360000 -bufsize 14720000 -profile:v:0 main -level 150 -sei -a53_cc -force_key_frames:0 "expr:gte(t,n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=format=nv12:extra_hw_frames=24" -codec:a:0 copy -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 "/cache/transcodes/d668933db40d54dd4222a79876385bfd%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/cache/transcodes/d668933db40d54dd4222a79876385bfd.m3u8"
jellyfin  | [19:42:30] [ERR] [46] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: FFmpeg exited with code 218
jellyfin  | [19:42:30] [ERR] [46] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL GET /videos/e5e8e1ca-ac69-416b-1e8a-64d79b614651/hls1/main/0.ts.
jellyfin  | MediaBrowser.Common.FfmpegException: FFmpeg exited with code 218
jellyfin  |    at MediaBrowser.MediaEncoding.Transcoding.TranscodeManager.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, Guid userId, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory)
jellyfin  |    at Jellyfin.Api.Controllers.DynamicHlsController.GetDynamicSegment(StreamingRequestDto streamingRequest, Int32 segmentId)
jellyfin  |    at Jellyfin.Api.Controllers.DynamicHlsController.GetHlsVideoSegment(Guid itemId, String playlistId, Int32 segmentId, String container, Int64 runtimeTicks, Int64 actualSegmentLengthTicks, Nullable`1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable`1 segmentLength, Nullable`1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable`1 enableAutoStreamCopy, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, Nullable`1 breakOnNonKeyFrames, Nullable`1 audioSampleRate, Nullable`1 maxAudioBitDepth, Nullable`1 audioBitRate, Nullable`1 audioChannels, Nullable`1 maxAudioChannels, String profile, String level, Nullable`1 framerate, Nullable`1 maxFramerate, Nullable`1 copyTimestamps, Nullable`1 startTimeTicks, Nullable`1 width, Nullable`1 height, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 videoBitRate, Nullable`1 subtitleStreamIndex, Nullable`1 subtitleMethod, Nullable`1 maxRefFrames, Nullable`1 maxVideoBitDepth, Nullable`1 requireAvc, Nullable`1 deInterlace, Nullable`1 requireNonAnamorphic, Nullable`1 transcodingMaxAudioChannels, Nullable`1 cpuCoreLimit, String liveStreamId, Nullable`1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable`1 audioStreamIndex, Nullable`1 videoStreamIndex, Nullable`1 context, Dictionary`2 streamOptions, Boolean enableAudioVbrEncoding, Boolean alwaysBurnInSubtitleWhenTranscoding)
jellyfin  |    at lambda_method1296(Closure, Object)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
jellyfin  |    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
jellyfin  |    at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
jellyfin  |    at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
jellyfin  |    at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
jellyfin  |    at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
jellyfin  |    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
jellyfin  |    at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
jellyfin  |    at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
jellyfin  |    at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
jellyfin  |    at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
jellyfin  |    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
jellyfin  |    at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
jellyfin  |    at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
jellyfin  |    at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
jellyfin  |    at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
jellyfin  |    at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

Here's a screenshot of Dashboard > Playback > Transcoding: https://pasteboard.co/EXnWz12hQKWT.png
The issue occurs when I turn on hardware acceleration.


RE: Hardware acceleration not working on Debian 12 through Docker - TheDreadPirate - 2025-01-24

You enabled HEVC encoding. Your CPU does not support HEVC decoding or encoding. Uncheck "allow encoding in HEVC format".

Also, that link doesn't work. No image found.


RE: Hardware acceleration not working on Debian 12 through Docker - trustedtomato - 2025-01-25

Hmm the image does work for me. But you are right! I did disable HEVC in "Enable hardware decoding for", but not in "Encoding format options". Silly thing! It turns out, it was stuttering because it was transcoding the movie and my laptop was suffering haha. Weak guy. Anyway, now everything works! Thanks for the help 😊