245 points · by mshachkov · 2y ago · 104 comments
That's good.
By the way, mpv already supports Vulkan video decoding:
https://github.com/mpv-player/mpv/issues/11739
Now we need OBS and Firefox supporting Vulkan video too.
Why? They have perfectly great existing hardware decoder offloading APIs via the various OS' native APIs for videos. Why use Vulkan video extensions? It seems like it just complicates things since MacOS/iOS and Android are unlikely to get these and Vulkan on Windows' is a second-class citizen as well. Not to mention the feature & API availability is lagging very far behind native APIs that they're already using.
It's not a bad extension necessarily, seems like it'd be a great option for games that want to integrate some cutscenes. But if you have an existing solution, it also doesn't seem valuable to migrate to this, either.
One vendor specific API, not "various OS' native APIs".
Firefox currently supports hardware video decoding with Intel's vendor specific VA-API only on Linux, which is not supported by NVIDIA. (A third-party VA-API to NVDEC translation layer for Linux does exist on GitHub, nvidia-vaapi-driver, but it's not yet reliable as the officially supported VDPAU or NVDEC, and is not included in official linux package repositories.)
Intel has VA-API, AMD has AMF, and NVIDIA has VDPAU which is being replaced by NVDEC/NVENC.
The idea behind Vulkan Video Extensions is to have a vendor independent and cross-platform video API.
Intel is behind VA-API originally, but I don't think it's fair to say it's a vendor specific API anymore. It's supported by the open source drivers for GPUs from all 3 vendors. It's just that the open source drivers for Nvidia cards are not very practical and the proprietary drivers only support vdpau and nvdec/nvenc
Incorrect. Firefox uses Windows Media Foundation, which is cross-vendor, on Windows. It uses MediaCodec on Android which is again cross-vendor. Presumably it uses whatever iOS' equivalent is as well.
It only uses VA-API on a single OS, Linux, and that's probably more a reflection on the media qualities (or lack thereof) of Linux as a whole. Maybe Vulkan video extensions will be the savior on Linux. Or maybe it won't because it won't be anyone's focus of investment since it's largely a Linux-only problem in the first place.
It is also intended as a multi-platform abstraction.
This makes it a no-go as a platform API. The open drivers for AMD use VA-API.
That's not true at all. See:
https://www.omgubuntu.co.uk/2023/07/firefox-115-intel-gpu-vi... https://www.phoronix.com/news/Mozilla-Firefox-115 https://www.omglinux.com/firefox-hardware-acceleration-raspb...
they are also plentiful, vendor specific and unstable.
a generic solution would be well appreciated
Also, maybe someone knows more about this, but I thought that most software like Firefox, MPV and VLC are using dav1d for AV1 decoding as it seems to be the most performant AV1 decoder (in Software) out there at the moment.
See the post. They are working on AV1 extensions.
On Linux it should be a better option than VAAPI once drivers will support it. Since Firefox is using ffmpeg anyway, it probably shouldn't be too hard to make it an option.
Decoding h264/h265 in fixed (CPU) hardware is much more efficient than on the GPU.
Don’t get me wrong, its still miles and miles better than software decode.
The primary choices are space savings and power efficiency. Dedicated hardware and serial decoding/encoding often win out as a result.
You can encode the independent groups of pictures (the key frame and all the subsequent predictive frames until the next key frame) in parallel but at least with 4k video you hit memory bandwidth limitations quite quickly.
However, most formats allow for some parallelism at the "macroblock" level - you can usually decode all 16x16 pixels simultaneously. To some extent you can decode macroblocks separately, but "intra prediction" requires you to have the ones above and to the left available.
mpv for example can use Vulkan for both at the same time.
how to exceed the character limit on your super wide screen with just one function name
import vkGetPhysicalDeviceVideoEncode;
QualityLevelPropertiesKHR(...);
Or even better: import vk*PhysicalDeviceVideoEncode;
Get_QualityLevelPropertiesKHR(...);