Use the probe to take out the image error

Please provide complete information as applicable to your setup.

• platform: orin
**• deepstream 6.1.1

**error :
VMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
NvRmStream: Channel submission failed (err=196623)
NvRmStream: Flush failed (err=196623)
gst_nvvconv_transform: NvBufSurfTransform Failed
ERROR from element source2: Internal data stream error.
Error details: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:wtf-pipeline/GstBin:new-bin2/GstV4l2Src:source2:
streaming stopped, reason error (-5)

my code:
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo in_map_info =GST_MAP_INFO_INIT;
//if(!gst_buffer_map(buf,&in_map_info,GST_MAP_READ))
//{

//	g_print("error  map buf\n ");
	//gst_buffer_unmap(buf,&in_map_info);
//	return GST_PAD_PROBE_OK;

// }
gst_buffer_map(buf,&in_map_info,GST_MAP_READ);
NvBufSurface * surface=(NvBufSurface *)in_map_info.data;
NvBufSurface *dst_surface=NULL;
NvBufSurfTransformRect src_rect, dst_rect;
NvBufSurfTransformParams nvbufsurface_params;
NvBufSurfaceCreateParams nvbufsurface_create_params;
cudaError_t cuda_err;
cudaStream_t cuda_stream;
gint create_result;
NvBufSurfTransformConfigParams transform_config_params;
NvBufSurfTransform_Error err;
src_rect.top = 0;
src_rect.left = 0;
src_rect.width = (guint) surface->surfaceList[batch_id].width;
src_rect.height = (guint) surface->surfaceList[batch_id].height;
dst_rect.top = 0;
dst_rect.left = 0;
dst_rect.width = (guint) surface->surfaceList[batch_id].width;
dst_rect.height = (guint) surface->surfaceList[batch_id].height;
nvbufsurface_params.src_rect = &src_rect;
nvbufsurface_params.dst_rect = &dst_rect;
nvbufsurface_params.transform_flag = NVBUFSURF_TRANSFORM_CROP_SRC | NVBUFSURF_TRANSFORM_CROP_DST;
nvbufsurface_params.transform_filter = NvBufSurfTransformInter_Default;
nvbufsurface_create_params.gpuId = surface->gpuId;
nvbufsurface_create_params.width = (guint) surface->surfaceList[batch_id].width;
nvbufsurface_create_params.height = (guint) surface->surfaceList[batch_id].height;
nvbufsurface_create_params.size = 2;
nvbufsurface_create_params.isContiguous = true;
nvbufsurface_create_params.colorFormat = NVBUF_COLOR_FORMAT_RGBA;
nvbufsurface_create_params.layout = NVBUF_LAYOUT_PITCH;
nvbufsurface_create_params.memType = 0;
create_result = NvBufSurfaceCreate(&dst_surface, batch_size, &nvbufsurface_create_params);
transform_config_params.compute_mode = NvBufSurfTransformCompute_Default;
transform_config_params.gpu_id = surface->gpuId;
transform_config_params.cuda_stream = cuda_stream;
err = NvBufSurfTransformSetSessionParams (&transform_config_params);
NvBufSurfaceMemSet (dst_surface, -1, -1, 0);
err = NvBufSurfTransform (surface, dst_surface, &nvbufsurface_params);
NvBufSurfaceMap (dst_surface, -1, -1, NVBUF_MAP_READ);
NvBufSurfaceSyncForCpu (dst_surface, -1, -1);
cv::Mat img= cv::Mat(1080,1920,CV_8UC4,dst_surface->surfaceList[0].mappedAddr.addr[0],dst_surface->surfaceList[0].pitch);
NvBufSurfaceUnMap(dst_surface,-1,-1);
NvBufSurfaceUnMap(surface,-1,-1);

g_print("---start-22---\n");
gst_buffer_unmap(buf,&in_map_info);

Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
• The pipeline being used

• Hardware Platform (Jetson / GPU)
ORIN

• DeepStream Version
DeepStream Version:6.1.1

• JetPack Version (valid for Jetson only)
JetPack:5.0.2
• TensorRT Version
Tensorrt:8.4.1
• Issue Type( questions, new requirements, bugs)

Using probes to read data can cause problems。
NvRmStream: Flush failed (err=196623)
gst_nvvconv_transform: NvBufSurfTransform Failed
ERROR from element source2: Internal data stream error.
Error details: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:wtf-pipeline/GstBin:new-bin2/GstV4l2Src:source2:

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
Deepstream c++ was used to read the 4-channel camera data for splicing. I used source(v4l2)->filter(video/x-raw) convert(nvidconv)->filter(video/x-raw(memory:NVMM) 'format",(string)RGBA) to forma bin add to pipline, The overall composition is (pipines, bin1 and bin2, bin3, bin4, nvstreammux, nvmultistreamtiler, nvvidoconvert, nveglglesstransform, nveglglessink).Use the probe to read the src data of nvmultistreamtiler. Running code over a period of time can cause problems

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

The code for the probe is:
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo in_map_info =GST_MAP_INFO_INIT;
//if(!gst_buffer_map(buf,&in_map_info,GST_MAP_READ))
//{

// g_print("error map buf\n ");
//gst_buffer_unmap(buf,&in_map_info);
// return GST_PAD_PROBE_OK;
// }
gst_buffer_map(buf,&in_map_info,GST_MAP_READ);
NvBufSurface * surface=(NvBufSurface *)in_map_info.data;
NvBufSurface *dst_surface=NULL;
NvBufSurfTransformRect src_rect, dst_rect;
NvBufSurfTransformParams nvbufsurface_params;
NvBufSurfaceCreateParams nvbufsurface_create_params;
cudaError_t cuda_err;
cudaStream_t cuda_stream;
gint create_result;
NvBufSurfTransformConfigParams transform_config_params;
NvBufSurfTransform_Error err;
src_rect.top = 0;
src_rect.left = 0;
src_rect.width = (guint) surface->surfaceList[batch_id].width;
src_rect.height = (guint) surface->surfaceList[batch_id].height;
dst_rect.top = 0;
dst_rect.left = 0;
dst_rect.width = (guint) surface->surfaceList[batch_id].width;
dst_rect.height = (guint) surface->surfaceList[batch_id].height;
nvbufsurface_params.src_rect = &src_rect;
nvbufsurface_params.dst_rect = &dst_rect;
nvbufsurface_params.transform_flag = NVBUFSURF_TRANSFORM_CROP_SRC | NVBUFSURF_TRANSFORM_CROP_DST;
nvbufsurface_params.transform_filter = NvBufSurfTransformInter_Default;
nvbufsurface_create_params.gpuId = surface->gpuId;
nvbufsurface_create_params.width = (guint) surface->surfaceList[batch_id].width;
nvbufsurface_create_params.height = (guint) surface->surfaceList[batch_id].height;
nvbufsurface_create_params.size = 2;
nvbufsurface_create_params.isContiguous = true;
nvbufsurface_create_params.colorFormat = NVBUF_COLOR_FORMAT_RGBA;
nvbufsurface_create_params.layout = NVBUF_LAYOUT_PITCH;
nvbufsurface_create_params.memType = 0;
create_result = NvBufSurfaceCreate(&dst_surface, batch_size, &nvbufsurface_create_params);
transform_config_params.compute_mode = NvBufSurfTransformCompute_Default;
transform_config_params.gpu_id = surface->gpuId;
transform_config_params.cuda_stream = cuda_stream;
err = NvBufSurfTransformSetSessionParams (&transform_config_params);
NvBufSurfaceMemSet (dst_surface, -1, -1, 0);
err = NvBufSurfTransform (surface, dst_surface, &nvbufsurface_params);
NvBufSurfaceMap (dst_surface, -1, -1, NVBUF_MAP_READ);
NvBufSurfaceSyncForCpu (dst_surface, -1, -1);
cv::Mat img= cv::Mat(1080,1920,CV_8UC4,dst_surface->surfaceList[0].mappedAddr.addr[0],dst_surface->surfaceList[0].pitch);
NvBufSurfaceUnMap(dst_surface,-1,-1);
NvBufSurfaceUnMap(surface,-1,-1);

g_print(“—start-22—\n”);
gst_buffer_unmap(buf,&in_map_info);

some questions:

  1. which deepstream sample are you developing based on?
  2. where did your add these code? can this issue be reproduced every time?
  3. can you narrow down this issue by simplifying pipeline and code?

I refer to the code for this blog ::
(118条消息) DeepStream结合OpenCV4实现视频的分析和截图(三)_deepstream 截图_MOLWH的博客-CSDN博客

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

if you want to capture the objects, please refer to deepstream sdk sample opt\nvidia\deepstream\deepstream-6.2\sources\apps\sample_apps\deepstream-image-meta-test\deepstream_image_meta_test.c
if you want to capture the whole frame, please refer to How to encode multiple images using the same objectMeta inside obj_meta_list - #5 by fanzh

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