NvDsSRStop removes the video file

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU):
AGX Xavier
• DeepStream Version
6.0
• JetPack Version (valid for Jetson only)
4.6
• TensorRT Version
8.0.1.6
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
Smart recorder deletes the recorded mkv file when NvDsSrStop is called

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

Start the recording: the mkv file starts getting built. It increases in size periodically.

Stop the recording using NvDsSrStop. The callbak function specified in params is not called. The size of mkv file created is reduced to zero . New one is started.

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Did you run our deepstream-testsr demo or your own code?
What is your callbak function specified in params?
Could you update the DeepStream to the latest version(6.2) and test it? Thanks

(1) I use the built in callback function: I just put a log statement there.
static gpointer

smart_record_callback (NvDsSRRecordingInfo *info, gpointer userData)
(2) I use deepstream5 (a variant of it). I just turned on the smart record functionality.
(3) Its not possible for me to upgrade to 6.2 easily as I have several changes. ( even otherwise I believe that will require 20.04 kernel)
Everything seems to be fine. It start recording. It follwos the duration I specify. Its just when I do stop then it shrinks the mkv file to size 0.

(4) I just looked at the depstream-testsr example. It does: NvDsSRStop (ctx, 0) but I do NvDsSRStop(src_bin->record_Ctx,sessionid) sessionid is what I got when I started the recording and stored it in my structure.

There may be some error. Could you attach your log?

You may start it again in your code. Could you try to change the file name when you restart the record?

Please let me know what log you are looking for. My log has lots of unnecessary data.

Below is what I do:

params.callback = smart_record_callback;
… smart_record_callback (NvDsSRRecordingInfo info, gpointer userData)
{
//printf(“\n Smart Record callback called: after data record \n”);
nvds_log(DSLOG_SYSLOG_SENSABLE, LOG_INFO,"
******* smart record callback1 \n");
return(NULL);
}
(2) Yes i change the name of the mkv file. The old one (the one stopped) shrinks to zero. It would be 100 MB but after the Stop command it becomes zero.

1.Log with tag: RunUserCallback

2.Could you minimize your code and provide it to us? Or you can add your patch to our deepstream-testsrdemo and provide to us. We can debug it in our env.

This is a great suggestion. Working on it and should send it by weekend

SRRecording works well in deepstream-test5 (except the issue highlighted) but
deepstream-testsr is not working:
At first i get nvinfer error
sensable5@sensable5-desktop:~/ds6/sources/apps/sample_apps/deepstream-testsr$ deepstream-testsr-app rtsp://root:customer01@192.168.86.239/axis-media/media.amp --enc-type=1 --sink-type=1 --bbox-enable=0 --sr-mode=1
Now playing: rtsp://root:customer01@192.168.86.239/axis-media/media.amp
Opening in BLOCKING MODE
0:00:05.512902881 11024 0xadaba90 INFO nvinfer gstnvinfer.cpp:654:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT input_1 3x368x640
1 OUTPUT kFLOAT conv2d_bbox 16x23x40
2 OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40

0:00:05.513400855 11024 0xadaba90 INFO nvinfer gstnvinfer.cpp:654:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
0:00:05.521413537 11024 0xadaba90 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus: [UID 1]: Load new model:dstestsr_pgie_config.txt sucessfully
Running…
In cb_newpad
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
0:00:07.229100936 11024 0xa792940 WARN nvinfer gstnvinfer.cpp:2332:gst_nvinfer_output_loop: error: Internal data stream error.
0:00:07.229214669 11024 0xa792940 WARN nvinfer gstnvinfer.cpp:2332:gst_nvinfer_output_loop: error: streaming stopped, reason error (-5)
ERROR from element primary-nvinference-engine: Internal data stream error.
Error details: gstnvinfer.cpp(2332): gst_nvinfer_output_loop (): /GstPipeline:dstest-sr-pipeline/GstNvInfer:primary-nvinference-engine:
streaming stopped, reason error (-5)
Returned, stopping playback
Deleting pipeline


I remove pgie from the pipeline and select option of no bounding box

Then I get “No Video Stream Found”:

./deepstream-testsr-app rtsp://root:customer01@192.168.86.239/axis-media/media.amp --enc-type=1 --sink-type=1 --bbox-enable=0 --sr-mode=1
Now playing: rtsp://root:customer01@192.168.86.239/axis-media/media.amp
Opening in BLOCKING MODE
0:00:05.616508520 9913 0x55bd3d6a10 INFO nvinfer gstnvinfer.cpp:654:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT input_1 3x368x640
1 OUTPUT kFLOAT conv2d_bbox 16x23x40
2 OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40

0:00:05.616853144 9913 0x55bd3d6a10 INFO nvinfer gstnvinfer.cpp:654:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
0:00:05.624110045 9913 0x55bd3d6a10 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus: [UID 1]: Load new model:dstestsr_pgie_config.txt sucessfully
Running…
In cb_newpad
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Recording started…
Recording done.
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
NVMEDIA: NVMEDIABufferProcessing: 1099: Consume the extra signalling for EOS
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
Recording started…
Recording done.
** ERROR: RunUserCallback:207: No video stream found
^C

Anyways, to not get distracted:

My flow is as follows: (will share my file if needed but its not the standard deepstream and may take you longer):
Add camera-> create Smart record (with custom filename prefix) NvDsSRCreate, schedule smart_record_event_generator for NvDsSRStart with sessionId as sourceid . This works!! However when I add the same camera again as a different source bin I first remove this camera recording by calling NvDsSRStop with correct sessionID. If the system were to not add new camera the mkv file exists. No issue. However as soon as I add the new camera (same camera again but will have new bin id) NvDsSRCreate is triggered (with new filename but same filepath) . Then this file shrinks to zero.
I destroyed the previous context too.
The last chunk is gone. This is a bummer if last chunk is hours long!!

** ERROR: RunUserCallback:207: No video stream found
Recording started…

The smart recorder didn’t receive any video. Did it run properly with our demo code directly? You can give us your minimized code, just message to me. I cannot reproduce your problem in my env.

No problem. I spent a lot of time running the demo code. It doesnt work . the camera is fine and video is being streamed. deepstream-test5 can create mkv file.

Reproduce:
Just disconnect the camera from the network and the last segment of video being recorded will disappear.

Is it possible to get explanation on the “nomenclature” of genereated mkv files?
smart_record_2_1677711953_00004_20230301-230603_7258.mkv
My part is: smart_record_2_1677711953. I can understand that 00004 refers to segment and then the date. What is 230603_7258?

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

230613 refers to time and 7258 refers pid number.
We still sugget you use deepstream-testsr to verify this problem. deepstream-test5 contains a lot of functions and the codes you added may also have problems too. deepstream-testsr app is simpler for locating smart record problems. You can change the format of the container (mp4 or mkv) by changing the macro definition SMART_REC_CONTAINER. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.