Why can’t FFmpeg encode HEVC using QSV on Intel ARC A750?

Just built a brand-new media server with an Intel Arc A750, and I’m trying to get FFMPEG to use QSV for compressing/transcoding content.

Built FFmpeg with appropriate flags:

ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
configuration: --prefix=/home/ciuffo/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ciuffo/ffmpeg_build/include --extra-ldflags=-L/home/ciuffo/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ciuffo/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvpl --enable-nonfree

Ran into a problem where it wouldn’t encode without installing libmfx.so.1.2. Ran into another issue with libmfx.so.1.2.9 that comes with apt-get, so I built from source to get libmfx.so.1.2.14

ldconfig -p | grep mfx-gen.so.1.2
    libmfx-gen.so.1.2 (libc6,x86-64) => /opt/intel/mediasdk/lib/libmfx-gen.so.1.2

And

ls -l /opt/intel/mediasdk/lib/ | grep libmfx-gen.so.1.2
lrwxrwxrwx 1 root root       17 Feb 16 09:16 libmfx-gen.so -> libmfx-gen.so.1.2
lrwxrwxrwx 1 root root       20 Feb 16 09:16 libmfx-gen.so.1.2 -> libmfx-gen.so.1.2.14
-rwxrwxrwx 1 root root 11413240 Feb 17 06:51 libmfx-gen.so.1.2.14

Oddly, FFmpeg wouldn’t find that library unless I also added the path to LD_LIBRARY_PATH.

Now I can happily encode a video with h264_qsv and av1_qsv, but with hevc_qsv, I get this:

ffmpeg -v verbose -hwaccel qsv -c:v h264_qsv -i Gladiator (2000).mp4 -c:v hevc_qsv -c:a copy gladiatorcompressed.mkv
...
[h264 @ 0x6267738239c0] Reinit context to 1920x816, pix_fmt: yuv420p
[vist#0:0/h264 @ 0x626773d4cf00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
...
[out#0/matroska @ 0x626773d4bb40] No explicit maps, mapping streams automatically...
[vost#0:0/hevc_qsv @ 0x626773d4d1c0] Created video stream from input stream 0:0
[AVHWDeviceContext @ 0x626773d4a5c0] Trying to use DRM render node for device 0, with matching vendor id (0x8086).
[AVHWDeviceContext @ 0x626773d4a5c0] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x626773d4a5c0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x626773d4a5c0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x626773d4a5c0] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x626773d4a5c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x626773d4a5c0] Initialised VAAPI connection: version 1.22
[AVHWDeviceContext @ 0x626773d4a5c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.1.0 ().
[AVHWDeviceContext @ 0x626773d4a5c0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x6267746b9180] Use Intel(R) oneVPL to create MFX session, API version is 2.13, the required implementation version is 1.3
[AVHWDeviceContext @ 0x6267746b9180] Initialize MFX session: implementation version is 1.35
[AVHWDeviceContext @ 0x6267746b9180] Error setting child device handle: -17
Device creation failed: -1313558101.
[vist#0:0/h264 @ 0x626773d4cf00] [dec:h264_qsv @ 0x626773d4ac00] No device available for decoder: device type qsv needed for codec h264_qsv.
[vist#0:0/h264 @ 0x626773d4cf00] [dec:h264_qsv @ 0x626773d4ac00] Hardware device setup failed for decoder: Unknown error occurred
Error opening output file gladiatorcompressed.mkv.
Error opening output files: Unknown error occurred
[AVIOContext @ 0x62677382b300] Statistics: 40538410 bytes read, 4 seeks

If I heed the warning about hwaccel_output_format, I get a similar error. Really at my wit’s end here. No idea why this is happening.

Other info:

uname -a
Linux greybox 6.8.0-53-generic #55-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 15:37:52 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
ffmpeg -encoders | grep qsv
...
 V..... av1_qsv              AV1 (Intel Quick Sync Video acceleration) (codec av1)
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V..... hevc_qsv             HEVC (Intel Quick Sync Video acceleration) (codec hevc)
 V..... mjpeg_qsv            MJPEG (Intel Quick Sync Video acceleration) (codec mjpeg)
 V..... mpeg2_qsv            MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2video)
 V..... vp9_qsv              VP9 video (Intel Quick Sync Video acceleration) (codec vp9)

Of this list, only hevc_qsv, mpeg2_qsv, and mjpeg2_qsv don’t work. av1, h264, and vp9 all work fine (and fast!)

And if it matters, my CPU is an AMD EPYC 4004.

And I heard something about strangeness when video cards don’t have monitors plugged into them. This was all done over SSH, but with a monitor plugged into the card’s HDMI port. It’s just idling at the Ubuntu server login screen.