Hi,
We have deprecated NvBuffer APIs on Jetpack 5, so please use NvBufSurface APIs. For video encoding, please refer to 01_video_enode sample. Or can refer to the patch:
How to use v4l2 to capture videos in Jetson Orin r35 Jetpack 5.0 and encode them using a hardware encoding chip - #8 by DaneLLL
And latest Jetpack 5 is 5.1.3. Certain issues are fixed in later releases and it would be great if you can upgrade.