Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Issue with timestamp in rtsp stream (in combination with plugin)

Answered

Comments

4 comments

  • Permanently deleted user

    If the metadata arrives after the frame was shown, the Desktop client still shows the bounding box, but in archive mode, this delay should go away.

    Can you please check:

    1. Do you see the same delay when you watch archive video?

    2. What latency does your pipeline introduce?

     

     

    0
  • Norman
    • Network Optix team

    Hi @...,

    Just checking in to make sure you received our response as it has been a while since we have heard from you. Please let us know if you still need help by responding to this message.

    0
  • Permanently deleted user

    Hi,

    sorry for the late reply, I have been really swamped with other projects the past weeks (and still). I did not find the time to do a deeper analysis, but tried to get the information to answer your questions.

    1. In Nx meta client, I always see some delay between moving in front of the camera, and the live feed in the Nx meta client. Since my issue is with a mismatch between the timestamp I get from the rtsp stream, and the timestamp the meta-information is shown on, I also did the processing on archive footage (request an rtsp stream from a few minutes ago instead of the live feed). There I still see a delay between the bounding box shown in the client, and the video footage. So, when I use a face detector and I move my head from left to right, the bounding box is always a little behind (more or less 1.5 seconds). Does that answer your question?

    2. Currently I use a face detector for my experiments. On GPU in runs at around 10fps. The overhead of retrieving the frame and sending the meta-information over zmq seems negligible (a few milliseconds). 

    Best regards

    0
  • Andrey Terentyev
    • Network Optix team

    Hello Floris,

    Which version of Nx are you using?
    > Any idea where the 1.5 second synchronization mismatch could come from?

    > Although the timestamp comes from the stream, there is still a small delay on the metadata in comparison with the overlay shown in the Nx client (more or less 1.5 seconds). For this experiment I run a face detection model on a network camera on my desk (easy for experiments)

    This delay most definitely is introduced by your plugin/model. I'll try to explain possible root cause.

    In version 4.1 there is a special dynamic buffer with the max delay of 2 seconds. The Server waits a metadata from a plugin for this period of time in order to write the metadata just next to the frame it belongs to. Nevertheless, the timestamp should not change in that case neither, excepting the case when a plugin changes the timestamp explicitly for some reason.

    In other words, when a plugin gets a frame from the Server, the timestamp is already set by the Server. A plugin should not change frame's timestamp.

    In your scenario, you have to make sure your system reads by PyAV the timestamp of the same frame it is actually processing.

    Let's consider an example.

    At the moment of time T0 the Server sends a frame with the timestamp TS0 to RTSP stream.
    At the same moment the Server pushes the same frame to the plugin for processing.
    It does not matter if your plugin does not actually process the frame, the frame is pushed with the timestamp TS0 set.
    That means the pushUncompressedVideoFrame or pushCompressedVideoFrame returns immediately making the Server wait for some time before writing the frame to the stream and sending to GUI.

    Your system receives the frame at the moment of time T1=T0+delay1 = TS0+delay1
    Your system processes the frame and sends the metadata to the plugin at the moment of time T2 = T1 + delay2.
    This metadata should contain the timestamp value of TS0.
    Your plugin receives the metadata at the moment of time T3 = T2 + delay3 = TS0 + delay1 + delay2 + delay3.
    Your plugin should pass to the Server the metadata with the timestamp value of TS0. If it's done within max 2 sec the metadata is written next to the frame it belongs to and both are sent to GUI.

    > Currently I use a face detector for my experiments. On GPU in runs at around 10fps. The overhead of retrieving the frame and sending the meta-information over zmq seems negligible (a few milliseconds).
    Taking this into account, I'd suppose there is a kind of bug inside your plugin code (or inside the external system code) setting the wrong timestamp.

    0

Please sign in to leave a comment.