Improved gstreamer receiver code

Continuing the discussion from Gstreamer pipeline in OpenCV multiple camera:

I was trying out the gstreamer receiver code provided by @ryan354 in the above link, and found that the h264 receiving has a bit more latency than QGC’s display. I went searching for what’s actually used in QGC and found the VideoReceiver README which has an explicit h264parse between depaying and decoding. I couldn’t actually get the QGC README version to work because my gstreamer didn’t like the caps string, but combining the two options gives

gst-launch-1.0 -e -v udpsrc port=5600 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink fps-update-interval=1000 sync=false

which for me ran successfully, and with the same low latency as QGC.

Hope this is useful to someone else :slight_smile:

2 Likes

As a follow-on, if streaming through OBS Studio instead of directly from the command-line, the jitterbuffer also adds some latency (although seemingly it doesn’t add latency on the command line, at least on my work windows machine).