Example of low-latency playback with with gst-launch-1.0 to play RTSP video stream with hardware acceleration (please replace the RTSP address with yours):
gst-launch-1.0 rtspsrc location=rtsp://169.254.160.104:554/av0_0 latency=0 drop-on-latency=true max-size-buffers=0 ! decodebin ! nvoverlaysink sync=false -e
Similar low-latency gstreamer pipeline can be used with OpenCV, for example:
import cv2
camera = cv2.VideoCapture("rtspsrc location=rtsp://169.254.160.104/av0_1 latency=0 drop-on-latency=true max-size-buffers=0 ! decodebin ! nvvidconv ! video/x-raw, format=I420 ! appsink sync=0", cv2.CAP_GSTREAMER)
If video playback is laggy, you can use jtop to check if NVDEC (hardware video decoding) is used. If not then something is wrong. As far as I know, all browsers use software video decoding, so you cannot use them if you want low latency, especially at high resolution.
Alternatively you can use mpv with enabled hardware video decoding (you can either install prebuilt deb files or build yourself). Version of mpv in Ubuntu 18.04 does not support low-latency profile, so I had to use the following options to achieve the best best latency (within 0.1-0.2s range depending on IP camera and stream resolution):
mpv --no-cache --audio-buffer=0 --vd-lavc-threads=1 --cache-pause=no --no-audio --demuxer-lavf-probe-info=no --demuxer-lavf-analyzeduration=0.0 --video-sync=audio --interpolation=no --keep-open-pause=no --untimed --rtsp-transport=tcp rtsp://192.168.1.10/1