efficient transfer of buffers created on gpu to encoder

Hi, what is the most efficient way to transfer buffers created on gpu (cudaMalloc, cudaMallocmanaged) to encoder for encoding. Can you explain the process if these buffers are openGLtexture or cudaTexture or cuArray,

i Have seen the multimedia api encode with gpu (03) example, which uses the mmaped buffer of encoder and elg interop to send the buffers to gpu and use the same buffer for encoding after gpu sync.

in my case the frames are already on gpu to start with.

I am relatively new to this, detail is really appreciated.

Thanks in advance.

Hi,
The optimal way is to create NvBuffer and put your data into the Nvbuffer. You may refer to 01_video_encoder for how to use NvBuffer APIs, and 03_video_cuda_enc for how to access NvBuffer through CUDA.

ctx.eglimg = NvEGLImageFromFd(ctx.eglDisplay, buffer->planes[0].fd);
HandleEGLImage(&ctx.eglimg);
NvDestroyEGLImage(ctx.eglDisplay, ctx.eglimg);

Thank you, I am done with the implementation, the performance is about 1000 full HD frames in 4 seconds on tx2.