[FFmpeg-user] init_hw_device qsv for hwaccel on Skylake iGPU + Nvidia GF GPU

Terje J. Hanssen terjejhanssen at gmail.com
Sun Sep 1 11:53:18 EEST 2024


I have not succeeded yet to configure ffmpeg QSV access to an enabled 
iGPU onboard  an Intel Core i7-6700K (Skylake). This is a legacy, 
rebuilt workstation with additional, discrete Nvidia GeForce GTX 960 GPU 
on a MSI-Z170-A Pro mobo.

Any suggestions how to solve this?

My tested ffmpeg code lines and system information below.

1) Tested first this simple ffmpeg decode bencmark code line from
https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Decode-only
This works fine on single GPU Caby Lake/UHD 620 and on Alder Lake/Arc 
A750, but on Skylake with dual iGPU HD 530 and a Nvidia GeForce GTX 960 
card, these errors are reported:

    ffmpeg -hide_banner -hwaccel qsv -hwaccel_output_format qsv -i
    h264_8bit_yuv420p.mp4 -f null -
    ....
    [AVHWDeviceContext @ 0x55bed1a7c500] Error creating a MFX session: -9.
    Device creation failed: -1313558101.
    [vist#0:0/h264 @ 0x55bed1a656c0] [dec:h264_qsv @ 0x55bed1a64300] No
    device available for decoder: device type qsv needed for codec h264_qsv.
    [vist#0:0/h264 @ 0x55bed1a656c0] [dec:h264_qsv @ 0x55bed1a64300]
    Hardware device setup failed for decoder: Unknown error occurred
    [vost#0:0/wrapped_avframe @ 0x55bed1a63740] Error initializing a
    simple filtergraph
    Error opening output file -.
    Error opening output files: Unknown error occurred
    bench: maxrss=59076KiB



2) Additional tests where I experimented to apply suggestions from
https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Transcode

      -qsv_device is an qsv customized option can be used to specify a
    hardware device and avoid the default device initialization failure
    when multiple devices usable (eg: an Intel integrated GPU and an
    AMD/Nvidia discrete graphics card).


    ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i
    h264_8bit_yuv420p.mp4 -f null -
    DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
    DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
    [AVHWDeviceContext @ 0x56330da80dc0] libva:
    /usr/lib64/dri/iHD_drv_video.so init failed
    [AVHWDeviceContext @ 0x56330da80dc0] Failed to initialise VAAPI
    connection: 18 (invalid parameter).
    Device creation failed: -5.
    Failed to set value '/dev/dri/renderD128' for option 'qsv_device':
    Input/output error
    Error parsing global options: Input/output error


    ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD129 -i
    h264_8bit_yuv420p.mp4 -f null -
    [AVHWDeviceContext @ 0x55deafcbcec0] Error creating a MFX session: -9.
    Device creation failed: -1313558101.
    Failed to set value '/dev/dri/renderD129' for option 'qsv_device':
    Unknown error occurred
    Error parsing global options: Unknown error occurred


    ffmpeg -hide_banner -init_hw_device qsv=hw -filter_hw_device hw
    -hwaccel_output_format qsv -hwaccel qsv -qsv_device
    /dev/dri/renderD128 -i h264_8bit_yuv420p.mp4 -f null -
    [AVHWDeviceContext @ 0x563f568e7e00] Error creating a MFX session: -9.
    Device creation failed: -1313558101.
    Failed to set value 'qsv=hw' for option 'init_hw_device': Unknown
    error occurred
    Error parsing global options: Unknown error occurred


3) and also tried to apply the answer from
https://stackoverflow.com/questions/44747381/i-cant-use-hw-encoder-of-qsv-by-ffmpeg#47145215 
<https://stackoverflow.com/posts/47145215/timeline>

    It looks like ffmpeg is looking in its list of devices for a qsv
    type device and not finding it. You can create a ffmpeg hardware
    device with -init_hw_device qsv=qsv:MFX_IMPL_hw and then choose it
    with -hwaccel qsv -hwaccel_device qsv. You should only need to do
    the init once.


    ffmpeg -hide_banner -init_hw_device qsv=qsv:MFX_IMPL_hw
    -hwaccel_device qsv -hwaccel_output_format qsv -i
    h264_8bit_yuv420p.mp4 -f null -
    [AVHWDeviceContext @ 0x555f1a59ee00] Error creating a MFX session: -9.
    Device creation failed: -1313558101.
    Failed to set value 'qsv=qsv:MFX_IMPL_hw' for option
    'init_hw_device': Unknown error occurred
    Error parsing global options: Unknown error occurred


    ffmpeg -hide_banner -init_hw_device qsv=qsv:MFX_IMPL_hw -hwaccel qsv
    -hwaccel_output_format qsv -i h264_8bit_yuv420p.mp4 -f null -
    [AVHWDeviceContext @ 0x557b2d5ede00] Error creating a MFX session: -9.
    Device creation failed: -1313558101.
    Failed to set value 'qsv=qsv:MFX_IMPL_hw' for option
    'init_hw_device': Unknown error occurred
    Error parsing global options: Unknown error occurred

--------------------------

System info and drivers:


    inxi -CGMSz
    System:
       Kernel: 6.10.5-1-default arch: x86_64 bits: 64
       Desktop: GNOME v: 46.3.1 Distro: openSUSE Tumbleweed-Slowroll
    20240803
    Machine:
       Type: Desktop Mobo: MSI model: Z170-A PRO (MS-7971) v: 1.0
         serial: <superuser required> UEFI: American Megatrends v: 1.K0
         date: 07/10/2018
    CPU:
       Info: quad core model: Intel Core i7-6700K bits: 64 type: MT MCP
    cache:
         L2: 1024 KiB
       Speed (MHz): avg: 800 min/max: 800/4200 cores: 1: 800 2: 800 3:
    800 4: 800
         5: 800 6: 800 7: 800 8: 800
    Graphics:
       Device-1: Intel HD Graphics 530 driver: i915 v: kernel
       Device-2: NVIDIA GM206 [GeForce GTX 960] driver: nvidia v: 550.100
       Display: wayland server: X.org v: 1.21.1.12 with: Xwayland v: 24.1.1
         compositor: gnome-shell driver: X: loaded: modesetting
    unloaded: fbdev,vesa
         gpu: nvidia,nvidia-nvswitch resolution: 1920x1080~60Hz
       API: OpenGL v: 4.6.0 vendor: nvidia v: 550.100 renderer: NVIDIA
    GeForce
         GTX 960/PCIe/SSE2
       API: Vulkan v: 1.3.290 drivers: N/A surfaces: xcb,xlib,wayland
       API: EGL Message: EGL data requires eglinfo. Check --recommends.


    lspci -k | grep -EA3 'VGA|3D|Display'
    00:02.0 Display controller: Intel Corporation HD Graphics 530 (rev 06)
         DeviceName:  Onboard IGD
         Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7971
         Kernel driver in use: i915
    --
    01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce
    GTX 960] (rev a1)
         Subsystem: Micro-Star International Co., Ltd. [MSI] Device 3201
         Kernel driver in use: nvidia
         Kernel modules: nouveau, nvidia_drm, nvidia










More information about the ffmpeg-user mailing list