How can we further reduce the latency for RTSP streaming(sub 100ms)? Pipelines given

Hi,

How are we able to further reduce the latency of live streaming to 100ms or less(<0.1sec)?Currently, we are getting about 160-200ms latency(0.16~0.2s). These are the streaming codes we use:
Server;

./test-launch "nvarguscamerasrc ! 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"

Receiver :

gst-launch-1.0 rtspsrc location="rtsp://10.50.14.2:8554/test" latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink overlay-x=800 overlay-y=50 overlay-w=640 overlay-h=480 overlay=2

Also, I understand that lowering the resolution helps with the latency but I need a decent sized window for my project. Thank you!

Thank you!!

Also guys, how do I change the encoder and decoder to h265? I tried just changing the h264 to h265 but I got some errors

Hi,
In running Jetson Nano + RaspberryPi camera v2, glass to glass latency is ~0.1 second.

$ gst-launch-1.0 nvarguscamerasrc ! nvv4l2h265enc maxperf-enable=1 ! h265parse ! nvv4l2decoder ! nvoverlaysink

External Media
But in RTSP streaming, it is ~1.4 second.

./test-launch "nvarguscamerasrc ! nvv4l2h265enc maxperf-enable=1 ! h265parse ! rtph265pay name=pay0 pt=96"

External Media

Looks like most latency is from network. Not sure but there might be parameters in rtph265pay that you can tune to get lower latency. For this we are not able to suggest further. Need other users to share experience. Or you may go to
http://gstreamer-devel.966125.n4.nabble.com/

1 Like

Hi DaneLLL,

Thank you for taking the effort to help throughout my project!

Upon further research, I found that h265 offers better efficiency. I changed the code to inclue h265 :

./test-launch "nvarguscamerasrc ! 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 ! omxh265enc ! video/x-h265,profile=baseline ! rtph265pay name=pay0 pt=96"

and receiving :

gst-launch-1.0 rtspsrc location="rtsp://10.50.14.2:8554/test" latency=0 ! rtph265depay ! h265parse ! avdec_h265 ! autovideosink overlay-x=800 overlay-y=50 overlay-w=640 overlay-h=480 overlay=2

I tried the change the h264 to h265 but I got unhandled error at my receiving end. How can I rectify this? I used many different decoders and encoders but I skipped nvv4l2enc as the there is a known issue with it when using gst rtsp test server.

Additional info,

0:00:01.443569543 30432 0x5634ef79e4f0 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Unhandled error
0:00:01.443596373 30432 0x5634ef79e4f0 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Service Unavailable (503)
0:00:01.443624309 30432 0x5634ef79e4f0 INFO        GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<rtspsrc0> posting message: Unhandled error
0:00:01.443685616 30432 0x5634ef79e4f0 INFO        GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details:<rtspsrc0> posted error message: Unhandled error
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unhandled error
Additional debug info:
gstrtspsrc.c(6161): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Service Unavailable (503)
0:00:01.443752756 30432 0x5634ef79e4f0 WARN                 rtspsrc gstrtspsrc.c:7548:gst_rtspsrc_open:<rtspsrc0> can't get sdp
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
0:00:01.443775403 30432 0x5634ef79e4f0 WARN                 rtspsrc gstrtspsrc.c:5628:gst_rtspsrc_loop:<rtspsrc0> we are not connected
0:00:01.443786976 30432 0x5634ef79e4f0 INFO                    task gsttask.c:316:gst_task_func:<task0> Task going to paused
0:00:01.443794359 30432 0x5634ef543c00 INFO              GST_STATES gstbin.c:2506:gst_bin_element_set_state:<autovideosink0> current READY pending PAUSED, desired next PAUSED

This is the debug code error I got

Hi,
Please check profile in hevc:

You may try ‘profile=main’