Repository navigation
feat: decode with Vulkan Video on Linux in the media player - #345
Merged
Merged
Conversation
On Linux the player decoded in hardware on NVIDIA GPUs only, through NVDEC. FFmpeg is now built with Vulkan Video as well, with the H.264, HEVC, VP9 and AV1 hwaccels, so the GPUs of Intel and AMD decode all four in hardware too. The player tries NVDEC first and Vulkan after it. FFmpeg loads libvulkan.so.1 with dlopen when a device is created, so the libraries load on a machine without Vulkan, as they do without the NVIDIA driver. VA-API, the alternative, would have linked libva into libavutil, and the Linux jar would not load where libva is missing. The build needs Vulkan headers newer than distributions ship (VP9 needs 1.4.317), so the C headers of Khronos Vulkan-Headers v1.4.317 are vendored, unchanged, with a pkg-config file for FFmpeg's configure, as the NVDEC headers are. Their licenses go into the Linux platform jars. The docs and the HEVC disclaimer in the NOTICE files name Vulkan Video; the disclaimer paragraph is rewrapped, as one of its lines ran long.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux the media player decoded in hardware on NVIDIA GPUs only, through NVDEC. This adds Vulkan Video, so the GPUs of Intel and AMD decode H.264, HEVC, VP9 and AV1 in hardware too. It is the first step towards hardware H.264, HEVC, VP9 and AV1 on Windows, macOS and Linux; Windows and macOS already have all four in the media player.
Follows #331 (hardware HEVC/AV1, HEVC in hardware only).
--enable-vulkanand theh264_vulkan,hevc_vulkan,vp9_vulkanandav1_vulkanhwaccels on Linux x86-64 and ARM64, the targets that have NVDEC.libvulkan.so.1) withdlopenwhen a device is created, so the libraries keep loading on a machine without Vulkan, as they do without the NVIDIA driver. VA-API was the alternative, but FFmpeg links libva into libavutil, which would make the Linux jar fail to load wherever libva is not installed.Vulkan-Headersv1.4.317 are vendored independencies/vulkan, unchanged, with a pkg-config file for configure, the way the NVDEC headers are. Their licenses (Apache-2.0 or MIT) go into the Linux platform jars underMETA-INF/licenses/vulkan.VideoDecodertries CUDA (NVDEC) first and Vulkan second on Linux, so NVIDIA machines keep the path they had.MediaPlayerJavadoc and the HEVC disclaimer in the NOTICE files name Vulkan Video. The disclaimer paragraph is also rewrapped: one of its lines ran past the wrap in feat: decode HEVC and AV1 in hardware in the media player #331.Testing
--disable-x86asmand without dav1d, which this check did not need). All four Vulkan hwaccels and the four NVDEC ones are enabled (CONFIG_VULKAN_1_4is 1, so VP9 is in), andlibavutil.soandlibavcodec.soneed onlylibcandlibm, notlibvulkan.main, the media module builds and all 88 of its tests pass with hardware decoding required; the Windows FFmpeg build is unchanged.Not verified
Decoding through Vulkan Video has not run on an Intel or AMD GPU: there is no Linux machine with one here, and CI runners have no GPU, so
HardwareDecodingTestskips its hardware tests there. Which codecs work depends on the Mesa (ANV, RADV) or NVIDIA driver version; AV1 and VP9 Vulkan decoding need recent ones. The full Linux build of the module (with dav1d and x86 assembly) runs first in CI.