A bug about "nvds_obj_enc_process"

i use nvds_obj_enc_process to save object to jpg,when i use source type is mp4,the jpg is fine, but when i use rtsp stream from camera, the jpg is green!

Please share a test sample so that we can reproduce the issue.


  • Buffer probe function to get the results of primary infer.
  • Here it demonstrates the use by dumping bounding box coordinates in
  • kitti format.
    static GstPadProbeReturn
    gie_primary_processing_done_buf_prob (GstPad * pad, GstPadProbeInfo * info,
    gpointer ctx)
    #ifdef DEBUG
    GstBuffer *buf = (GstBuffer *) info->data;
    GstMapInfo inmap = GST_MAP_INFO_INIT;
    if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
    GST_ERROR (“input buffer mapinfo failed”);
    return GST_FLOW_ERROR;
    NvBufSurface *ip_surf = (NvBufSurface *) inmap.data;
    gst_buffer_unmap (buf, &inmap);

NvDsObjectMeta *obj_meta = NULL;
guint vehicle_count = 0;
guint person_count = 0;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);

for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
guint num_rects = 0;
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
obj_meta = (NvDsObjectMeta ) (l_obj->data);
Conditions that user needs to set to encode the detected objects of
* interest. Here, by default all the detected objects are encoded.
* For demonstration, we will encode the first object in the frame /
if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
NvDsObjEncUsrArgs userData = { 0 };
To be set by user /
userData.saveImg = TRUE;
userData.attachUsrMeta = TRUE;
Preset */
userData.objNum = 1;
/*Main Function Call */
nvds_obj_enc_process (ctx, &userData, ip_surf, obj_meta, frame_meta);
nvds_obj_enc_finish (ctx);

i write code in deepstream_app demo, and insert the above code in gie_primary_processing_done_buf_prob function, when i use source stream is rstp from camera, the cropped object picture is all green, but when i use mp4 all is right.

Do you observe the same issue in running deepstream-image-meta-test? The sample can run with RTSP sources.

deepstream-image-meta-test can’t read stream from rtsp, when source is rtsp,demo is dead. when i use mp4, the result is corrent

It seems to be an issue in your source. Usually RTSP sources can be launched in uridecodebin

i download source code 5.0 preview

In DeepStream SDK, uridecodebin is an important element and you have to have a valid URI. You may check if the URI is valid in exectuting

$ gst-launch-1.0 uridecodebin uri=rtsp://_IP_ADDR_OF_RTSP_SOURCE_ ! nvoverlaysink

I have the same questions