Latency using Deepstream / Python

|•|Hardware Platform (Jetson / GPU)|. Jetson Xavier 8GB, Xavier NX and TX2
|•|DeepStream Version| 5DP
|•|JetPack Version (valid for Jetson only)| 4.4DP
|•|TensorRT Version| 7.1

I am looking for the way to achieve the lowest latency possible. I am current at 110-130ms for all platforms (Xavier, NX, TX2), this is via USB webcam and nearly identical for CSI camera as well. This is using the sample apps.

Using Deepstream with Python bindings the latency is generally 170-190ms.

I would like to know where the latency is coming from so I can try and reduce it. I found this thread: Latency measurement issue

If this is the best method, it would be great to have a little more detailed steps to get the info. Also, how would I get that info using deepstream with the python bindings?


I am testing latency time with two methods, recording a timer with the camera and then taking a photo of both screens. Also, recording the camera and display with a high speed camera (1000fps) then counting the frames it takes to see movement on the screen after moving the camera.

If your source is RTSP source, you can use

For achieving best performance:

  1. Run sudo nvpmodel -m 0 and sudo jetson_clocks
  2. Enable the property in nvv4l2decoder:
  disable-dpb         : Set to disable DPB buffer for low latency
                        flags: readable, writable
                        Boolean. Default: false
  enable-max-performance: Set to enable max performance
                        flags: readable, writable
                        Boolean. Default: false

  1. Enable the property in nvv4l2h264enc(or nvv4l2h265enc):
  maxperf-enable      : Enable or Disable Max Performance mode
                        flags: readable, writable, changeable only in NULL or READY state
                        Boolean. Default: false

Ideally this would be for a USB source, does this still apply? Also, the previous numbers are all in power mode 0 and with jetson_clocks already ran.



You can try to set maxperf-enable in nvv4l2h264enc. The source may give certain latency and you can check if there is property which can be set to give lower latency.