NTP Timestamp in DeepStream
DeepStream 5.0+ supports the setting of NTP timestamps per frame. Calculated NTP timestamp is available in ntp_timestamp field of NvDsFrameMeta.
DeepStream calculates NTP timestamps in 2 ways:
Host system timeas NTP timestamp - when the frame is received by theNvStreamMuxplugin in the DeepStream pipeline.
This method requires you to synchronize host system to NTP clock.
To attach host system time as NTP timestamp, you’ll need to set attach-sys-ts to TRUE on nvstreammux.
Set the attach-sys-ts-as-ntp config parameter to 1 in [streammux] group of the application configuration file in the DeepStream reference app.
- NTP timestamp when attached at RTSP source - supported only if RTSP sources send RTCP Sender Reports (SR).
To configure the pipeline to attach these timestamps:
-
Set
attach-sys-tstoFALSEonnvstreammux. Set theattach-sys-ts-as-ntpconfig parameter to0in[streammux]group of the application configuration file in the DeepStream reference app. -
After creating an
"rtspsrc"element or an"uridecodebin"element, application must callconfigure_source_for_ntp_sync()function and pass theGstElementpointer to this API. (Refer tocreate_rtsp_src_bin()indeepstream_source_bin.cfile.) The API internally configures the pipeline to parse sender report and calculate NTP timestamps for each frame. -
Make sure RTSP source can send RTCP Sender Reports.
Verify this by starting streaming from the source on a host and viewing the packets in a tool like
wiresharkortsharkon the same host to confirm the presence of Sender Reports (SR).Example method to check if RTSP source sends RTCP sender reports using a tool like
tshark:We assume RTSP source has IP address
192.168.1.100-
Install tshark on a host:
sudo apt-get install tshark -
Find the host network interface that would be receiving the RTP/RTCP packets:
-
- Start the monitoring using
tsharktool. Replace the network interface and source IP as applicable:
-
On the same host, start streaming from the RTSP source only after starting the monitoring tool. Any client may be used:
$ gst-launch-1.0 rtspsrc location= <RTSP URL e.g. rtsp://192.168.1.100/stream1> ! fakesink -
The output of the
tsharkmonitoring tool should have lines containing"Sender Report Source description". Here is a sample output:6041 10.500649319 192.168.1.100 → 192.168.1.101 RTCP 94 Sender Report Source description