Is there any way to convert NvBufSurface to NvBuffer?

Hello, is there any way to convert NvBufSurface to NvBuffer? I saw a post before saying that you should only use one of them, I used yuv422 to convert to yuv420, so I used NvBufSurface, I want to try converting the data you get into jpeg or directly use mjpeg to store into a video file, found them All apis use NvBuffer.Because it involves the alignment of NvBufSurface memory, I don’t know how to convert.by the way, jetpack version is 6.0

Hi,
NvBuffer APIs are supported on Jetpack 4 and deprecated on Jetpack 5 and 6. Please use NvBufSurface APIs. Please refer to the sample to encode NvBufSurface to JPEG:

/usr/src/jetson_multimedia_api/samples/05_jpeg_encode/