How to pass NVMM buffers on x86 to Gstreamer


Currently in my GStreamer pipeline on my NX, I pass in NVMM memory from the appsrc by taking a dma_buffer from a camera and then passing it onto gstreamer like this:

            NvBufferParams par;
            NvBufferGetParams(dmabuf_id, &par);
            gpointer data_new = g_malloc(par.nv_buffer_size);

            GstMemoryFlags flags = (GstMemoryFlags) 0;
            buffer = gst_buffer_new_wrapped_full(flags,

            if (gst_buffer_map(buffer, &map, GST_MAP_WRITE))
                memcpy(, par.nv_buffer, par.nv_buffer_size);
                gst_buffer_unmap(buffer, &map);

The thing is, I need this pipeline to also work on x86 but I noticed that I don’t have access to nvbuf_utils.h, so I don’t have the ability to create NvBuffers from my existing image data and then pass it onto my pipeline. How do you pass NVMM memory to the pipeline if I don’t have access to the NvBuffer header files on x86?

What I’m really looking for is two examples:

  1. Creating NvBuffer’s from RAW GPU memory
  2. Creating NvBuffer’s from VPI images

The implementation is specific to using hardware DMA buffer on Jetson platforms and not applicable to x86 PC. Please kindly note this.

A possible solution is to create CUDA buffers on x86 PC, encode into h264/h265 stream, and send out through RTSP. On Xavier NX, you can receive the stream and decode it.

@DaneLLL Ok, then let me modify my question. If I have some raw CUDA buffers from VPI / a cudaMalloc, how do I pass it into the gstreamer appsrc if the appsrc is set to NVMM? I have only seen examples where they pass data to the appsrc by using a NvBuffer, such as the example shown above, but I have not seen raw cuda buffer examples. Is that something related to "video/x-raw(memory:CUDAMemory)" ? Can you point me to an example.

This is not an answer, but you may also read:

[EDIT: but that won’t help much with nvbuf_utils API changes with L4T R35]
Also see:

I’m closing this topic due to there is no update from you for a period, assuming this issue was resolved.
If still need the support, please open a new topic. Thanks


For this, do you mean on Jetson platforms or x86 PC? We don’t support VPI on x86 PC so you probably mean doing this on Jetson platforms. Would like to clarify this.