Jellyfin Forum
Hardware Encoding Issues with TrueNas Scale Jellyfin Application - 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 Encoding Issues with TrueNas Scale Jellyfin Application (/t-hardware-encoding-issues-with-truenas-scale-jellyfin-application)



Hardware Encoding Issues with TrueNas Scale Jellyfin Application - quasar25 - 2024-09-14

Hi everyone. I'm new to Jellyfin and TrueNas Scale, so I would really appreciate any help on this issue. I have a Jellyfin container set up as a TrueNAS Scale app, and I am getting video playback errors every time it tries to encode HVEC content. I'm running the app as the TrueNAS default user ID 568.

Here is my setup:

CPU: Intel® Xeon® E-2176G CPU @ 3.70GHz
Motherboard: SuperMicro MBD-X11SCH-F-O
RAM: 32 GB of Crucial ECC UDIMM PC4-21300 DDR4 2666MHz
OS: Baremetal TrueNAS Scale Dragonfish-24.04.2
Jellyfin: Jellyfin Version 10.9.11, Charts Version 1.3.5


Here is a snippet of my FFMPEG transcode log on the Jellyfin app. This is what I get every time I've tried transcoding HVEC content.


Code:
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (hevc_qsv))
  Stream #0:1 -> #0:1 (truehd (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
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 info: va_openDriver() returns 0
[hevc_qsv @ 0x5634d3cf32c0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/hevc_qsv @ 0x5634d3cf2f80] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[libfdk_aac @ 0x5634d80cd140] 2 frames left in the queue on closing
Conversion failed!


Here is the result I get after running
Code:
sudo dmesg | grep i915


Code:
[    0.000000] Command line: BOOT_IMAGE=/ROOT/24.04.2@/boot/vmlinuz-6.6.32-production+truenas root=ZFS=boot-pool/ROOT/24.04.2 ro libata.allow_tpm=1 amd_iommu=on iommu=pt kvm_amd.npt=1 kvm_amd.avic=1 intel_iommu=on zfsforce=1 nvme_core.multipath=N i915.enable_guc=3
[    0.016140] Kernel command line: BOOT_IMAGE=/ROOT/24.04.2@/boot/vmlinuz-6.6.32-production+truenas root=ZFS=boot-pool/ROOT/24.04.2 ro libata.allow_tpm=1 amd_iommu=on iommu=pt kvm_amd.npt=1 kvm_amd.avic=1 intel_iommu=on zfsforce=1 nvme_core.multipath=N i915.enable_guc=3
[    6.951768] i915 0000:00:02.0: enabling device (0000 -> 0003)
[    6.951873] i915 0000:00:02.0: can't derive routing for PCI INT A
[    6.951880] i915 0000:00:02.0: PCI INT A: not connected
[    6.951957] i915 0000:00:02.0: [drm] GT0: Incompatible option enable_guc=3 - GuC submission is N/A
[    6.952537] i915 0000:00:02.0: [drm] VT-d active for gfx access
[    6.952628] i915 0000:00:02.0: [drm] Using Transparent Hugepages
[    6.954211] i915 0000:00:02.0: BAR 6: can't assign [??? 0x00000000 flags 0x20000000] (bogus alignment)
[    6.954476] i915 0000:00:02.0: [drm] Failed to find VBIOS tables (VBT)
[    6.958920] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[    7.359376] i915 0000:00:02.0: [drm] [ENCODER:94:DDI A/PHY A] failed to retrieve link info, disabling eDP
[    7.360049] i915 0000:00:02.0: Platform does not support port F
[    7.360276] WARNING: CPU: 3 PID: 783 at drivers/gpu/drm/i915/display/intel_display.c:7426 assert_port_valid+0x58/0x70 [i915]
[    7.360648] Modules linked in: intel_rapl_msr(E) intel_rapl_common(E) ipmi_ssif(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) coretemp(E) kvm_intel(E) kvm(E) irqbypass(E) ghash_clmulni_intel(E) sha512_ssse3(E) sha256_ssse3(E) sha1_ssse3(E) i915(E+) aesni_intel(E) crypto_simd(E) cryptd(E) drm_buddy(E) snd_pcm(E) drm_display_helper(E) rapl(E) snd_timer(E) cec(E) intel_cstate(E) snd(E) rc_core(E) ast(E) soundcore(E) ttm(E) iTCO_wdt(E) mei_me(E) drm_shmem_helper(E) acpi_ipmi(E) intel_uncore(E) intel_pmc_bxt(E) iTCO_vendor_support(E) pcspkr(E) wmi_bmof(E) watchdog(E) mei(E) ipmi_si(E) drm_kms_helper(E) ie31200_edac(E) fan(E) intel_pch_thermal(E) ipmi_devintf(E) joydev(E) ipmi_msghandler(E) intel_pmc_core(E) button(E) acpi_pad(E) acpi_power_meter(E+) acpi_tad(E) evdev(E) sg(E) loop(E) drm(E) efi_pstore(E) dm_mod(E) configfs(E) ip_tables(E) x_tables(E) autofs4(E) zfs(POE) spl(OE) efivarfs(E) raid10(E) raid456(E) async_raid6_recov(E) async_memcpy(E) async_pq(E) async_xor(E) async_tx(E) xor(E) hid_generic(E) usbhid(E) hid(E)
[    7.364764] RIP: 0010:assert_port_valid+0x58/0x70 [i915]
[    7.369448]  ? assert_port_valid+0x58/0x70 [i915]
[    7.370085]  ? assert_port_valid+0x58/0x70 [i915]
[    7.371741]  ? assert_port_valid+0x58/0x70 [i915]
[    7.372099]  ? assert_port_valid+0x58/0x70 [i915]
[    7.372456]  ? __pfx_intel_ddi_init+0x10/0x10 [i915]
[    7.372806]  intel_ddi_init+0xd0/0x1030 [i915]
[    7.373258]  ? __pfx_intel_ddi_init+0x10/0x10 [i915]
[    7.373600]  intel_bios_for_each_encoder+0x35/0x50 [i915]
[    7.373953]  intel_setup_outputs+0x380/0x8a0 [i915]
[    7.374300]  intel_display_driver_probe_nogem+0x14c/0x210 [i915]
[    7.374645]  i915_driver_probe+0x6d2/0xb90 [i915]
[    7.377144]  i915_init+0x22/0xc0 [i915]
[    7.377403]  ? __pfx_i915_init+0x10/0x10 [i915]
[    7.390088] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/kbl_guc_70.1.1.bin version 70.1.1
[    7.390268] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/kbl_huc_4.0.0.bin version 4.0.0
[    7.414282] i915 0000:00:02.0: [drm] GT0: HuC: authenticated for all workloads
[    7.414534] i915 0000:00:02.0: [drm] GT0: GUC: submission disabled
[    7.414760] i915 0000:00:02.0: [drm] GT0: GUC: SLPC disabled
[    7.423725] [drm] Initialized i915 1.6.0 20201103 for 0000:00:02.0 on minor 1
[    7.626187] i915 0000:00:02.0: [drm] Cannot find any crtc or sizes
[    7.820953] i915 0000:00:02.0: [drm] Cannot find any crtc or sizes
[    8.009100] i915 0000:00:02.0: [drm] Cannot find any crtc or sizes

The things I've tried so far are enabling the hardware encoding firmwares at boot with:

Code:
sudo midclt call system.advanced.update '{"kernel_extra_options": "i915.enable_guc=3"}'


I've tried adding the i915 kernel parameter for the GuC and HuC firmwars by adding 

Code:
options i915 enable_guc=2
to /etc/modprobe.d/i915.conf


It seems to me that Jellyfin recognizes the iGPU, as I'm able to pass it in via the container setup, but TrueNAS is having trouble loading the firmware for some reason. How should i go about troubleshooting or fixing this?


RE: Hardware Encoding Issues with TrueNas Scale Jellyfin Application - TheDreadPirate - 2024-09-15

You have to configure the app in TrueNAS to pass the GPU into the container. Even then, IIRC, a lot of users had trouble getting the TrueNAS "app" version of jellyfin to transcode correctly. Most of them switched to a docker container.


RE: Hardware Encoding Issues with TrueNas Scale Jellyfin Application - quasar25 - 2024-09-15

That's the thing though. I did pass it through. I did "Allocate 1 gpu.intel.com/i915 GPU" under GPU Resource (gpu.intel.com/i915).

This is what I get when running 
Code:
/usr/lib/jellyfin-ffmpeg/vainfo --display drm --device /dev/dri/renderD128

Code:
$ /usr/lib/jellyfin-ffmpeg/vainfo --display drm --device /dev/dri/renderD128
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 info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.2.5 (12561f6)
vainfo: Supported profile and entrypoints
      VAProfileNone                  : VAEntrypointVideoProc
      VAProfileNone                  : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main              : VAEntrypointVLD
      VAProfileH264Main              : VAEntrypointEncSlice
      VAProfileH264Main              : VAEntrypointFEI
      VAProfileH264Main              : VAEntrypointEncSliceLP
      VAProfileH264High              : VAEntrypointVLD
      VAProfileH264High              : VAEntrypointEncSlice
      VAProfileH264High              : VAEntrypointFEI
      VAProfileH264High              : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline          : VAEntrypointVLD
      VAProfileJPEGBaseline          : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain              : VAEntrypointVLD
      VAProfileHEVCMain              : VAEntrypointEncSlice
      VAProfileHEVCMain              : VAEntrypointFEI
      VAProfileHEVCMain10            : VAEntrypointVLD
      VAProfileHEVCMain10            : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

Jellyfin recognizes the iGPU, but video playback fails when trying to do HEVC encoding with QSV.


RE: Hardware Encoding Issues with TrueNas Scale Jellyfin Application - TheDreadPirate - 2024-09-15

For true NAS, don't worry about enabling the HuC and GuC firmware. They are optional for that generation of iGPU. You should also uncheck low power encoding in the transcoding settings if you have that enabled. Also optional.


RE: Hardware Encoding Issues with TrueNas Scale Jellyfin Application - quasar25 - 2024-09-15

I understand that they are optional but I would like to have it on. Jellyfin works perfectly fine with low power encoding off, but doesn't it also use more CPU power with it off? I would like to utilize my CPU's quicksync capabilities if I can.


RE: Hardware Encoding Issues with TrueNas Scale Jellyfin Application - TheDreadPirate - 2024-09-16

Low power encoding only applies to tone mapping and not general transcoding/encoding.

Additionally, it requires additional package be installed that truenas may or may not make available to you. Our documentation is here.

https://jellyfin.org/docs/general/administration/hardware-acceleration/intel/#configure-and-verify-lp-mode-on-linux