nvpro-samples / vk_video_samples

Vulkan video samples
Apache License 2.0
252 stars 41 forks source link

Help: "vk_video_encoder" demo running abnormally, commit 8b5acab. #61

Closed moyidaren closed 6 months ago

moyidaren commented 10 months ago

Hello, Nvidia engineers. We are currently preparing to use NVIDIA graphics cards to achieve hardware encoding acceleration under the Vulkan 1.3 API framework. We are facing several difficulties and hope you can help us solve them.

My hardware environment is as follows: Operating System: Windows 10 Professional 22H2 64 CPU: 13th Gen Intel (R) Core (TM) i9-13900HX 2.20 GHz RAM: 32.0 GB GPU: NVDIA GeForce RTX 4060 Laptop GPU

My software environment is as follows: VulkanSDK: VulkanSDK-1.3.261.1 Installerexe NVIDIA Beta graphics card driver: 532.28 Geforce Win11 Win10 64bit DCH Internationalexe VS2019: Microsoft Visual Studio Enterprise 2019 16.11.18 WIN10 SDK: 10.0.17763.0 Cmake: cmake version 3.24.0-rc3 Ffmpeg: ffmpeg-6.1 full_ Build shared. 7z python: 3.12(64bit)

vk_video_samples related instructions: Version: commit 8b5acab @ zlatinski Zlatinski committed on Sep 21

Problems encountered:

  1. vk_video_samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp+313 The IsCompatible function actually requires 9 parameters, but the demo only filled in 8 parameters and the second parameter is missing. How should I fill in the VkVideoSessionCreatorFlagsKHR session CreatorFlags parameter? The function definition appears in vk_video_samples/common/libs/VkCodecUtils/VulkanVideoSession. h+38)

  2. vk_video_samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp+323 VulkanVideoSession:: The Create function actually requires 10 parameters, but the demo only fills in 9 parameters, missing the second parameter VkVideoSession: Create FlagsKHR session: Create Flags parameter. How should I fill in this parameter? The function definition appears in vk_video_samples/common/libs/VkCodecUtils/VulkanVideoSession. h+27)

  3. vk_video_samples/vk_video_encoder/libs/VkVideoEncoder/VkEncoderDpbH264.cpp+225 "memcpy (m_pCurPicInfo, pDPBPicInfo, sizeof (DpbPicInfo));" must be a segment error. "How can m_pCurPicInfo be resolved if it is null ptr?

try: I added the missing second parameter (0) on issues 1 and 2, and called DpbSequenceStart (userDpbSize) on issue 3, which successfully compiled vk video enc test. exe and then executed - i 1080P 420 50. yuv - o 1080P 420 50. h264-- startFrame 0-- numFrames 50-- width 1920-- height 1080-- qp 10-- logBatchEncoding result:

  1. The program will be in vk_video_samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp+819 Enter the assert assert (! "Invalid value"); May I ask how to solve this?

try: I observed vk Video Samples/vk Video Encoder/libs/VkVideoEncoder/VkVideoEncoder. h+131 initialized m_ FirstFrameConfig (STdVIDEO-H26X-PICTURE TYPE INTRA REFRESH), So I changed him to STD VIDEO H26X PICTURE TYPE IDR, enabling it to skip 4. result:
5.The program will be in vk_video_samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp+979 "m_vkDevCtx->CmdControlVideoCodingKHR(cmdBuf, &renderControlInfo);" Exception thrown at 0x00007FFA67310B64 (nvoglv64. dl) (located in vk video enc test. exe): 0xC000000 5: Access violation occurred while reading location 0x0000000000000020. May I ask how to solve this?

  1. BUILD.md has not been updated. If you run it directly on the window according to the guide, there will be many library files that cannot be found, such as ffmpeg and vulkan sdk, which need to be manually filled in

  2. I only need the relevant demo of the encoder. Can you streamline it?

Thank you very much for your efforts.

zlatinski commented 9 months ago

Hi @moyidaren, We are working on the encoder's part of the sample; it will need one more Vulkan API update by the end of this year and video h.264/5 encode capabilities by the beginning of February of 2024. Sorry for the delay in the encoder's sample support!

zlatinski commented 6 months ago

Hi @moyidaren, Please check the code at the ToT of main.