DeepStream SDK FAQ

31.[DSx_All_App] Use nvurisrcbin plugin to do smart record in Python
Nvurisrcbin plugin encapsulates smart recording function. Please refer to the complete Python sample test.py.diff (1.9 KB) based on deeptream-test3.py. Below are the main three steps to use.

31.1 Set parameters for smart record
After creating the nvurisrcbin element, you need to set smart record parameters before starting pipeline. The explanation of the parameters can be found in nvurisrcbin.html.

ele.set_property("smart-record", 2) # enable smart record.
ele.set_property("smart-rec-dir-path", ".") # set record path.
#For more parameters, please run gst-inspect-1.0 nvurisrcbin to check.

31.2 Send signal to start record
Signal "start-sr" has four parameters, namely gpointer sessionId, guint startTime, guint duration and gpointer userData. Python can use a capsule object to pass C gpointer. Here is a patch gpointer_bind.diff (1.4 KB) to bind the function alloc_buffer1 which can return a capsule object.

a=pyds.alloc_buffer1(4)
ele.emit('start-sr', a, 2, 7, None)

31.3 Send signal to stop record
Signal "stop-sr" has one parameter guint sessionId.

ele.emit('stop-sr', 0)

related topic:
[Smart recording on Azure IOTEDGE]
[Smart record in Python]
[Smart Record in python]
[Using smart-record in python]