Image is delayed using Appsrc Plugin

Hi,

I have a pipeline as following :

Appsrc -> nvvideoconvert -> nvdrmvideosink

The appsrc is implemented so that a new frame will be read, then some processes will be done on the frame that will take around 80 milliseconds. Then, the frame will be pushed into the pipeline.

The problem is:

  • it takes 500 milliseconds to run when I enable those processes.
  • it takes 250 milliseconds to run when I disable them

when I try to debug the code, I disabled the process and made the frame to be read and then pushed into the pipeline. Then, I added a time.sleep for 80 milliseconds. The frames is dropped and the image delay is very large.

Is there any sub-process that the appsrc run in the background ?

The Appsrc properties as follow:

caps = "video/x-raw,format=RGBA,width=640, height=512 ,framerate= 12/1"
"format" =  Gst.Format.TIME
"do-timestamp" =  True

Then, there is a function call cb_need_data with all the processes that I described before :

appsrc.connect("need-data", cb_need_data, some_data)

The cb_need_data function is as follow :

def cb_need_data(source, size, colsys):
    while True:
        # reading the frame from the camera
        ret, img_test = colsys.pipeline_data.cap.read()
        img_test = cv2.cvtColor(img_test, cv2.COLOR_BGR2RGBA)
        if not ret:
            continue
        
        # sleep time to represent the processes on the frame
        time.sleep(80 / 1000)

        # check the img_final is not empty
        height, width, channels = img_test.shape
        if height * width == 0:
            continue
        
        # prepare buffer for appsrc and push it into the pipeline
        buffer = ndarray_to_gst_buffer(img_test)
        buffer.pts = colsys.pipeline_data.timestamp
        buffer.duration = Gst.util_uint64_scale_int(1, Gst.SECOND, colsys.pipeline_data.FRAME_RATE)
        colsys.pipeline_data.timestamp += Gst.util_uint64_scale_int(1, Gst.SECOND, colsys.pipeline_data.FRAME_RATE)
        source.emit("push-buffer", buffer)
        break

• Hardware Platform (Jetson NX)
• DeepStream Version 5.1
• JetPack Version 4.5.1
• TensorRT Version 7.1.3-1+cuda10.2

You can try to set the NVMM memory mode to the plugins.
You can also try to refer the process of our c code

/opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-appsrc-test/deepstream_appsrc_test_app.c

Is there a way to use NVMM memory mode within appsrc properties without using capsfilter plugin ?

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

No, cause appsrc is a gstreamer origin plugin, we have no demo to use NVMM memory in the plugin. It can use in our nv plugins.Could you try to start a new thread to process your demand in the probe function?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.