Segmentation fault (core dumped) + Smart-record: Recording from multiple-source C

• Hardware Platform (Jetson / GPU): RTX-2080Ti
• DeepStream Version: 5.1-devel

I need to save separate multi-RTSP at the same time. When I create multiple NvDsSRContext to recordbin for each of sources I got an error:

This is my pipeline:

Can you support to me?

Please tell us how to reproduce the coredump?

After entering one rtsp (or multi-rtsp), I meet early an error “Core Dump”.

I create struct NvDsSRContext to running four recordbin as the following snippet code:

typedef struct {
  NvDsSRContext *datax[MAX_NUMBER];
} DataCtx;

static gboolean
smart_record_event_generator (gpointer data)
  NvDsSRSessionId sessId = 0;
  guint startTime = START_TIME;
  guint duration = SMART_REC_DURATION;

  for (int i=0; i<MAX_NUMBER; i++){
    g_printerr ("___________________SOURCE-%02d____________________ \n", i);
    DataCtx *ctx = (DataCtx *) data;
    if (ctx->datax[i]->recordOn) {
      g_print ("Recording done.\n");
      if (NvDsSRStop (ctx->datax[i], 0) != NVDSSR_STATUS_OK)
        g_printerr ("Unable to stop recording\n");
    } else {
      g_print ("Recording started..\n");
      if (NvDsSRStart (ctx->datax[i], &sessId, startTime, duration,
              NULL) != NVDSSR_STATUS_OK)
        g_printerr ("Unable to start recording\n");
  return TRUE;

And snippet code in main part:

 DataCtx container;
 params.containerType = SMART_REC_CONTAINER;
 params.videoCacheSize = VIDEO_CACHE_SIZE;
 params.defaultDuration = SMART_REC_DEFAULT_DURATION;
 params.callback = smart_record_callback;

for (int i=0; i <num_sources; i++){
  g_printerr("_____Starting Recordbin--%d_____ \n", i);
  char temp[3];
  g_snprintf(temp, 2, "stream_%d",i);
  params.fileNamePrefix = (gchar *)temp;

  if (NvDsSRCreate (&container.datax[i], &params) != NVDSSR_STATUS_OK) {
    g_printerr ("Failed to create smart record bin");
    return -1;
  encoder_post_osd = gst_element_factory_make ("nvv4l2h264enc", "encoder-post-osd");
  parser_post_osd = gst_element_factory_make ("h264parse", "parser-post-osd");
  queue_post_osd = gst_element_factory_make ("queue", "queue-post-osd");

  gst_bin_add_many (GST_BIN (pipeline), queue_post_osd, encoder_post_osd,
      parser_post_osd, container.datax[i]->recordbin, NULL);

  if (!gst_element_link_many (tee_post_osd, queue_post_osd, encoder_post_osd,
          parser_post_osd, container.datax[i]->recordbin, NULL)) {
     g_print ("Elements not linked. Exiting. \n");
    if(NvDsSRDestroy (container.datax[i]) != NVDSSR_STATUS_OK)
    g_printerr ("Unable to destroy recording instance\n");

  if (container.datax[i]) {
    g_timeout_add (SMART_REC_DURATION * 1000, smart_record_event_generator,


Please debug your code. You need to make sure the coredump is caused by deepstream components.