Trying to access frame using "pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)" but instead encountering with Segmentation fault

Hi I am working on python application test 1. I want to save bounding box region in memory. I am trying to access frame using below code inside
def osd_sink_pad_buffer_probe(pad,info,u_data):

n_frame=pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)
#convert python array into numy array format. frame_image=np.array(n_frame,copy=True,order=‘C’)
#covert the array into cv2 default color format
frame_image=cv2.cvtColor(frame_image,cv2.COLOR_RGBA2BGRA)

But I am facing segmentation fault error after processing of few frames. The same configuration and app file is working fine if I am not accesing frames.

• Hardware Platform (GPU)–> Tesla k40m
• DeepStream Version 5.0
• NVIDIA GPU Driver Version (valid for GPU only) -->440.100
• Issue Type( bugs)

Hey, we have a demo https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/blob/5cb4cb8be92e079acd07d911d265946580ea81cd/apps/deepstream-imagedata-multistream/deepstream_imagedata-multistream.py , have you checked it?

Hi , bcao. I have worked on this demo. But it works for me for few frames then stops, showing “bus error”. On changing some conditions the pipeline stops at starting. The code I have mentioned earlier was taken from this example only.

So the demo can work for you, right?
If yes, can you share all your code for debug?

Yes it is working , but in unreliable way, sometimes it runs to thousands of frames, sometimes just in hundred and stops abruptly.
something like this…

I am using rtsp stream.

My script is–
test_image_deepstream.py (16.0 KB)

I think there is problem while integration of Opencv with gst plugin in my pipeline. I have added below in deepstream reference app after pgie , this is also generating bus error for me
[ds-example]
enable=1
processing-width=640
processing-height=480
full-frame=0
unique-id=15