Jellyfin transcoding and tone mapping efficiency improvements: enable processor low voltage mode (GuC/HuC)

Jellyfin transcoding and tone mapping efficiency improvements

  • System environment
  • Pull the nyanmisaka/jellyfin image
  • Turn on low voltage mode
  • Jellyfin configuration
    • Enable QSV and low voltage mode decoding
    • Turn on tone mapping (based on OpenCL)
  • Actual measurement
    • Verify low voltage mode
    • Actual measurement of transcoding frame rate
      • Test video overview
      • Version 221029 vs Version 230901
      • Turn on the effects of tone mapping
      • Turn on low voltage mode
  • Summarize

System environment

  1. Operating system: Ubuntu 20.04, kernel version 5.4.0-165-generic
  2. Hardware: industrial control board
  3. CPU: J4105,1.5GHz, UHD600 core display
  4. Jellyfin: Mirror nyanmisaka/jellyfin:230901-amd64

This article verifies whether the J4105 hardware platform can smoothly play 4K/HDR videos (turn on tone mapping from HDR to SDR). To this end, we deploy the latest nyanmisaka version of jellyfin, turn on QSV hardware decoding and low-voltage mode, and maximize the performance of the core display.
The focus of this article is to load the GuC/HuC firmware so that Jellyfin can turn on low-voltage mode. Then, through actual testing, it was verified whether turning on the low-voltage mode would improve the transcoding efficiency.

The minimum configuration for transcoding 4K HDR HEVC, VP9 10bit video is the J4005 similar processor codenamed GeminiLake, the UHD 600/605.
– by nyanmisaka

Pull the nyanmisaka/jellyfin image

The N large version of jellyfin is an out-of-the-box Docker image, including the latest drivers, jellyfin-ffmpeg, patches, CJK system fonts, etc. QSV hardware decoding and OpenCL-based tone mapping have been upgraded, improving transcoding efficiency.
Due to some well-known network issues, downloading this image is still a bit difficult. I didn’t have a scientific method, I tried deadlifting for several days and finally managed to pull it off. It is said that after turning off domestic image acceleration, you can use latest to pull the latest image. I have not tried this.
Note: A tag must be specified to pull the image, and the latest tag cannot be used

sudo docker pull nyanmisaka/jellyfin:230901-amd64


The Jellyfin version corresponding to nyanmisaka/jellyfin:23091-amd64 is 10.8.10.

Entering the container, you can see that the ffmpeg version is 6.0, which is the latest stable version. The previous ffmpeg version in the 221029-amd64 image was 5.1.2.

Enable low voltage mode

Low-voltage mode requires the operating system to load two firmwares, GuC/HuC. GuC is related to the scheduling of the core display load. HuC can let the GPU complete some work, reducing the synchronization between the CPU and the GPU. The above is Intel’s official explanation. Personally, I think that turning on Low Power Mode (LP Mode) is related to the CPU hardware and Linux kernel version. There may be problems with kernel versions that are too old.

Jellyfin official has a description of low voltage mode:

The setup is not necessary unless you are using an Intel Jasper Lake or Elkhart Lake processor, or you want faster OpenCL tone-mapping speed on Linux. This also applies to the bleeding edge hardware such as 12th Gen Intel processors, ARC GPU and newer but step 2 should be skipped.

Officials pointed out that this setting is not necessary. It is also mentioned that after turning on the low voltage mode, the efficiency of tone mapping will be improved to a certain extent. In addition, if the CPU is N5105, it also needs to be configured in low-voltage mode, otherwise Jellyfin’s hardware acceleration will not work properly.
Personally, I think that if the CPU performance is sufficient, there is no need to configure low-voltage mode, because whether the configuration is smooth has a certain relationship with the operating system, Linux kernel, and CPU. The latest version of Nyanmisaka’s special version Jellyfin has already been used without turning on low-voltage mode. Basically enough. However, my J4105 is a bit weak, so I hope to improve the hardware transcoding efficiency by turning on low voltage.
Please refer to Jellyfin’s official guidelines for the following operations:

1.Install firmware

#Install firmware
sudo apt update & amp; & amp; sudo apt install -y linux-firmware

2. Write the GuC settings into the configuration file i915.conf

# enable_guc=2
sudo sh -c "echo 'options i915 enable_guc=2' >> /etc/modprobe.d/i915.conf"

3. Update initramfs and grub

sudo update-initramfs -u
sudo update-grub



4. Restart and verify

reboot
#GuC status
sudo cat /sys/kernel/debug/dri/0/i915_guc_load_status
# HuC status
sudo cat /sys/kernel/debug/dri/0/i915_huc_load_status

If you see that the output status is RUNNING, it means the startup is successful.

Jellyfin configuration

Enable QSV and low voltage mode decoding

Under Jellyfin’s console->Playback page, select “Intel QuickSync (QSV)” for hardware acceleration and check the two options of “Enable low voltage mode”.

Enable tone mapping (based on OpenCL)

Turn on tone mapping to convert HDR to SDR. Tone mapping will occupy part of the core graphics performance, so the transcoding efficiency will be reduced after it is turned on. Turn on tone mapping and playback HDR videos on a display that does not support HDR without graying out the picture.
Select “Enable Tone Mapping” in Jellyfin, I selected the Mobius algorithm, and the parameters are default. Due to efficiency issues, it is not recommended to use VPP tone mapping, so do not check “Enable VPP tone mapping” above.

Actual measurement

Verify low voltage mode

Jellyfin plays 4K H265 video and uses the intel_gpu_top command to check the working status of the core display (if the command does not exist, install sudo apt install intel-gpu-tools). When the low voltage mode is not turned on, the Render load is always above 90%; after the low voltage mode is turned on, the Render load decreases and remains at about 60~70%.

Actual measurement of transcoding frame rate

Test video overview

Test the transcoding efficiency of nyanmisaka/jellyfin:230901 on four videos, compare it with nyanmisaka/jellyfin:221029, and record the transcoding frame rate before and after turning on low voltage mode (LP Mode) to verify the impact of low voltage mode on transcoding efficiency. promote.
The first three test video formats are as follows, all are 4K/HDR/H265, with average code rates, and the fourth one has higher high code rates. These four videos are still a bit difficult for my hardware platform.

221029 version vs 230901 version

Compared with last year’s version 221029, the latest version 230901 has improved transcoding efficiency on three of the videos. Taking “FAST10” as an example, with tone mapping turned on, it increased from 25fps to 37fps. For high bitrates, the transcoding frame rates of the two versions are the same.

The impact of turning on tone mapping

According to actual measurements, turning on tone mapping (Mobius) has a greater impact on the transcoding frame rate. Taking “PI” as an example, it dropped directly from 36fps to 25fps. Therefore, tone mapping still consumes core graphics performance, at least for this J4105.

Enable low voltage mode

For all four videos, after turning on low-voltage mode (loading GuC/HuC), the transcoding efficiency has improved. Taking “FAST” as an example, after turning it on, the transcoding frame rate does increase. When low-voltage mode is turned on, the CPU load is also reduced. It is 40-50% when it is turned on and 50%-55% when it is not turned on.


For the high-bitrate video “Transformers”, when LP mode is not turned on, the transcoding frame rate is < video frame rate. When LP mode is turned on, it can barely play smoothly.

The following is a summary of the experimental data: the measured transcoding frame rate data of the two versions nyanmisaka/jellyfin of 221029 and 230901 are recorded when tone mapping is turned on. The last two columns also compare the transcoding frames when the low voltage mode is not turned on and when it is turned on. Rate. Generally speaking, it is quite difficult for this hardware to play 4K/HDR, and the transcoding frame rate is relatively low.
(In order to ensure that the data is relatively accurate, each video is recorded at the same time point, and the transcoding frame rate has stabilized after playing for a period of time)

Summary

In the software and hardware environment used in this article:

  1. Turn on the low-voltage mode of the core display (load GuC/HuC), which improves transcoding efficiency;
  2. After using the latest version of the nyanmisaka/jellyfin image, the J4105 hardware platform can basically achieve smooth hardware transcoding for 4K/HDR videos with general bit rates (below 30Mbps), including tone mapping (although the transcoding frame rate is not high); for high-code To play 4K/HDR videos, you need to turn on the low voltage mode, otherwise it will not play smoothly.