Jellyfin Forum
Hardware Transcoding - 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 Transcoding (/t-hardware-transcoding--6971)

Pages: 1 2


Hardware Transcoding - taliaferro - 2024-07-14

Good morning folks,

I've been setting up a Jellyfin instance with a new Arc A310, and I'm having a hard time getting hardware transcoding with QSV to work.

Relevant specs:
Distro: Debian 12.6
Kernel: 6.7.12+bpo-amd64 (from bookworm-backports)
Jellyfin version: 10.9.7+deb12

When I attempt to stream a video with QSV hardware acceleration enabled, I see the following error:

[av1_qsv @ 0x55916eda0040] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x55916edd8880] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


I'm not sure what to make of this -- I don't think the parameters Jellyfin is setting are unreasonable but it's a little hard to say. The command it's running is as follows (each argument on a separate line for legibility):

/usr/lib/jellyfin-ffmpeg/ffmpeg 
-analyzeduration 200M
-probesize 1G 
-init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD 
-init_hw_device qsv=qs@va -filter_hw_device qs
-noautorotate 
-i file:"<PATH TO MEDIA FILE>" 
-map_metadata -1
-map_chapters -1
-threads 0 
-map 0:0 
-map 0:1 
-map -0:s 
-codec:v:0 av1_qsv 
-preset veryfast
 -b:v 82837679 
-maxrate 82837679 
-bufsize 165675358 
-g:v:0 72 
-keyint_min:v:0 72 
-vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(3840\,2160*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(3840/a\,2160))/2)*2,format=nv12" 
-codec:a:0 libfdk_aac -ac 2 -ab 256000 
-copyts 
-avoid_negative_ts disabled
-max_muxing_queue_size 2048 
-f hls 
-max_delay 5000000 
-hls_time 3
-hls_segment_type fmp4 
-hls_fmp4_init_filename "ea4d0fcba96661f502a4f54f1d3a426e-1.mp4" 
-start_number 0 
-hls_segment_filename "/var/cache/jellyfin/transcodes/ea4d0fcba96661f502a4f54f1d3a426e%d.mp4" 
-hls_playlist_type vod 
-hls_list_size 0 -y "/var/cache/jellyfin/transcodes/ea4d0fcba96661f502a4f54f1d3a426e.m3u8"


What troubleshooting steps would you recommend I try?


RE: Hardware Transcoding - Host-in-the-Shell - 2024-07-14

To quote the documentation, "[..] the LTS kernel 6.6.26+ and the stable kernel 6.8.5+ have unresolved i915 driver bugs, which break HDR/DV tone-mapping on Intel Gen 12.5 DG2 / ARC A-series GPUs." Since you're on kernel 6.7.12+bpo-amd64, unfortunately you're affected by this bug.

Start by running

Code:
ls -1 /boot/vmlinuz-*

and see if there's a previous version of the kernel you can roll back to. In case you have an older kernel without this issue like the 6.6 or 6.5 releases, you can reboot and select the older one from grub. If not, you can pull a working kernel from backports with

Code:
sudo apt -t bookworm-backports install linux-image-6.6.13+bpo-amd64

reboot, and the newly installed kernel should boot by default. If not, just select it from the grub menu.


RE: Hardware Transcoding - taliaferro - 2024-07-14

Update: the plot thickens...it seems that crash only occurs when I play it from the browser. When I use "Copy stream URL" and paste it into VLC it actually works fine (although the HDR isn't working so it looks desaturated.) What might cause that?


RE: Hardware Transcoding - taliaferro - 2024-07-14

(2024-07-14, 10:16 PM)Host-in-the-Shell Wrote:
Code:
sudo apt -t bookworm-backports install linux-image-6.6.13+bpo-amd64

reboot, and the newly installed kernel should boot by default. If not, just select it from the grub menu.

Aha! I missed your reply -- that would explain why it worked in VLC but not the web player, it probably is the tone mapping..

I've downgraded to kernel 6.6.13, but unfortunately, it still won't play in the browser. It started complaining about a missing OpenCL runtime, so I installed intel-opencl-icd. Now it still crashes due to a "fatal player error" but there's no longer any indication of why in the logs? When I run the same command, I see the following error:

Abort was called at 349 line in file:
./shared/source/os_interface/linux/drm_neo.cpp

(That appears in stderr, hence why it's not in the logs.)


Thank you again for your help -- I feel like I'm close to a solution!


RE: Hardware Transcoding - Host-in-the-Shell - 2024-07-14

Have you followed all the steps for Arc GPU support? And, have you configured HWA properly for Linux? Feels like there may be a step missing for you if you didn't already had OpenCL set up.


RE: Hardware Transcoding - TheDreadPirate - 2024-07-15

What are your full specs? Do you happen to have a CPU with an iGPU?


RE: Hardware Transcoding - taliaferro - 2024-07-16

Well, I went through the steps again and found one of the problems -- the version of intel-opencl-icd was too old and didn't work with Arc GPUs. However, I went back and installed the latest version of the Intel Compute Runtime from their GitHub as specified, but now when I run sudo /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=vaConfused-facedev/dri/renderD128 -init_hw_device opencl@va I get:

MESA: warning: Could not query local memory size.
[AVHWDeviceContext @ 0x560cc32a1d40] No matching devices found.
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


edit: the forum seems to have interpreted part of my command as an emoji? The actual command is at step 8: "Check the OpenCL runtime status".


RE: Hardware Transcoding - TheDreadPirate - 2024-07-16

Which version of jellyfin-ffmpeg is installed?

Also, do you have linux-headers package installed?


RE: Hardware Transcoding - taliaferro - 2024-07-16

With regards to my hardware:

### Guest
Debian 12.6 (virtualized in QEMU)
Kernel 6.6.13
Virtual platform: Q35
CPU cores: 4 (virtual, QEMU "host" CPU)
RAM: 8 GiB
GPU: SPARKLE Intel Arc A310 Eco

### Host
OS: Proxmox Virtual Environment 8.2.4 (community edition)
CPU: AMD Ryzen Threadripper 1950X
Motherboard: ASRock X399 Taichi
RAM: 128G DDR4-3200 ECC
Storage: 4x 2TB Crucial P3 NVMe SSDs in a ZFS RAIDZ1 array


RE: Hardware Transcoding - TheDreadPirate - 2024-07-16

Did you pass the GPU into the VM? Is there anything when you run "ls -l /dev/dri" in the VM?

Again, check if you have the linux-headers package installed.