Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson)
• DeepStream Version 5.1
• JetPack Version (4.5.1)
NvBufSurfTransform_Rotate90.zip (2.2 MB)
I have uploaded a video of the problem.
Pipeline is v4l2src->videoconvert->nvvideoconvert (probe)->capsfilter->nvstreammux->nvegltransform->nveglglessink
Code of probe callback func-
static GstPadProbeReturn v4l2_flip_src_pad_buffer_probe(GstPad *pad,
GstPadProbeInfo *info,
gpointer u_data) {
GstBuffer *buf = (GstBuffer *)info->data;
GstMapInfo outmap = GST_MAP_INFO_INIT;
gst_buffer_map(buf, &outmap, GST_MAP_WRITE);
NvBufSurface *surface = (NvBufSurface *)outmap.data;
guint ogWidth = (guint)surface->surfaceList[0].width;
guint ogHeight = (guint)surface->surfaceList[0].height;
NvBufSurfTransformRect src_rect, dst_rect;
src_rect.top = 0;
src_rect.left = 0;
src_rect.width = ogWidth;
src_rect.height = ogHeight;
dst_rect.top = 0;
dst_rect.left = 0;
dst_rect.width = ogHeight;
dst_rect.height = ogWidth;
NvBufSurface *dst_surface = NULL;
NvBufSurfaceCreateParams nvbufsurface_create_params;
nvbufsurface_create_params.gpuId = surface->gpuId;
nvbufsurface_create_params.width = ogHeight;
nvbufsurface_create_params.height = ogWidth;
nvbufsurface_create_params.size = 0;
nvbufsurface_create_params.colorFormat = surface->surfaceList[0].colorFormat;
nvbufsurface_create_params.layout = surface->surfaceList[0].layout;
nvbufsurface_create_params.memType = surface->memType;
NvBufSurfaceCreate(&dst_surface, 1, &nvbufsurface_create_params);
NvBufSurfTransformParams nvbufsurface_params;
nvbufsurface_params.src_rect = &src_rect;
nvbufsurface_params.dst_rect = &dst_rect;
nvbufsurface_params.transform_flag = 0;
nvbufsurface_params.transform_filter = NvBufSurfTransformInter_Default;
NvBufSurfTransformConfigParams transform_config_params;
NvBufSurfTransform_Error err;
transform_config_params.compute_mode = NvBufSurfTransformCompute_Default;
transform_config_params.gpu_id = surface->gpuId;
transform_config_params.cuda_stream = NULL;
err = NvBufSurfTransformSetSessionParams(&transform_config_params);
// copy to dst_surface
err = NvBufSurfTransform(surface, dst_surface, &nvbufsurface_params);
// rototate 90 degree to original surface
nvbufsurface_params.src_rect = &dst_rect;
nvbufsurface_params.dst_rect = &src_rect;
nvbufsurface_params.transform_flag = NVBUFSURF_TRANSFORM_FLIP;
nvbufsurface_params.transform_flip = NvBufSurfTransform_Rotate90;
err = NvBufSurfTransform(dst_surface, surface, &nvbufsurface_params);
NvBufSurfaceDestroy(dst_surface);
surface->surfaceList[0].width = ogHeight;
surface->surfaceList[0].height = ogWidth;
// surface->surfaceList[0].planeParams.width[0] = ogHeight;
// surface->surfaceList[0].planeParams.height[0] = ogWidth;
gst_buffer_unmap(buf, &outmap);
return GST_PAD_PROBE_OK;
}