# Latency using Deepstream / Python

**URL:** <https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692>\
**Category:** DeepStream SDK\
**Created:** [May 25, 2020, 3:44am UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692 "2020-05-25T03:44:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scbean](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@scbean](https://forums.developer.nvidia.com/u/scbean)\
**Post date:** [May 25, 2020, 3:44am UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692/1 "2020-05-25T03:44:35Z")

</div>

|**•|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](https://forums.developer.nvidia.com/t/latency-measurement-issue/122812)

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?

Thanks!

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.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 25, 2020, 7:32am UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692/3 "2020-05-25T07:32:26Z")

</div>

Hi,  
If your source is RTSP source, you can use

> [@Latency measurement issue](https://forums.developer.nvidia.com/t/latency-measurement-issue/122812/5):
>
> please noted it’s for rtsp stream or rtsp camera only, not for local file.

For achieving best performance:

1. Run _sudo nvpmodel -m 0_ and _sudo jetson\_clocks_
2. Enable the property in _nvv4l2decoder_:

```auto
  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_):

```auto
  maxperf-enable : Enable or Disable Max Performance mode
                        flags: readable, writable, changeable only in NULL or READY state
                        Boolean. Default: false

```

---

<div class="post-metadata">

**Author:** ![scbean](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@scbean](https://forums.developer.nvidia.com/u/scbean)\
**Post date:** [May 25, 2020, 6:27pm UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692/4 "2020-05-25T18:27:42Z")

</div>

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.

Thanks!

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 25, 2020, 11:10pm UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692/5 "2020-05-25T23:10:07Z")

</div>

Hi,

> [@scbean](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:17pm UTC](https://forums.developer.nvidia.com/t/latency-using-deepstream-python/124692/8 "2021-10-12T16:17:43Z")

</div>


