Nvurisrcbin with smart recording feature and how to use it?

Please provide complete information as applicable to your setup.

**• Hardware Platform ----> GPU
**• DeepStream Version -----> 6.4/7
**• TensorRT Version —> >8.5
• NVIDIA GPU Driver Version (valid for GPU only) ----> 545

For Nvurisrcbin I am experimenting with record feature I show same some topic is created already. Some topic is saying till now it’s not usable. I want to know smart recording feature is usable through python ?

I show one topic where lt’s share some code …
TOPIC IS :- Smart recording on Azure IOTEDGE - #4 by benoit.rauturier

I have done the same thing but giving me error

I am pasting code and error …

start
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.10/threading.py”, line 1016, in _bootstrap_inner
self.run()
File “/usr/lib/python3.10/threading.py”, line 1378, in run
self.function(*self.args, **self.kwargs)
File “/opt/nvidia/deepstream/deepstream-6.4/deepstream_python_apps/apps/deepstream-test3/deepstream_smart_record.py”, line 68, in action
ele.emit(‘start-sr’, a, 2, 7, None)
TypeError: could not convert type int to gpointer required for parameter 0
smart_record.py.txt (17.5 KB)

You can refer to this FAQ, which introduces how to use the smart recording feature in Python

Hi @junshengy

I am doing the same thing , but I was not using gpointer_bind.dff , My question is How I can execute the bindings , which path I need to add the code ! How I can make bindings or How I can use
"
m.def(“alloc_buffer1”,

  •          [](size_t size) {
    
  •              return (gpointer) g_malloc0(size);
    
  •          },
    
  •          "size"_a,
    
  •          py::return_value_policy::reference,
    
  •          pydsdoc::methodsDoc::alloc_buffer1);
    

"
function !
If you can provide me proper details that would be great !

Sorry, I don’t understand what you mean. Add cpp patch (gpointer_bind.dff), then rebuild pyds, add python patch (test.py.diff), isn’t that enough? This FAQ has all the information.

Hi @junshengy

I tried what you said I added " bindings/docstrings/functionsdoc.h" I added the code
and “/bindings/src/bindfunctions.cpp” also I added the code and then a create the bindings.
Then also run deepstream-test3
I added action function as you added.
But also “AttributeError: module ‘pyds’ has no attribute ‘alloc_buffer1’. Did you mean: ‘alloc_buffer’?”

I am attaching my pyds bindings can you check once !
And Can you share your python bindings where you show “nvurisrcbin” with smart record is working.
Then I can check it that works for me or not !
I have deepstream version 7.0
pyds_file.zip (1.0 MB)

After modifying the code, did you recompile and install pyds? I think you didn’t modify the code correctly

Okey I am sending the code as well for both
/bindings/docstrings/functionsdoc.h

code_h_cpp.zip (10.6 KB)

/bindings/src/bindfunctions.cpp

There is no problem with the code, please install pyds correctly,I tested it on DS-7.0, your code is based on DS-6.4, they are the same

# Please make sure you have compiled and installed pyds correctly. 
# If the directory does not exist, please refer to sources/deepstream_python_apps/apps/README
cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/build

# rebuild
make

# uninstall old version
pip uninstall pyds

# Reinstall the modified version
pip install ./pyds-xxxx-py3-none-linux_xxxx.whl

Hi @junshengy

Okey !currently I am also using 7.0 . that error is not coming I able to set and install pyds properly.

Now video is saving .mp4 format but it’s has nothing(I mean 0 kb) file.
I want to know “ele.emit(‘start-sr’, a, 2, 7, None)”
in this what is 2 , 7 and None means and why frame is not saving if you can share something insides !!!

  1. 2/7 are just examples, they are the parameters of the following function.

NvDsSRStatus NvDsSRStart (NvDsSRContext *ctx, NvDsSRSessionId *sessionId, guint startTime, guint duration, gpointer userData);

These functions can be triggered by gstreamer-action

You can view it through gst-inspect-1.0 nvurisrcbin

Element Actions:
  "start-sr" :  void user_function (GstElement* object,
                                    gpointer arg0,
                                    guint arg1,
                                    guint arg2,
                                    gpointer arg3);
  "stop-sr" :  void user_function (GstElement* object,
                                   guint arg0);

Please refer to the documentation of smart record, which is related to the i-frame interval of your rtsp stream

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Smart_video.html

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

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