Search code examples
raspberry-pigstreamer

Gstreamer video stream has very high latency


I am trying to establish a video stream from my usb camera connected to a Raspberry Pi 3. I use a gstreamer pipeline but get a very high latency.

How do I improve my latency?

I have used the following pipeline to establish a video stream, it worked but the latency was around 5 seconds. gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=192.168.2.1 port=5600 In order to improve latency I tried to reduce quality, bitrate, framerate and resolution however the issue persists. The pipeline I tried was the following. gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=320,height=240,fps=10/1 ! videoconvert ! x264enc bitrate=250 qp-min=22 qp-max=28 qp-step=4 key-int-max=5 ! h264parse ! rtph264pay pt=96 ! udpsink host=192.168.2.1 port=5600 sync=false


Solution

  • I use tune=zerolatency and it does the trick for me (200ms latency):

    gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! \
    x264enc tune=zerolatency bitrate=250 ! rtph264pay ! udpsink host=192.168.2.1 port=5600