Close

Quick update about real time streaming using gstreamer

A project log for Raspberry Pi Zero W surveillance camera

I needed a camera to take pictures at 10s intervals and I put together something that costs about £30 and gives me full control

adria.junyent-ferreadria.junyent-ferre 04/18/2020 at 16:560 Comments

The commands I posted in the description of the project work perfectly fine; however, when attempting to stream the video from the camera for a real-time application (e.g. controlling a small vehicle via FPV) I found that piping the output of rapivid into gstreamer added a bit of latency. A much better option is to use the rpicamsrc. This can be obtained from the git page of the project: https://github.com/thaytan/gst-rpicamsrc

A winning formula that does UDP streaming is the following:

On the Raspberry Pi side:

gst-launch-1.0 rpicamsrc preview=false !  'video/x-h264, width=800, height=600, framerate=30/1' ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! udpsink host=YOUR_PC_IP port=5000

On the PC side

gst-launch-1.0 udpsrc port=5000 ! gdpdepay ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink sync=false

 Start the script on the PC side before running the command on the Raspberry Pi.

I still have to figure out a robust way to handle issues with the connection and restart the video once the link betwen the two works.

Discussions