MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

Add gstreamer-vaapi

Open ksvert opened this issue 2 years ago • 13 comments

Package name

gstreamer-vaapi

Brief description of package

VA-API-based decoder, encoder, postprocessing and video sink elements for GStreamer.

URL for package's homepage

https://gstreamer.freedesktop.org/modules/gstreamer-vaapi.html

Provide a basic test case to validate the package's functionality.

Launch some video with vaapidecodebin: gst-launch-1.0 filesrc location=~/big_buck_bunny.mov ! qtdemux ! h264parse ! vaapidecodebin ! vaapisink

MINGW environments where you need the package

  • [X] MINGW64
  • [ ] MINGW32
  • [ ] UCRT64
  • [ ] CLANG64
  • [ ] CLANG32
  • [ ] CLANGARM64

Are you willing to submit a PR?

No response

ksvert avatar May 15 '23 09:05 ksvert

Does gstreamer-vaapi support native Windows platform? I get the following error using meson build command.

meson.build:153:2: ERROR: Problem encountered: No renderer API found (it is requried either DRM, X11 and/or WAYLAND)

Biswa96 avatar May 15 '23 16:05 Biswa96

Is dx12 va-api in msys2 now?

driver1998 avatar May 16 '23 01:05 driver1998

I am not sure what that means. There is a libva package https://packages.msys2.org/base/mingw-w64-libva. Do you mean that one? Is it related to gstreamer-vaapi?

Biswa96 avatar May 16 '23 03:05 Biswa96

yeah, libva and also the VaOn12 va-api driver in mesa.

https://devblogs.microsoft.com/directx/video-acceleration-api-va-api-now-available-on-windows/

Since libva 2.17 a new libva-win32 node was added to enable support on Windows platforms and provide VA-API acceleration from any chosen GPU adapter. Since Mesa 22.3 the same VA-API driver used in WSL can be compiled for Windows, and we named it VAOn12. Implemented on top of the D3D12 Video APIs, provides cross-hardware-vendor VA-API acceleration.

driver1998 avatar May 16 '23 04:05 driver1998

How that can help gstreamer-vaapi? Or is it not even required in Windows?

Biswa96 avatar May 16 '23 04:05 Biswa96

In gstreamer-vaapi package description it's not mentioned if it works on windows or not. But for example here: https://gstreamer.freedesktop.org/releases/gstreamer-vaapi/1.8.0.html binaries for windows are mentioned so it should work (unless they mean gstreamer binaries in general and not specifically for vaapi).

I just now came across information about DXVA in GStreamer and it looks like it uses it as VA-API on windows (libraries should be already included in bad-plugins package): https://gstreamer.freedesktop.org/documentation/d3d11/d3d11h264dec.html So maybe it's not required.

ksvert avatar May 16 '23 09:05 ksvert

So maybe it's not required.

Can this issue be closed now?

Biswa96 avatar May 26 '23 07:05 Biswa96

It would be great to have gstreamer-vaapi as d3d11 doesn't have encoders, but i'm still not sure if it's supported on windows or not.

ksvert avatar May 29 '23 10:05 ksvert

It might work with the Windows VA-API driver mentioned above. I don't think this is tested by anybody though.

driver1998 avatar May 29 '23 10:05 driver1998

VAAPI is in uAPI for hardware accelerated media codecs (decoders, encoder and video processing) used primarily for Intel Gen graphics though some other vendors did use it as well, for example, AMD. VAAPI is exposed via https://github.com/intel/libva which is a small "dispatching" library, i.e. it just defines uAPI, some key functions and its major goal is to load a driver. I.e. to make things work at the first place you need to have combination of libva + driver.

Libva initially was Linux uAPI and on Windows Intel used (and still uses) DXVA + custom extensions (for encoders). Though this is starting to change now with DX12 which has some encoders API. However, recently Libva was ported to Windows (starting from 2.18), see [1]. It works with 2 pieces: 1) libva library itself was ported (and that's why you see msys2 *-libva package), 2) plus vaon12 mesa gallium driver was provided. vaon12 driver is layered driver which means that it actually maps DX12 API calls to VAAPI calls. So, features exposed by VAAPI would be shrinked by what DX12 actually support + what got mapped in vaon12 implementation + what fallback was provided on mesa level (for some video processing operations shaders are used).

So, libva+vaon12 now opens a door to have VAAPI acceleration on Windows. However, don't assume that ffmpeg-vaapi and gstreamer-vaapi would be workable as is. Some enabling effort is required to make them work. Such work was done for ffmpeg-vaapi, see https://github.com/FFmpeg/FFmpeg/commit/d54127c41a81cf2078a3504f78e0e4232cfe11b7, and we basically are waiting ne release, n6.1 to be able to connect the dots, i.e. enable ffmpeg-vaapi withing msys2 ffmpeg package build. As for the gstreamer-vaapi I don't know whether enabling was actually done. Thus, before this package request will become valid, there is need to be a request to gstreamer-vaapi to actually enable support on Windows + release it.

As for ffmpeg-vaapi it's much closer to be enabled on msys2 level. I noted that we need new ffmpeg release for that. In a meanwhile there are few things which needs to be done on msys2 level for the full experience:

  1. https://github.com/msys2/MINGW-packages/pull/17421 - this will eliminate a crash in vaon12 due to missing dxil.dll
  2. https://github.com/msys2/MINGW-packages/pull/17468 - some video codecs need to be enabled in mesa build explicitly (h264, h265, etc.) - they are off by default
  3. https://github.com/msys2/MINGW-packages/pull/17455 - vainfo needs to be packaged - that's simple application lists available VAAPI entrypoints

[1] https://devblogs.microsoft.com/directx/video-acceleration-api-va-api-now-available-on-windows/

dvrogozh avatar Jun 05 '23 15:06 dvrogozh

Thus, before this package request will become valid, there is need to be a request to gstreamer-vaapi to actually enable support on Windows + release it.

Looking into gstreamer repo, I see that enabling effort was actually completed: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/c1946c02092a2bb486105f3f5f71cc42743b8a1e. It is not yet included into any release though, same as for ffmpeg.

So, ffmpeg-vaapi and gstreamer-vaapi are currently in same state: we need releases.

dvrogozh avatar Jun 05 '23 17:06 dvrogozh

New ffmpeg with vaapi is here: #19050 But I get crashes in dxva2, so blocked for now.

edit: fixed

lazka avatar Nov 11 '23 14:11 lazka

#26080 added the libva plugin

Is there anything missing?

lazka avatar Oct 23 '25 18:10 lazka