BtbN / FFmpeg-Builds

MIT License
6.99k stars 958 forks source link

Enable vaapi on Windows builds #296

Closed lolzballs closed 9 months ago

lolzballs commented 10 months ago

Since libva 2.17, there is a new libva_win32 node, which is supported by ffmpeg since d54127c4. Could vaapi be enabled in these builds on Windows?

I was able to hack the vaapi layers together to get a working build but I'm not sure how to make it nice enough for a PR here.

BtbN commented 10 months ago

I looked into it in the past, and it seemed very messy, and I don't really see the benefit of it. libva on Windows is just a wrapper around other APIs, for which ffmpeg already has direct support.

lolzballs commented 10 months ago

My main interest is to try out the DX12 Video APIs, which ffmpeg doesn't have support for yet. There are patches posted for D3D12 decode, but not encode.

BtbN commented 10 months ago

There's is Vulkan support which already exists and mostly works, and is extensively being worked on. libva is extremely hard to deal with, and even on Linux has a high chance of not working or crashing, due to its modular nature. It's not strictly compatible with static linking. So I'd rather not add it for Windows, where it's going to be an even bigger headache, for a feature which is exposed already anyway.

Andarwinux commented 10 months ago

FFmpeg Vulkan Video is still a work in progress. It's completely unavailable on Intel and AMD, and NVIDIA has trouble decoding a lot of videos. It also can't be combined with Vulkan Filters. In contrast, VA-API works well, whether it's for decoding, encoding, or using filters.

Intel originally planned to merge d3d12va immediately, but ffmpeg vulkan maintainer Lynne asked to merge only after v6.1, not sure why.

BtbN commented 9 months ago

It's now enabled. But I could not get it to work whatsoever.

Andarwinux commented 9 months ago

Requires vaon12 driver.

BtbN commented 9 months ago

Yes, I have not found a way to install that. I only found a nuget package, which seems to require a Visual Studio Project to install into.

lolzballs commented 9 months ago

You can either build it from mesa, or download the nuget package and extract the DLLs.

Andarwinux commented 9 months ago

Yes, I have not found a way to install that. I only found a nuget package, which seems to require a Visual Studio Project to install into.

https://github.com/pal1000/mesa-dist-win https://gitlab.freedesktop.org/mesa/mesa/-/pipelines?scope=finished&page=1

lolzballs commented 9 months ago

Thanks, tested the latest builds and libva is working.

For anybody trying to get it working, you just need to have dxil.dll and vaon12_drv_video.dll in a folder somewhere. Then point the LIBVA_DRIVERS_PATH environment variable to there, and -hwaccel vaapi should work.