NTP time of IP cameras
With an IP camera played through the Datastead RTSP/RTMP/HTTP/ONVIF Source filter, the NTP time of the video frames can be obtained in 100 ns units since 1970-01-01 (Unix epoch). The camera must send RTCP sender reports: no NTP time is available before the first one.
NTP time of the current frame:
- At any time, by invoking GetFrameInfo:
int64 NTPTime = VideoGrabber.GetFrameInfo (0, fi_NTPFrameTime) - Through the TFrameInfo structure pointer of the OnFrameBitmap event:
FrameInfo->NTPFrameTime - Through the OnNTPTimeStamp event, which occurs for each video frame delivered by the filter (UTCDateTime and LocalDateTime: the same time as TDateTime values).
NTP time of the first video frame of the current recording file, when the file is recorded by the filter (e.g. RecordingInNativeFormat = true):
int64 FirstNTPTime = VideoGrabber.GetFrameInfo (0, fi_First_NTP_time_Recorded)- This value is set again for each new file (RecordToNewFileNow included) and is 0 until it is known; it can be read from the OnRecordingStarted event.
Accuracy:
- By default, the NTP time is based on the reception time of the frames: it includes the latency of the camera encoder and of the network, and the arrival jitter.
- To compute it from the RTP timestamps of the frames (RFC 3550), without the network latency and the jitter, append
>ntpfromrtp=1to the URL, e.g.rtsp://192.168.1.20:554/stream1>ntpfromrtp=1
See NTP time of IP cameras in the documentation of the filter.
Note
- If the NTP server is configured on the IP camera, the typical time value should look like the current Unix epoch time.
- If the NTP server is not configured, the value may start from an arbitrary value, but the NTP time of the current frame minus the NTP time of the first frame received can still be used to calculate the current stream duration since the preview started.