Getting image from deepstream

Hello! Are there any examples, how to get image from deepstream’s element sink pad or src pad and save it to array (numpy). To be specific, i need to get image or image batch from nvinfer sink pad or nvstreammux src pad. I tried some examples for Gstreamer, but unsuccessfully.

Jetson AGX Xavier
Jetpack 4.4.1
TRT 7.1.3
Deepstream 5.0

Do you need python sample or c/c++ sample?

Python, but c++ is also ok.

There is sample of getting numpy array from gst-buffer: deepstream_python_apps/apps/deepstream-imagedata-multistream at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub

I got a RuntimeError: get_nvds_buf_Surface: Currently we only support RGBA color Format. So i cant take image directly from nvstreammux’s or nvinfer’s pads, and have to add nvvidconv and caps filters to pipeline. Anyway it solved my problem. Thanks!