Wednesday, October 25, 2017

Raspberry Pi Streaming Video Using Gstreamer

Hello Friend
Gstreamer allows you to stream video with very low latency – a problem with VLC currently.  The catch is that you need need gstreamer on the client used to view the stream.  gstreamer is a development framework not a media player and there isn't a way to stream so that common players such as VLC can display the stream (without users having to install complex plugins).  So, gstreamer can provide an excellent low latency video link, which is great if you are techy enough to set it up at both ends, but its no good if you want to directly stream so that Joe public can see the video on a web site for instance.

Setting Up The Raspberry Pi To Use gstreamer

You need to edit the sources.list file so enter:

sudo nano /etc/apt/sources.list

and add the following to the end of the file:

deb . main

Press CTRL+X to save and exit
Now run an update (which will make use of the line just added):
sudo apt-get update 
Now install gstreamer
sudo apt-get install gstreamer1.0

To Stream The Video From the Raspberry Pi
Enter this on the command line:
raspivid -t 0 -h 720 -w 1080 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=YOUR_RPI_IP_ADDRESS port=5000
Change YOUR_RPI_IP_ADDRESS to be the IP address of your  RPI.
To View The Stream
There's a lot of resources around for this.  Seems to be pretty easy on Linux, OK on a MAC and harder on Windows. Apparently streaming from RPi to PRi works really well.

Please Comment If You Face Any Problem