• Hardware Platform (Jetson / GPU)
Jetson nano
• DeepStream Version
6.0
• JetPack Version (valid for Jetson only)
4.6.3-b17
• TensorRT Version
8.2.1.9-1+cuda10.2
Hi, I have been working with smart recording in the deepstream-test5 app and trying to record videos based on object detections. In the bbox_generated_probe_after_analytics
while iterating on the objects, I call the NvDsSRStart to start recording. The code looks like this:
static void
bbox_generated_probe_after_analytics (AppCtx * appCtx, GstBuffer * buf,
NvDsBatchMeta * batch_meta, guint index)
{
NvDsObjectMeta *obj_meta = NULL;
GstClockTime buffer_pts = 0;
guint32 stream_id = 0;
/// smart record
NvDsSRSessionId sessId = 0;
NvDsSrcParentBin *bin = &appCtx->pipeline.multi_src_bin;
NvDsSrcBin *src_bin = &bin->sub_bins[index];
guint startTime = 3;
guint duration = 10;
//g_timeout_add (10000, smartRecord, src_bin);
////
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = l_frame->data;
stream_id = frame_meta->source_id;
GstClockTime buf_ntp_time = 0;
if (playback_utc == FALSE) {
/** Calculate the buffer-NTP-time
* derived from this stream's RTCP Sender Report here:
*/
StreamSourceInfo *src_stream = &testAppCtx->streams[stream_id];
buf_ntp_time = frame_meta->ntp_timestamp;
if (buf_ntp_time < src_stream->last_ntp_time) {
NVGSTDS_WARN_MSG_V ("Source %d: NTP timestamps are backward in time."
" Current: %lu previous: %lu", stream_id, buf_ntp_time,
src_stream->last_ntp_time);
}
src_stream->last_ntp_time = buf_ntp_time;
}
GList *l;
for (l = frame_meta->obj_meta_list; l != NULL; l = l->next) {
/* Now using above information we need to form a text that should
* be displayed on top of the bounding box, so lets form it here. */
obj_meta = (NvDsObjectMeta *) (l->data);
/// changed
//g_print("class_id:%d\n", obj_meta->class_id);
if(obj_meta->class_id!=3){
g_print("class_id:%d\n", obj_meta->class_id);
//g_timeout_add (7000, smartRecord, src_bin);
if (src_bin->recordCtx && !src_bin->reconfiguring) {
NvDsSRContext *ctx = (NvDsSRContext *) src_bin->recordCtx;
if (ctx->recordOn) {
g_print ("Recording done.\n");
if (NvDsSRStop (ctx, sessId) != NVDSSR_STATUS_OK)
g_printerr ("Unable to stop recording\n");
} else {
g_print ("Recording started..\n");
if (NvDsSRStart (ctx, &sessId, startTime, duration, NULL) != NVDSSR_STATUS_OK)
g_printerr ("Unable to start recording\n");
}
}
}
/// changed part ends
// rest is unchanged
I am using the command sudo ./deepstream-test5-app -c /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test5/configs/test5_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt -p 0
to run the app. The output of the app itself is fine, and smart recording is also generating videos, some of which have detections in them but a majority of these are empty files. Also, I am getting the error ** ERROR: <RunUserCallback:207>: No video stream found
while running the app. The output looks like this:
Runtime commands:
h: Print this help
q: Quit
p: Pause
r: Resume
NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
To go back to the tiled display, right-click anywhere on the window.
**PERF: FPS 0 (Avg)
Mon Mar 6 03:27:52 2023
**PERF: 0.00 (0.00)
** INFO: <bus_callback:194>: Pipeline ready
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
** INFO: <bus_callback:180>: Pipeline running
Mon Mar 6 03:27:57 2023
**PERF: 31.00 (29.76)
Mon Mar 6 03:28:02 2023
**PERF: 7.91 (8.87)
Mon Mar 6 03:28:07 2023
**PERF: 6.71 (7.80)
reference in DPB was never decoded
reference in DPB was never decoded
Mon Mar 6 03:28:12 2023
**PERF: 8.33 (8.50)
class_id:2
Recording started..
class_id:2
Recording done.
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Mon Mar 6 03:28:17 2023
**PERF: 14.28 (9.54)
reference in DPB was never decoded
reference in DPB was never decoded
reference in DPB was never decoded
Mon Mar 6 03:28:22 2023
**PERF: 7.70 (9.32)
Mon Mar 6 03:28:27 2023
**PERF: 12.30 (9.89)
Mon Mar 6 03:28:32 2023
**PERF: 7.70 (9.43)
reference in DPB was never decoded
reference in DPB was never decoded
reference in DPB was never decoded
Mon Mar 6 03:28:37 2023
**PERF: 7.35 (9.13)
Mon Mar 6 03:28:42 2023
**PERF: 9.52 (9.38)
class_id:2
Recording started..
class_id:2
Recording done.
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
class_id:2
Recording done.
** ERROR: <RunUserCallback:207>: No video stream found
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
class_id:2
Recording started..
class_id:2
Recording done.
NvMMLiteBlockCreate : Block : BlockType = 261
** ERROR: <RunUserCallback:207>: No video stream found
Mon Mar 6 03:28:47 2023
**PERF: 14.30 (9.64)
Mon Mar 6 03:28:52 2023
**PERF: 11.15 (9.76)
Mon Mar 6 03:28:57 2023
**PERF: 10.99 (9.88)
Mon Mar 6 03:29:02 2023
**PERF: 4.77 (9.49)
Mon Mar 6 03:29:07 2023
**PERF: 5.01 (9.17)
class_id:2
Recording started..
class_id:1
Recording done.
class_id:2
Recording started..
class_id:1
Recording done.
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
Opening in BLOCKING MODE
NvMMLiteBlockCreate : Block : BlockType = 261
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
class_id:2
Recording started..
class_id:1
Recording done.
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
class_id:1
Recording done.
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
** ERROR: <RunUserCallback:207>: No video stream found
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
class_id:2
Recording started..
class_id:2
Recording done.
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
class_id:2
Recording started..
class_id:2
Recording done.
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
class_id:2
Recording done.
class_id:1
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:2
Recording started..
Unable to start recording
class_id:1
Recording started..
Unable to start recording
** ERROR: <RunUserCallback:207>: No video stream found
Also note that when I comment NvDsSRStop (ctx, 0)
, the smart recording outputs are perfect, all having detections, but all the videos are of fixed duration (as intended in this case). I want the videos to start when any object is detected and end when there are no detections in the frame. So, on enabling the NvDsSRStop, I am getting this error and not getting the desired output. Any idea how to fix this? Thanks.