DeepStream3.0: How to save decoded frame in .jpg format (or OpenCV Mat) after decode

i wanted to do this,but can not find how to do

DeepStream_Release/sources/gst-plugins/gst-dsexample
gstdsexample.cpp
gst_dsexample_transform_ip()
surface->buf_data -> This is raw data, you can save it jpg format.

hi,ChrisDing.
i have gotten decoded frame in .jpg using surface->buf_data based on deepstream_test1_app.cpp.
However this surface->buf_data comes from the pad of (nveglglessink, “sink”).(NV12 to rgba)
Actually i don’t need nvosd and nveglglessink in my pipeline,so i would like to get the jpg data from the pad of (nvdec_h264, “src”).
there is the problem : the surface->size from nvdec_h264(size:10807201.8) is different from nveglglessink(size:10807204).so how can i save the decoded frame after the plugin nvdec_h264 or nvvidconv.

you can add probe on nvdec_h264’s src pad or nvvidconv’s.

extract the surface data from GstBuffer and save it into jpg.

looks like the surface data is generated by streamemuxer, so add probe on streammuxer please.

looks like the surface data is generated by streamemuxer, so add probe on streammuxer please.
Yes. Please add the probe after streammux.

Hi, ChrisDing and quanminzhu

Could you give me the deepstream_test1_app.cpp which using “surface->buf_data” to produce a jpg file?
I need to get the ROI image from the person bounding box and the stream is came form web cam.
my environment is Xavier.