NTP timestamp in pyds

• Hardware Platform (Jetson / GPU) - dGPU
• DeepStream Version - 6.2
• JetPack Version (valid for Jetson only)
• TensorRT Version - 8.5.2.2
• NVIDIA GPU Driver Version (valid for GPU only) - 530.xx
• Issue Type( questions, new requirements, bugs) - question

I’m using Deepstream SDK in Python. I read this link to understand how to set NTP timestamp with C++ application. However I’m interested in using this C API in Python. So I created a Python binding for this following this tutorial. Below is the code I added in src/bindfunctions.cpp to add a binding for the existing function configure_source_for_ntp_sync().

void bindfunctions(py::module &m) {
        m.def("configure_source_for_ntp_sync",
              &configure_source_for_ntp_sync,
              "gst_element"_a,
              pydsdoc::methodsDoc::configure_source_for_ntp_sync);

I built pyds wheel and installed it after making these changes. When I try to call the function configure_source_for_ntp_sync(uri_decode_bin) from the sample python application(deepstream-test3), with this way:

if file_loop:
        # use nvurisrcbin to enable file-loop
        uri_decode_bin=Gst.ElementFactory.make("nvurisrcbin", "uri-decode-bin")
        uri_decode_bin.set_property("file-loop", 1)
        uri_decode_bin.set_property("cudadec-memtype", 0)
    else:
        uri_decode_bin=Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")
    if not uri_decode_bin:
        sys.stderr.write(" Unable to create uri decode bin \n")
    # We set the input uri to the source element
    print(type(uri_decode_bin))
    pyds.configure_source_for_ntp_sync(uri_decode_bin)
    uri_decode_bin.set_property("uri",uri)

I’m getting the below error:

File "deepstream_test_3.py", line 185, in create_source_bin
    pyds.configure_source_for_ntp_sync(uri_decode_bin)
TypeError: configure_source_for_ntp_sync(): incompatible function arguments. The following argument types are supported:
    1. (gst_element: _GstElement) -> None

Invoked with: <__gi__.GstURIDecodeBin object at 0x7f0fff6fc200 (GstURIDecodeBin at 0x1b5c080)>

Please let me know how to add a binding for the C API configure_source_for_ntp_sync() in Python. Ultimately, I wanted to access the NTP timestamp of the frame from rtsp source in PYTHON.

Hi Team, Any lead on this please.

please refer to gst_element_send_nvevent_new_stream_reset , it has a GstElement parameter.

Able to create the python binding for the C API configure_source_for_ntp_sync() now following the above reference. Thanks for your help.

1 Like

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