Smart Record is awesome. Thanks for adding it. It’s working great for me from two different RTSP sources, and it’s a clever idea to save the H264 stream directly to disk without needing to decode it first (probably buying my Jetson Nano some more fps!). A couple of issues I’ve found:
a) For the callback function (initParams.callback) when the recording ends, I’m finding that the duration field in NvDsSRRecordingInfo is always 0 when my callback function is called. So I’m tracking it myself as a workaround, but you should probably fix that.
b) It’s kinda painful to get to the SR context object (NvDsSRContext) for each source in the pipeline. I had to do some gymnastics to pass NvDsSrcParentBin references for each RTSP source into my custom DS plug-in at the time I’m setting up the GST pipeline. I pass a pointer to them as a gstreamer property of type gpointer. It works, it’s just annoying. I couldn’t find a more efficient way to work through GST or NvBatchMeta to get at all the sources and their SR context objects, but maybe I missed something. So I’m basically doing this on the receiving end in the DS plug-in I wrote:
NvDsSRContext *recordCtx = (NvDsSRContext *)plugin_ctx->initParams.multi_src_bin->sub_bins[frame_meta->source_id].recordCtx;
where plugin_ctx is my DS plugin’s context struct, and I added a field called ‘multi_src_bin’ to it (type NvDsSrcParentBin *). This was the easiest thing I found to pass my DS plug-in after configuring the GST pipeline in the main deepstream-app (reference app).
All that said, why not just attach a link to NvDsSRContext* inside of NvDsFrameMeta? You’ve already got source_id, source_frame_width, and other source-related fields there. Would shortcut a lot of pain! :)
An additional feature request is to allow us to specify the format of the filename a bit more. You allow for a prefix, but I don’t like exactly how the SR plug-in is formatting the timestamp and other aspects of the filename after that. So right now I’m using the callback function to also rename the file, which works. It’s just extra steps I have to do.
My environment:
Jetson Nano
DS5.0
JP4.4
Other versions consistent with JP4.4