How can I get gpu memory buffer from gstreamer?

Hi all,

I’m trying to get the gpu memory buffer from my gstreamer command.
In my source code, I’m using below command.

str_gst_launch = “v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=UYVY !
nvvidconv ! video/x-raw(memory:NVMM),width=512,height=512,format=BGRx ! appsink name=mysink”;

As I know, my command returns gpu memory buffer. So I tried to dump it by cudaMemcpy.

CUDA_CHECK(cudaMemcpy(dst, src_from_gstreamer, (unsigned char) * 512*512 * 4, cudaMemcpyDeviceToHost));

But I could see ‘[ERROR] CUDA 1’ , when I run cudaMemcpy.

So my question is, can I get the gpu memory buffer from gstreamer? And can I pass it to cuda process, without cpu memcpy?

Thanks in advance.

You can access NvBuffer by using appsink or add prob function. Please refer to the samples:

BGRx is not supported in CUDA, so please send RGBA buffer to appsink.

Thank you for your reply.
I’ll check your comment and update it soon.