Memory leak when I put for recording (smart recording)

I don’t understand what you mean, cache_que0 is what you need. If you want to get the input and output data of the element, please add a probe function on the src/sink pad

You can draw the entire pipeline as a picture in the following way

If you want to record overlapped videos, I have also provided a solution before

As I replied before, if you want to trigger start-sr continuously, cache_que0 will not be able to get the data you need.

Can you share your goal? Or try the overlap recording solution above.

our goal is that sometimes we need video and sometimes image based on our usecase . SO, How can I get an image from the smart record cache queue?

If smart-recording can record the video you need, you can consider extracting pictures at a specified time according to pts from the recorded video.

1 Like

I found below code at /opt/nvidia/deepstream/deepstream-7.0/sources/apps/apps-common/src/deepstream_source_bin.c and how can I use this code in python?

void
destroy_smart_record_bin (gpointer data)
{
  unsigned int i = 0;
  NvDsSrcBin *src_bin;
  NvDsSrcParentBin *pbin = (NvDsSrcParentBin *) data;

  g_return_if_fail (pbin);

  for (i = 0; i < pbin->num_bins; i++) {

    src_bin = &pbin->sub_bins[i];
    if (src_bin && src_bin->recordCtx)
      NvDsSRDestroy ((NvDsSRContext *) src_bin->recordCtx);
  }
  pbin->num_bins = 0;
}

static gpointer
smart_record_callback (NvDsSRRecordingInfo * info, gpointer userData)
{
  static GMutex mutex;
  FILE *logfile = NULL;
  g_return_val_if_fail (info, NULL);

  g_mutex_lock (&mutex);
  logfile = fopen ("smart_record.log", "a");
  if (logfile) {
    fprintf (logfile, "%d:%d:%d:%ldms:%s:%s\n",
        info->sessionId, info->width, info->height, info->duration,
        info->dirpath, info->filename);
    fclose (logfile);
  } else {
    g_print ("Error in opeing smart record log file\n");
  }
  g_mutex_unlock (&mutex);

  return NULL;
}

nvurisrcbin is responsible for calling NvDsSRDestroy. In addition, the sr-done signal is the same as smart_record_callback. These codes are useless in Python.

1 Like

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

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