Change location of video saving in Smart Record

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 5.0.1
• TensorRT Version 7.0.11
• NVIDIA GPU Driver Version (valid for GPU only) 460.32.03
• Issue Type( questions, new requirements, bugs) question

In Smart Record, we provide the file location where to save the video through config file. Is it possible to update after NvDsSRCreate is created through smart_record_callback?

e.g.

smart_record_callback (NvDsSRRecordingInfo *info, gpointer userData)
{
 ...
  string videoName = "/var/febrieye/bin/myvid.mp4";
  info->filename = g_strdup_printf("%s", videoName.c_str());
}

I call NvDsSRStart and NvDsSRStop when I want to do the recording. I want to update the path of next recording.

I’m thinking I can provide the filepath through userData in NvDsSRStart then access it in smart_record_callback to update the location of next video saving.

Or maybe there could be any other way.

Yes. The callback function can be used to change the file path.

The location isn’t changing

The output of

smart_record_callback (NvDsSRRecordingInfo *info, gpointer userData)
{
 ...
  cout << "path1:" << info->dirpath << endl;
  string videoPath = "/var/febrieye/bin/";
  info->dirpath = g_strdup_printf("%s", videoPath.c_str());
  cout << "path2:" << info->dirpath << endl;

  g_mutex_unlock (&mutex);

  return NULL;
}

is

path1:/var/febrieye/mnt/
path2:/var/febrieye/bin/

but the videos are getting saved at path1 only.

The “dirpath” and “filename” in NvDsSRRecordingInfo are for reading only, it is of no use to change them.

The filename could not be changed because the olde file is closed and the new file is opened inside NvDsSRStart(), once the file is opened, we can not change the filename.