[FFmpeg-user] init_hw_device qsv for hwaccel on Skylake iGPU + Nvidia GF GPU
Terje J. Hanssen
terjejhanssen at gmail.com
Tue Sep 10 15:10:46 EEST 2024
Den 03.09.2024 10:52, skrev Terje Hanssen:
>
>
> Den 03.09.2024 03:56, skrev Andrew Randrianasulu:
>>
>>
>> пн, 2 сент. 2024 г., 22:54 Terje Hanssen <terjejhanssen at gmail.com>:
>>
>>
>> Den 02.09.2024 15:58, skrev Wang, Fei W:
>> > On Mon, 2024-09-02 at 15:29 +0200, Terje J. Hanssen wrote:
>> >>
>> >>
>> >> On 9/2/24 07:01, Wang, Fei W wrote:
>> >>
>> >>> On Sun, 2024-09-01 at 10:53 +0200, Terje J. Hanssen wrote:
>> >>>
>> >>>> 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?
>> >>> You can use vainfo to find the Intel gpu device correctly:
>> >>> "vainfo --display drm --device /dev/dri/renderD12X"
>> >>> Then specify device in ffmpeg cmdline with "-qsv_device
>> >>> /dev/dri/renderD12X"
>> >>> BTW, for legacy platforms, suggest to use libvpl with Media
>> SDK for the
>> >>> runtime implementation:
>> >>> https://github.com/intel/libvpl
>> >>> https://github.com/Intel-Media-SDK/MediaSDK
>> >>> Thanks
>> >>> Fei
>> >> @Fei, thanks for your suggestion that hopefully will probe me
>> in the
>> >> right direction.
>> >> Right now, I will be absent from my Skylake workstation a week or
>> >> two, before I can test more directly on it. But I did preserve
>> some
>> >> more output I will add and refer to below.
>> >>
>> >> In the meantime I also can do a bit indirectly tests on my
>> available
>> >> Kaby Lake XPS-13 with UHD 620 iGPU and a similar system
>> installation:
>> >>
>> >> vainfo --display drm --device /dev/dri/renderD12X
>> >> Trying display: drm
>> >> Failed to open the given device!
>> >>
>> >> As this don't find any device on Kaby Lake, I expect I rather
>> have to
>> >> put in a number "8" instead of "X" as found on Kaby Lake(?)
>> >
>> > Yes, X stands for 8 or 9. To find the Intel device node if vainfo
>> > shows the correct message.
>> >
>> >>
>> >> ls /dev/dri
>> >> by-path card1 renderD128
>> >>
>> >> When I try
>> >>
>> >>> vainfo --display drm --device /dev/dri/renderD12*
>> >> or
>> >>
>> >>> vainfo --display drm --device /dev/dri/renderD128
>> >> This simingly output just the same as "vainfo" alone on KabyLake.
>> >>
>> >> And I have the latter preserved also from Skylake as follows:
>> >>
>> >>> vainfo
>> >>> Trying display: wayland
>> >>> libva info: VA-API version 1.22.0
>> >>> libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
>> >>> libva info: Found init function __vaDriverInit_1_21
>> >>> libva info: va_openDriver() returns 0
>> >>> vainfo: VA-API version: 1.22 (libva 2.22.0)
>> >>> vainfo: Driver version: Intel iHD driver for Intel(R) Gen
>> Graphics -
>> >>> 24.1.5 ()
>> >>> vainfo: Supported profile and entrypoints
>> >>> VAProfileNone : VAEntrypointVideoProc
>> >>> VAProfileNone : VAEntrypointStats
>> >>> VAProfileMPEG2Simple : VAEntrypointVLD
>> >>> VAProfileMPEG2Simple : VAEntrypointEncSlice
>> >>> VAProfileMPEG2Main : VAEntrypointVLD
>> >>> VAProfileMPEG2Main : VAEntrypointEncSlice
>> >>> VAProfileH264Main : VAEntrypointVLD
>> >>> VAProfileH264Main : VAEntrypointEncSlice
>> >>> VAProfileH264Main : VAEntrypointFEI
>> >>> VAProfileH264Main : VAEntrypointEncSliceLP
>> >>> VAProfileH264High : VAEntrypointVLD
>> >>> VAProfileH264High : VAEntrypointEncSlice
>> >>> VAProfileH264High : VAEntrypointFEI
>> >>> VAProfileH264High : VAEntrypointEncSliceLP
>> >>> VAProfileVC1Simple : VAEntrypointVLD
>> >>> VAProfileVC1Main : VAEntrypointVLD
>> >>> VAProfileVC1Advanced : VAEntrypointVLD
>> >>> VAProfileJPEGBaseline : VAEntrypointVLD
>> >>> VAProfileJPEGBaseline : VAEntrypointEncPicture
>> >>> VAProfileH264ConstrainedBaseline: VAEntrypointVLD
>> >>> VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
>> >>> VAProfileH264ConstrainedBaseline: VAEntrypointFEI
>> >>> VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
>> >>> VAProfileVP8Version0_3 : VAEntrypointVLD
>> >>> VAProfileVP8Version0_3 : VAEntrypointEncSlice
>> >>> VAProfileHEVCMain : VAEntrypointVLD
>> >>> VAProfileHEVCMain : VAEntrypointEncSlice
>> >>> VAProfileHEVCMain : VAEntrypointFEI
>> >> ---------------
>> >>
>> >>
>> >> If /dev/dri/card2 and /dev/dri/renderD129 refer to the
>> Skylake HD
>> >> 530 iGPU
>> >> (and /dev/dri/card1 and /dev/dri/renderD128 refer to the
>> Nvidia GPU),
>> >> I cannot understand why the initial, second ffmpeg command in
>> section
>> >> 2) below did report errors?
>> >>
>> >> Possibly syntax error or something else?
>> >
>>
>> > The command looks good. There are 2 run-time implementation
>> Media SDK
>> > and vpl-gpu-rt for libvpl(
>> > more details can be found on github of libvpl:
>> > https://github.com/intel/libvpl).
>> > While only Media SDK supported on Skylake. So you may check if you
>> > installed Meida SDK on your Skylake
>> > but not vpl-gpu-rt.
>> >
>> > Thanks
>> > Fei
>> >
>> >>
>>
>> I only install and have installed related, pre-build distribution
>> packages for openSUSE Tumbleweed Slowroll. Here they are sorted
>> in two
>> lists, to get both the summary descriptions and version numbers,
>> in case
>> something clarify if Media SDK RT is among them(?)
>>
>>
>> may be check also for libmfx?
>>
>
> Hi Andrew,
> Yes, I also noticed libmfx. But to check that on Skylake, I have to
> wait until next week.
> The triple boot menu on my XPS-13/9370 also died, so now I have only
> Ubuntu (from fabric) running and updated on it, as a base Thunderbird
> mail platform :)
>
> Terje
>
>
Thanks Fei and Andrew for your suggestions.
Yes, now I have verified that "libmfx" runtime was not installed by
default on the Skylake workstation (possibly because I enabled its iGPU
in BIOS afterwards).
My ffmpeg had "libvpl" enabled, and "libmfx-gen1_2" was installed by
default. When
When I add-installed "libmfx1", QSV via FFmpeg worked as it should:
ffmpeg -hide_banner -hwaccel qsv -hwaccel_output_format qsv -i
h264_8bit_yuv420p.mp4 -f null -
1) On Skylake i7-6700K / HD-530 iGPU:
frame= 1780 fps=882 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A
speed=35.3x
2) On KabyLake i7-8550U / UHD-620 iGPU:
frame= 1780 fps=795 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A
speed=31.8x
3) On AlderLake i7-12700KF + DG2 A750 GPU:
frame= 1780 fps=833 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A
speed=33.3x
What surprise me here, is that the current most powerful workstation 3),
is not faster here than the legacy 1) and 2)
References:
https://github.com/intel/libvpl?tab=readme-ov-file#architecture
https://github.com/Intel-Media-SDK/MediaSDK?tab=readme-ov-file#id10
https://wiki.archlinux.org/title/FFmpeg#Intel_QuickSync_(QSV)
>>
>> ..........snip
>>
>>
>>
>>
>> >>
>> >>>
>> >>>> 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
>> >
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>>
>
More information about the ffmpeg-user
mailing list