Record x seconds before and after a message is received

• Hardware Platform (Jetson / GPU) Orin Devkit
• DeepStream Version 6.1
• JetPack Version (valid for Jetson only) 5.1
• TensorRT Version 8.4

So I am trying to record X seconds before and after a certain event (let’s say an obstacle is detected). How will I go about this and what are the elements I should use to achieve this?

Currently, to achieve this I am using a list to store frames (as numpy arrays). The number of frames I store is FPSX frames and continually update the list in FIFO fashion. Once an event is received I wait for the required frames (FPSX frames after the event) and then write them using OpenCV’s video writer by spawning a thread. It works well. Now I am looking to find a deep-stream way to achieve the same because maintaining a list of frames for tens of streams is not really practical and will lead to performance issues.

Also if it matters I am already recording raw streams and also publishing them as RTSP.
I have attached the pipeline for a better understanding of the workflow that I currently have.

Edit: So I am thinking ‘valve’ with a ‘splitmuxsink’ would be the way to go. Any pointers?

pipeline.pdf (49.4 KB)

please refer to Smart Video Record
and sample opt\nvidia\deepstream\deepstream-6.2\sources\apps\sample_apps\deepstream-testsr in DeepStream SDK.

Let me check. Thanks

I am looking to do this in Python, can you point me to the relevant documentation? I have a high level understanding of how it is working but couldn’t find any python material.

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

it can’t be used in python directly, please refer to python smartrecord