Intel Arc AV1 HW Transcoding on Linux

Hi All,

I’m running Plex Server on Ubuntu 23.10 and using the Intel Arc Drivers. Plex sees the device and in settings I tell it to use it for hardware transcoding. All my AV1 files are in MKV format. When I look at my GPU status during testing playing an AV1 file on my iPhone 15, it transcodes using my CPU instead of the Arc card. Any ideas why? When I do this same test on a x264 file and tell it to force transcode… it says it’s using HW transcoding. Any ideas why it wouldn’t be using the Arc card for transcoding AV1 files when needed? Thanks!

I did get this working a few months ago using the out of tree kernel. But now I’m using the latest kernel in Ubuntu 23.10. Anybody get HW transcoding working with the A380 on Ubunutu? - Plex Media Server - Plex Forum

Best to use LTS Desktop builds. 23.10 is a shortlife experimental.

I have two machines with 22.04.4LTS. 6.5 kernel. A310 low profiles. AV1 works good.

I literally just upgraded it to 23.10 this morning because it stopped working for me in 22.04 and I was thinking 23.10 would fix it :confused: Can you let me know what driver you are using? Did you just use the one from Ubuntu or did you follow the driver install here? 3.1. Overview — Intel® software for general purpose GPU capabilities documentation

If you installed with the Intel directions, did you also install the optional stuff or just up to 3.1.3? Thank you for responding!

AFAIK you need Intel’s drivers as you linked.
The 3.1.2 repository and the first snippet out of 3.1.3 is my understanding all that is necessary. But I also do 3.1.4 for ■■■■■ and giggles.

:~$ sudo apt update
...snip...                                                                    
Hit:11 https://repositories.intel.com/gpu/ubuntu jammy InRelease                                                                        
...snip...
:~$ sudo apt install -y \
  intel-opencl-icd intel-level-zero-gpu level-zero \
  intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \
  libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
  libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
  mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
clinfo is already the newest version (3.0.21.02.21-1).
hwinfo is already the newest version (21.72-1).
intel-level-zero-gpu is already the newest version (1.3.28202.51-821~22.04).
intel-media-va-driver-non-free is already the newest version (23.4.3-804~22.04).
intel-opencl-icd is already the newest version (23.52.28202.51-821~22.04).
level-zero is already the newest version (1.16.14-821~22.04).
libegl-mesa0 is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libegl1-mesa is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libegl1-mesa-dev is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libgbm1 is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libgl1-mesa-dev is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libgl1-mesa-dri is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libglapi-mesa is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libgles2-mesa-dev is already the newest version (24.0.0.20231114.1-2088~22.04).
libglx-mesa0 is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
libigdgmm12 is already the newest version (22.3.16-804~22.04).
libmfx1 is already the newest version (23.2.2-799~22.04).
libmfxgen1 is already the newest version (23.4.3-799~22.04).
libvpl2 is already the newest version (2023.4.0.0-799~22.04).
libxatracker2 is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
mesa-va-drivers is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
mesa-vdpau-drivers is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
mesa-vulkan-drivers is already the newest version (24.1.0-devel.dg2-20240118-2102~22.04).
va-driver-all is already the newest version (2.20.0.2-76~u22.04).
vainfo is already the newest version (2.20.1.2-1~u22.04).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.


vainfo should clearly show AV1 support:

:~$ vainfo
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.4.3 ()
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSliceLP
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSliceLP
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSliceLP
VAProfileVP9Profile1 : VAEntrypointVLD
VAProfileVP9Profile1 : VAEntrypointEncSliceLP
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointEncSliceLP
VAProfileVP9Profile3 : VAEntrypointVLD
VAProfileVP9Profile3 : VAEntrypointEncSliceLP
VAProfileHEVCMain12 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain422_12 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10 : VAEntrypointVLD
VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_12 : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointEncSliceLP
VAProfileHEVCSccMain10 : VAEntrypointVLD
VAProfileHEVCSccMain10 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444 : VAEntrypointVLD
VAProfileHEVCSccMain444 : VAEntrypointEncSliceLP
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP

Yup, says it’s supported, still uses CPU for AV1 video transcoding.

Video
1080p HDR10 (AV1)
1080P (H264)—Transcode

Audio
English (OPUS 7.1)
Direct Stream

libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.4.3 ()
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSliceLP
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSliceLP
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSliceLP
VAProfileVP9Profile1 : VAEntrypointVLD
VAProfileVP9Profile1 : VAEntrypointEncSliceLP
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointEncSliceLP
VAProfileVP9Profile3 : VAEntrypointVLD
VAProfileVP9Profile3 : VAEntrypointEncSliceLP
VAProfileHEVCMain12 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain422_12 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10 : VAEntrypointVLD
VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_12 : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointEncSliceLP
VAProfileHEVCSccMain10 : VAEntrypointVLD
VAProfileHEVCSccMain10 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444 : VAEntrypointVLD
VAProfileHEVCSccMain444 : VAEntrypointEncSliceLP
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP

Here’s a non-HDR file, also transcoding with CPU
Plex for iOS — iPhone
Playing—0:27 / 2:43:23
Local (192.168.1.194)—10 Gbps

Video
1080p (AV1)
1080P (H264)—Transcode

Audio
English (AAC Stereo)
Direct Stream

Confirm there are no image-based subtitles in the video stream.
If image-based (PGS, vobsub, or dvdrip) exist in the file, HW will be suppressed.

Just checked both movies.

HDR Movie
2 MKV’s
X264 - contains PGS
AV1 - no image subs

Non-HDR
AV1 - no subs in file at all

you can do 4k hdr.

That’s good to know thanks, still wondering why it’s transcoding using CPU though and not my Arc card :confused: Anything else I could try?

Did that sample file do any different? I added it as a ‘tested’ good, there can be minutiea in multiplexing and formatting.

I did the sample file and it still transcoded it with my CPU. I also saw that there was a new Server update so I went ahead and installed it. Check this out, it’s not even seeing my card! Ugh! So frustrating

PlexMediaServer install: PlexMediaServer-1.40.2.8395-c67dce28e - Installation starting.
PlexMediaServer install:
PlexMediaServer install: Now installing based on:
PlexMediaServer install: Installation Type: Update
PlexMediaServer install: Process Control: systemd
PlexMediaServer install: Plex User: plex
PlexMediaServer install: Plex Group: plex
PlexMediaServer install: Video Group: render
PlexMediaServer install: Metadata Dir: /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install: Temp Directory: /mnt/4tb/transcode (set in Preferences.xml)
PlexMediaServer install: Lang Encoding: en_US.UTF-8
PlexMediaServer install: Processor: AMD Ryzen 7 5800X 8-Core Processor
PlexMediaServer install: Intel i915 Hardware: Not found
PlexMediaServer install: Nvidia GPU card: Not Found

But running this command shows the driver is being used?
lspci -k | grep -EA3 ‘VGA|3D|Display’
0b:00.0 VGA compatible controller: Intel Corporation DG2 [Arc A380] (rev 05)
Subsystem: ASRock Incorporation DG2 [Arc A380]
Kernel driver in use: i915
Kernel modules: i915, xe

Dont know, but indicator should be apparent in web UI:

Not installed via snap I hope?

Nope, not installed with snap and it does show up in the hardware transcoding device like yours does in your picture.

It’s probably time to look at some server logs; before reproducing the problem and collecting the logs, please ensure Debug logging is enabled and Verbose logging is disabled in the server’s general settings: Settings → [Server Name} → General → Show Advanced.

Also, it would be interesting to see the output of this command; it will display all kernel messages from the i915 and xe modules.
sudo dmesg | egrep -i "(\s+i915\s+|\s+xe\s+)"

In particular, I’m curious if the GuC and HuC firmware is being loaded properly, which is required for proper operation of low power encoding bitrate control (see Known Issues and Limitations on the Intel Media Driver GitHub page).

You can also try this command to find what the transcoder finds for RC modes supported by the driver (assumes the Plex data folder is in the default location):
egrep "(CBR|VBR)" /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Logs/Plex\ Media\ Server*

It should output something similar to the following:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.2.log:Apr 16, 2024 18:40:01.016 [126959644322616] DEBUG - [Req#120a/Transcode] [FFMPEG] - Driver supports RC modes CQP, CBR, VBR, QVBR.

Thanks for replying, I also have a message on the Intel forums to help me make sure it’s loading it correctly. No responses yet. Here’s my output

sudo dmesg | egrep -i “(\s+i915\s+|\s+xe\s+)”
[ 3.465795] i915 0000:0b:00.0: [drm] VT-d active for gfx access
[ 3.482697] i915 0000:0b:00.0: vgaarb: deactivate vga console
[ 3.483077] i915 0000:0b:00.0: [drm] Local memory IO size: 0x000000017c800000
[ 3.483082] i915 0000:0b:00.0: [drm] Local memory available: 0x000000017c8000 00
[ 3.500219] i915 0000:0b:00.0: vgaarb: VGA decodes changed: olddecodes=io+mem ,decodes=io+mem:owns=none
[ 3.503476] i915 0000:0b:00.0: [drm] Finished loading DMC firmware i915/dg2_d mc_ver2_08.bin (v2.8)
[ 3.504862] i915 0000:0b:00.0: [drm] GT0: GuC firmware i915/dg2_guc_70.bin (7 0.12.1) is recommended, but only i915/dg2_guc_70.bin (70.8.0) was found
[ 3.504870] i915 0000:0b:00.0: [drm] GT0: Consider updating your linux-firmwa re pkg or downloading from Kernel.org git repositories are/linux-firmware.git/tree/i915
[ 3.510281] i915 0000:0b:00.0: [drm] GT0: GuC firmware i915/dg2_guc_70.bin ve rsion 70.8.0
[ 3.510288] i915 0000:0b:00.0: [drm] GT0: HuC firmware i915/dg2_huc_gsc.bin v ersion 7.10.3
[ 3.521745] i915 0000:0b:00.0: [drm] GT0: GUC: submission enabled
[ 3.521752] i915 0000:0b:00.0: [drm] GT0: GUC: SLPC enabled
[ 3.522012] i915 0000:0b:00.0: [drm] GT0: GUC: RC enabled
[ 3.554962] [drm] Initialized i915 1.6.0 20230929 for 0000:0b:00.0 on minor 1
[ 3.556135] i915 display info: display version: 13
[ 3.556137] i915 display info: cursor_needs_physical: no
[ 3.556139] i915 display info: has_cdclk_crawl: no
[ 3.556140] i915 display info: has_cdclk_squash: yes
[ 3.556141] i915 display info: has_ddi: yes
[ 3.556142] i915 display info: has_dp_mst: yes
[ 3.556143] i915 display info: has_dsb: yes
[ 3.556144] i915 display info: has_fpga_dbg: yes
[ 3.556146] i915 display info: has_gmch: no
[ 3.556147] i915 display info: has_hotplug: yes
[ 3.556148] i915 display info: has_hti: no
[ 3.556149] i915 display info: has_ipc: yes
[ 3.556150] i915 display info: has_overlay: no
[ 3.556151] i915 display info: has_psr: yes
[ 3.556152] i915 display info: has_psr_hw_tracking: no
[ 3.556153] i915 display info: overlay_needs_physical: no
[ 3.556154] i915 display info: supports_tv: no
[ 3.556155] i915 display info: has_hdcp: yes
[ 3.556156] i915 display info: has_dmc: yes
[ 3.556157] i915 display info: has_dsc: yes
[ 3.655523] i915 0000:0b:00.0: [drm] fb0: i915drmfb frame buffer device
[ 6.142414] i915 0000:0b:00.0: [drm] GT0: HuC: authenticated for all workload s
tom@ubuntu:~$ sudo dmesg | egrep -i “(\s+i915\s+|\s+xe\s+)”
[ 3.465795] i915 0000:0b:00.0: [drm] VT-d active for gfx access
[ 3.482697] i915 0000:0b:00.0: vgaarb: deactivate vga console
[ 3.483077] i915 0000:0b:00.0: [drm] Local memory IO size: 0x000000017c800000
[ 3.483082] i915 0000:0b:00.0: [drm] Local memory available: 0x000000017c800000
[ 3.500219] i915 0000:0b:00.0: vgaarb: VGA decodes changed: olddecodes=io+mem,decodes=io+mem:owns=none
[ 3.503476] i915 0000:0b:00.0: [drm] Finished loading DMC firmware i915/dg2_dmc_ver2_08.bin (v2.8)
[ 3.504862] i915 0000:0b:00.0: [drm] GT0: GuC firmware i915/dg2_guc_70.bin (70.12.1) is recommended, but only i915/dg2_guc_70.bin (70.8.0) was found
[ 3.504870] i915 0000:0b:00.0: [drm] GT0: Consider updating your linux-firmware pkg or downloading from i915 - kernel/git/firmware/linux-firmware.git - Repository of firmware blobs for use with the Linux kernel
[ 3.510281] i915 0000:0b:00.0: [drm] GT0: GuC firmware i915/dg2_guc_70.bin version 70.8.0
[ 3.510288] i915 0000:0b:00.0: [drm] GT0: HuC firmware i915/dg2_huc_gsc.bin version 7.10.3
[ 3.521745] i915 0000:0b:00.0: [drm] GT0: GUC: submission enabled
[ 3.521752] i915 0000:0b:00.0: [drm] GT0: GUC: SLPC enabled
[ 3.522012] i915 0000:0b:00.0: [drm] GT0: GUC: RC enabled
[ 3.554962] [drm] Initialized i915 1.6.0 20230929 for 0000:0b:00.0 on minor 1
[ 3.556135] i915 display info: display version: 13
[ 3.556137] i915 display info: cursor_needs_physical: no
[ 3.556139] i915 display info: has_cdclk_crawl: no
[ 3.556140] i915 display info: has_cdclk_squash: yes
[ 3.556141] i915 display info: has_ddi: yes
[ 3.556142] i915 display info: has_dp_mst: yes
[ 3.556143] i915 display info: has_dsb: yes
[ 3.556144] i915 display info: has_fpga_dbg: yes
[ 3.556146] i915 display info: has_gmch: no
[ 3.556147] i915 display info: has_hotplug: yes
[ 3.556148] i915 display info: has_hti: no
[ 3.556149] i915 display info: has_ipc: yes
[ 3.556150] i915 display info: has_overlay: no
[ 3.556151] i915 display info: has_psr: yes
[ 3.556152] i915 display info: has_psr_hw_tracking: no
[ 3.556153] i915 display info: overlay_needs_physical: no
[ 3.556154] i915 display info: supports_tv: no
[ 3.556155] i915 display info: has_hdcp: yes
[ 3.556156] i915 display info: has_dmc: yes
[ 3.556157] i915 display info: has_dsc: yes
[ 3.655523] i915 0000:0b:00.0: [drm] fb0: i915drmfb frame buffer device
[ 6.142414] i915 0000:0b:00.0: [drm] GT0: HuC: authenticated for all workloads

egrep “(CBR|VBR)” /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Logs/Plex\ Media\ Server*
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.1.log:Apr 19, 2024 19:00:36.815 [124217070725944] DEBUG - [Req#169/Transcode] [FFMPEG] - Driver supports RC modes CQP, CBR, VBR, ICQ, QVBR.
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.4.log:Apr 19, 2024 17:43:08.163 [133269037263672] DEBUG - [Req#11cb9/Transcode] [FFMPEG] - Driver supports RC modes CQP, CBR, VBR, ICQ, QVBR.

Aside from the warning about the GuC firmware version everything looks as I’d expect in a working system. You can grab the dg2_guc_70.bin file from the link in the log if you want to try the latest version. It should live in /lib/firmware/i915 (back up the existing file first). Distributions are sometimes behind on firmware versions, so it wouldn’t hurt to try it.

The RC modes listed from your server log look fine as well. You might need to post the full set of logs to see if they show why it’s falling back to software transcoding.

Thanks for replying. I updated the guc file from the website it told me but it’s still saying it’s the older version, oh well. I’m also attaching the server logs hoping you can spot something
Plex Media Server Logs_2024-04-20_22-12-09.zip (4.8 MB)

It looks like it might be failing due to an OpenCL problem (used for hardware accelerated HDR tone mapping):

Apr 20, 2024 22:01:01.709 [124543653915448] ERROR - [Req#b01/Transcode/A9AEDEFC-1A9D-426A-BD40-161F93FD3312/8383a71b-a648-4409-a3b3-a63bf0226106] [AVHWDeviceContext @ 0x774bf78d1b00] Failed to get number of OpenCL platforms: -1001.

Do you have HDR tone mapping enabled in your server’s transcoder settings? If so, try disabling that and see if HW acceleration of AV1 works then.

[Edit]
If it ends up working with HDR tone mapping off, here’s another thread to follow which discusses that particular problem (HW accelerated transcoding failing when HDR tone mapping is enabled):