Skip to content

Videos: Improve Intel QSV Hardware Support and Performance #4030

Closed
@xrad

Description

@xrad

1. What is not working as documented?

[DISCLAIMER: I know dev time is scarce, that this is a very specific case and that it may not even be specific to photoprism. But it happens and is reproducable in PP's docker compose container and I could not find anything about this issue anywhere else.]

Qsv accelerated ffmpeg does not work and falls back to software coding. In the docker logs this manifests as:

3.100\n  libswscale      7.  1.100 /  7.  1.100\n  libswresample   4. 10.100 /  4. 10.100\n  libpostproc    57.  1.100 / 57.  1.100\nlibva info: VA-API version 1.19.0\nlibva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so\nlibva info: Found init function __vaDriverInit_1_18\nlibva info: va_openDriver() returns 0\n[AVHWDeviceContext @ 0x562abf67fe80] Error creating a MFX session: -9.\nDevice creation failed: -1313558101.\nFailed to set value '/dev/dri/renderD128' for option 'qsv_device': Unknown error occurred\nError parsing global options: Unknown error occurred\n"
root-photoprism-1  | time="2024-01-23T13:31:48Z" level=warning msg="h264_qsv: failed to transcode 

2. How can we reproduce it?

In the container specified below, you can reproduce the issue on the command line. To further simplify, I only focus on decoding:

root@231128:/photoprism/storage$ ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v libx264 -f mp4 output.mp4

...
libva info: VA-API version 1.19.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x555f7c623cc0] Error creating a MFX session: -9.
Device creation failed: -1313558101.
No device available for decoder: device type qsv needed for codec h264_qsv.
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (h264_qsv) -> h264 (libx264))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Device setup failed for decoder on input stream #0:1 : Unknown error occurred

Could "VA-API version 1.19.0" vs "__vaDriverInit_1_18" be a culprit?

/dev/dri is properly mapped:

root@231128:/photoprism$ ls -l /dev/dri/
total 0
crw-rw---- 1 root video 226,   0 Jan 24 10:52 card0
crw-rw---- 1 root   104 226, 128 Jan 24 10:52 renderD128

For now, I run PP as root to avoid permission issues accessing /dev/dri/renderD128

3. What behavior do you expect?

QSV working.

4. What could be the cause of your problem?

Incompatibility between Proxmox kernel/drm and PP's Ubuntu media stack?

5. Can you provide us with example files for testing, error logs, or screenshots?

Sure, let me know what would be helpful.

6. Which software versions do you use?

Proxmox: pve-manager/8.1.4/ec5affc9e41f1d79 (running kernel: 6.5.11-7-pve)
PP running in a privileged LXC container

ii  ffmpeg                               7:6.0-6ubuntu1                          amd64        Tools for transcoding, streaming and playing of multimedia files
ii  intel-media-va-driver-non-free:amd64 23.2.3+ds1-1                            amd64        VAAPI driver for the Intel GEN8+ Graphics family
ii  intel-opencl-icd                     22.43.24595.41-1                        amd64        Intel graphics compute runtime for OpenCL
ii  libdrm-intel1:amd64                  2.4.115-1                               amd64        Userspace interface to intel-specific kernel DRM services -- runtime
ii  libffmpeg-nvenc-dev                  12.0.16.0-1                             all          FFmpeg headers for interfacing with NVIDIA's codec APIs
ii  libffms2-5:amd64                     2.40+git20211209-2build2                amd64        Cross platform ffmpeg wrapper library
ii  libva-dev:amd64                      2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- development files
ii  libva-drm2:amd64                     2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- DRM runtime
ii  libva-glx2:amd64                     2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- GLX runtime
ii  libva-wayland2:amd64                 2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- Wayland runtime
ii  libva-x11-2:amd64                    2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- X11 runtime
ii  libva2:amd64                         2.19.0-1                                amd64        Video Acceleration (VA) API for Linux -- runtime
ii  vainfo                               2.12.0+ds1-1                            amd64        Video Acceleration (VA) API for Linux -- info program

(a) PhotoPrism Architecture & Build Number: AMD64, ARM64, ARMv7,...

PhotoPrism CE Build 231128-f48ff16ef AMD64

(b) Database Type & Version: MariaDB, MySQL, SQLite,...

Default mariadb from docker-compose

(c) Operating System Types & Versions: Linux, Windows, Android,...

Proxmox LXC, Debian 12

(d) Browser Types & Versions: Firefox, Chrome, Safari on iPhone,...

n/a

(e) Ad Blockers, Browser Plugins, and/or Firewall Software?

n/a

7. On what kind of device is PhotoPrism installed?

(a) Device / Processor Type: Raspberry Pi 4, Intel Core i7-3770, AMD Ryzen 7 3800X,...

Dell Wyse 5070
Intel J4005 (Gemini Lake)

(b) Physical Memory & Swap Space in GB

8GB, 4GB

(c) Storage Type: HDD, SSD, RAID, USB, Network Storage,...

SSD

(d) Anything else that might be helpful to know?

8. Do you use a Reverse Proxy, Firewall, VPN, or CDN?

No

Metadata

Metadata

Assignees

Labels

enhancementEnhancement or improvement of an existing featurereleasedAvailable in the stable releasetestedChanges have been tested successfullyvideoVideo Formats, Transcoding, FFmpeg, Streaming & Co

Type

No type

Projects

Status

Release 🌈

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions