Problems minimizing latency and maximizing quality for rtsp and mpeg-ts.

We have a live streaming requirement to stream both rtsp (axis camera) and udp mpeg ts from another e ncoder. The application requires low latency and smooth scrolling of video, since users will be using ptz cameras.

For RTSP we are using the following pipeline:

rtspsrc location=rtsp:// latency=200 ! rtph264depay 
   ! h264parse ! queue  ! omxh264dec ! nvvidconv ! nvoverlaysink display-id=2 sync=true

With sync=false, we get jerky video. WIth sync=true and default latency, we get about 1 sec
delay. With both sync=true and latency=200 we get a good compromise. Setting the latency
too low results in jerky video.

For the mpeg-ts stream, the pipeline is similar:

udpsrc uri=udp:// ! tsparse set-timestamps=true ! tsdemux 
 ! h264parse ! queue  ! omxh264dec  ! nvvidconv ! nvoverlaysink display-id=2 sync=true

The video is smooth when using PTZ, but the delay is over a second, making positioning
the camera interactively difficult.

If we set sync=false, the latency is low but the video is very jerky when panning.

Unfortunately, there does not seem to be a latency parameter in any of the elments
in the mpeg ts decode pipeline that directly controls the latency of the video.

Is there anything we can adjust to minimize this latency.

Thanks in advance,


Hi Cary,
You can try if executing jetson_clocks helps:

sudo ./

Timestamps is totally handles in gstreamer frameworks and NVIDIA-developed omxh264dec does not give any private handling. Ideally HW decoder omxh264dec should bring you better performance then SW decoder avdec_h264.

Thanks DaneLLL,

We are using the omxh264dec.

The issue is that the video jerks when we pan the AXIS I/P camera from side to side when sync=false. When sync=true the picture is smooth but we get 2 second delay. How can we get low delay without jerkiness.

Thanks a lot,


Hi Unni,
Can you reproduce the issue with default camera? You can set up rtspserver with nvcamerasrc via test-launch.

It is easy to reproduce. All you have to do is decode a UDP transport stream. Do you have the capability?

Please share full steps of reproducing it with default camera. Besides, what is the delay with avdec_h264?

Delay is over 2 seconds when sync=true. The latency is acceptable when sync=false, except the picture jerks when the camera is moved from side to side.

We do not observe long latency in streaming with nvcamerasrc:

$ ./test-launch "nvcamerasrc ! video/x-raw(memory:NVMM),width=640,height=480 ! tee name=t t. ! queue ! nvoverlaysink overlay-x=50 overlay-y=50 overlay-w=640 overlay-h=480 t. ! queue ! omxh264enc ! video/x-h264,profile=baseline ! rtph264pay name=pay0 pt=96"


$ export RTSP_PATH=rtsp://
$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" latency=500 ! rtph264depay ! h264parse ! omxh264dec ! nvoverlaysink overlay-x=800 overlay-y=50 overlay-w=640 overlay-h=480 overlay=2

By setting latency=500, we see 500ms delay as expected.

how to change nvcamerasrc to my usb camera?


the omxh264 is giving the following error messages:
(gst-launch-1.0:9588): GStreamer-CRITICAL **: 06:25:03.264: gst_caps_fixate: assertion ‘GST_IS_CAPS (caps)’ failed

(gst-launch-1.0:9588): GStreamer-CRITICAL **: 06:25:03.264: gst_caps_get_structure: assertion ‘GST_IS_CAPS (caps)’ failed

(gst-launch-1.0:9588): GStreamer-CRITICAL **: 06:25:03.264: gst_structure_get_string: assertion ‘structure != NULL’ failed

(gst-launch-1.0:9588): GStreamer-CRITICAL **: 06:25:03.264: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed

I tried the nvv4l2decoder no critical messages, but slow.

Is there a better decoder to use?


For using nvv4l2decoder, please set enable-max-performance

$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" latency=500 ! rtph264depay ! h264parse ! nvv4l2decoder <b>enable-max-performance=1</b> ! nvoverlaysink overlay-x=800 overlay-y=50 overlay-w=640 overlay-h=480 overlay=2

Executing ‘sudo nvpmodel -m 0’ and ‘sudo jetson_clocks’ can run system in max performance and should also bring performance improvement.

Hi, what’s the different by using cv2.VideoCapture(‘rtsp://’)?
I try to compare fps, in v4l2 gstreamer is faster but in rtsp I can see the different.