Few questions regarding Smart Recording

Dear Experts,

I have the following inquiries regarding smart recording feature of Deepstream SDK. I am using version 5.0.

  1. Can I start and stop recording on manual trigger instead of duration for stop? In other words can I keep duration open so that I can stop recording by calling NvDsSRStop() whenever I want?

  2. What does duration actually do? according to the manual it stops recording after the duration seconds but why then we still need to call NvDsSRStop() according to test5 example. Shouldn’t the function NvDsSRStop() be called automatically internally after duration seconds?

  3. Is there any variable either in NvDsSRContext or anywhere that indicates the duration is over? I suppose “recordOn” in NvDsSRContext only indicates that a recording is started regardless duration expired or not.

  4. Can I call NvDsSRStart() while another previous recording is in progress? or I have to close previous one first to start new recording?


I’ve used smart record quite a bit so will answer the best I can:

  1. Yes you can start and stop recording however you wish and at any time. Simply call NvDsSRStart(...) to start recording and then call NvDsSRStop(...) to stop - or alternatively have it automatically stopped by setting the duration in the NvDsSRStart(...) call.
    The only thing to note is that you can not start multiple recordings at the same time for the same source.

  2. Duration sets the duration for the recording session. i.e. if I have duration set to 30 seconds it will record a 30 seconds long video clip (plus or minus a bit due to GOP). It will automatically stop after the duration or at any time you can stop it instantly with NvDsSRStop(...).

  3. As you suggested - ctx->recordOn can be used to see if a recording is currently taking place.

  4. Correct. Only one recording is possible on one stream at a time. You will get an error from NvDsSRStart(...) if you try.

Thanks @jasonpgf2a for your reply. most of your answers match with my findings/assumptions. However, if I can start and stop recording anytime, what would the duration I need to specify in this case? would this be a very big number? so that no matter when I decide to stop, it would never exceed the duration?

Leave it at 0 or set it as a high number as a fail safe.

Thanks, fail safe idea worked.

Hi, @jasonpgf2a , I have couple of more questions. Maybe you can answer:

  1. Is there a way to perform smart recording in a way so that it produces chunks of video files. for example, if you set max chunk size of 30 sec and smart recording is performed for 1 minute 20 seconds, it will automatically produce the video files in 3 chunks: 30 sec, 30 sec and 20 sec?

  2. This question is regarding the gstreamer filesrc. For filesrc, is there a way to specify an array of files so that it plays the files one after another automatically?