I discovered that FFMPEG transcoding with QuickSync wasn't working in Jellyfin on my TrueNAS Scale the other day. I have an Intel Silver N6005 which should support according to Intel Ark, so of course I went on a little journey to figure our what's wrong.
The articles I followed were:
Rough steps that I took to get it working
I basically started out with FFMPEG throwing this when I tried to start a stream.
No VA display found for any default device.
Device creation failed: -22.
Failed to set value 'vaapi=va:,kernel_driver=i915,driver=iHD' for option 'init_hw_device': Invalid argument
Error parsing global options: Invalid argument
This lead me to believe that the Intel iGPU wasn't getting passed to the container.
I went to the Apps settings of the Jellyfin container, and set the GPU Resources (gpu.intel.com/i915)
to Allocate 1 gpu.intel.com/i915 GPU
(from allocate 0
).
NOTE: I assume this means that 1 GPU is allocated, so if you pick Allocate 2
etc. then it isn't about the slot, but the quantity that you want to allocate. In this case, I don't really know if I can even allocate more than 1!
Now trying a new stream gave:
Selected ratecontrol mode is unsupported
some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2 frames left in the queue on closing
Conversion failed!
From the forum posts I found this handy command to ensure specific Intel i915 model. According to the Intel Ark, the Device ID is 0x4e71
, so I changed the value to 4E71
.
midclt call system.advanced.update '{"kernel_extra_options" : "i915.force_probge=4E71"}'
Next I could see GUC wasn't enabled according to
cat /sys/kernel/debug/dri/0/i915_gpu_info
So I enabled GUC using:
nano /etc/modprobe.d/i915.conf
And added the following content:
options i915 enable_guc=2
NOTE: ArchWiki has an article that explains the different enable_guc
values.
Rebooted the machine, ran the command to check the i915_gpu_info
, which now shows GUC running.
Went back to Jellyfin, and now the stream works perfectly whenever I try I stream something that tries to use h264_qsv
or similar.
Ways to debug and check status
There was a few extra things I checked like:
cat /sys/kernel/debug/dri/0/gt/uc/guc/info
and
cat /sys/kernel/debug/dri/0/gt/uc/huc/info
Would give me status: RUNNING
info - check them yourself if you are debugging this!
I can also recommend to check:
dmesg | grep i915
Just to see what it gives, here is a sample after I got it working to compare with:
i915 0000:00:02.0: [drm] VT-d active for gfx access
i915 0000:00:02.0: vgaarb: deactivate va console
i915 0000:00:02.0: [drm] Using Transparent Hugepages
i915 0000:00:02.0: vgaarb: changed VGA decodes: 01ddecodes=io+mem, decodes=io+mem: owns=io+mem
i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/icl_dmc_ver1_09.bin (v1.9)
i915 0000:00:02.0: [drm] GuC firmware i915/ehl_guc_70.1.1.bin version 70.1.1
i915 0000:00:02.0: [drm] HuC firmware i915/ehl_huc_9.0.0.bin version 9.0.0
i915 0000:00:02.0: [drm] HuC authenticated
i915 0000:00:02.0: [drm] GuC submission disabled
i915 0000:00:02.0: [drm] GuC SLPC disabled
[drm] Initialized i915 1.6.0 20201103 for 0000:00:02.0 on minor 0
snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
i915 0000:00:02.0: [drm] Cannot find any crtc or sizes
i915 0000:00:02.0: [drm] Cannot find any crtc or sizes
i915 0000:00:02.0: [drm] Cannot find any crtc or sizes