How to use v4l2 to capture videos in Jetson Orin r35 Jetpack 5.0 and encode them using a hardware encoding chip

Continuing the discussion from tegra multimedia samples not working properly:

My machine is Jetson Orin
Jetpack 5.0.2
L4T: 35.1.0

I referred to the code provided by Nvidia,01_video_encode (video encode) and 12_camera_v4l2_cuda (camera capture CUDA processing)

But it didn’t work out

Duplicated with How to use v4l2 to capture videos in Jetson Orin r35 Jetpack 5.0 and encode them using a hardware encoding chip - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums