Vulkan Video Decoding
wickedengine.net
wickedengine.net
A cursory search did seem to suggest encoding was supported as well as decoding in Vulkan, which is very cool.
It would feel weird for Vulkan to become the standard API for encode/decode given that (as you say) video accelerators aren't necessarily tied to the GPU (although not necessarily weirder than doing it through an extension of the webcam API).
In a neighboring comment thread, hrydgard states that it is very much possible to have a Vulkan driver that has only video encoding/decoding queues, which if true resolves the potential awkwardness in my opinion. That's especially relieving if true as well since Vulkan looks to be a prime contender to take up the mantle for OpenCL as well; especially believable now seeing what has been done with rusticl.
Perhaps it is still a little awkward, but Vulkan as a general hardware acceleration abstraction layer seems like it could be a very good thing. As it is, as an application developer, you're probably better off on Linux just using GStreamer or Pipewire rather than v4l2 directly, since some devices (e.g. Blackmagic Decklink) provide GStreamer integration but not v4l2 drivers. In that case, it hardly matters what API abstracts the hardware as long as it does a good job of it.
I'd expect it also to move faster than VAAPI moves now once all things are in place (like adding new hardware and etc.).
It might be also possible to implement actual VAAPI over Vulkan video.
The bar to beat VAAPI is really low. For all practical purposes, VAAPI doesn't exist. So any alternate plan, even if it is essentially the same thing underneath, is worth a shot.
It’s quite handy to be able to render a video on to spatial objects
When I wanted to play video and render them inside D3D12 scenes, I have used a higher-level one, IMFMediaEngine https://learn.microsoft.com/en-us/windows/win32/api/mfmediae...
That OS-supplied high-level video player object can demux containers, decode, play audio, and copy uncompressed frames to D3D11 textures. Then, it’s relatively easy to use DXGI surface sharing API to share the resulting RGBA8 frames from D3D11 into D3D12.
For instance, with VAAPI->OpenGL you would use vaExportSurfaceHandle in conjunction with glEGLImageTargetTexture2DOES.
Check out the "hwdec" mechanism in MPV:
https://github.com/mpv-player/mpv/blob/master/video/out/hwde...
https://github.com/mpv-player/mpv/blob/master/video/out/hwde...
Edit: missed the part about JS ecosystem. You can move DRM prime descriptors between processes, but I assume you can’t do this from the ffmpeg CLI and would need to write your own little C wrapper around libavcodec
What? You can compile it with just the stuff you need and only activate stuff without any dependencies. Static linking is also possible if too many 'DLL' files is a issue.
But vulkan video decoding is still cool.
Sure, but running config alone takes like 10-15 minutes on my PC with an Intel I7-9700K processor at 4.9GHz. This is while using all my cores at 100% CPU usage too, it's ridiculous. And not only that, you'll likely have to run this massive script several times to tweak the config until you're happy with what you're using. Then actually compiling the library statically takes another 15-20 minutes. So I think the remark that it's huge and consisting of several DLL files is spot on.
> Static linking is also possible if too many 'DLL' files is a issue.
FFmpeg doesn't recommend static linking.
> The following is a checklist for LGPL compliance when linking against the FFmpeg libraries. It is not the only way to comply with the license, but we think it is the easiest...Use dynamic linking (on windows, this means linking to dlls) for linking with FFmpeg libraries.[0]
The API this post writes about is basically a single decoder... without even (de)muxing ability.
You're wrong. It's literally the first sentence of the article.
To me, this just comes across as pointlessly condescending. There's faster and more direct ways to say the same thing, e.g.
> Yeah the first sentence says different
I saw AMD video AV1 encoding/decoding going into radv mesa (probably due to the new AMD AV1 accelerators).
The interface must stay excrutiating simple (plain and simple C), have no generators, etc...
* modern web browsers have incredibly complex behavior to try and detect whether your system's video codecs have crashed, since they can and will, and then if they crash too many times the system decoder is disabled and either replaced with a software decoder or nothing at all
So I doubt this would change anything to that effect.