Raspberry Pi camera board – Gstreamer

So, my Raspberry Pi camera board has arrived and I have started playing with it.

Raspberry Pi camera board

My first impressions were tiny, super cheap camera. Its low light capabilities are not great but I can live with that. The important bit is the quality, full 1080p at 25 frames per second (UK). That on its own is pritty awesome.

I was though only really interested in getting the pi to work remotely for my robot to replace the 3-4 fps standard def USB webcam I currently use. Currently though with the camera, there is no V4L driver so we have to make do with their provided applications then pipe it out to streaming applications. Their recommended method is slow and very laggy (netcat and mplayer with wifi provides 3-6 seconds of lag). So I had to find another option. I happened to be sitting on the #raspberrypi IRC on freenode and heard a user having success with gstreamer. So this is how to set up gstreamer to stream HD video with less than 0.5 seconds of lag.

First we need to add a repositary with gstreamer1.0

 

nano /etc/apt/sources.list

 

and add to the end

 

deb https://vontaene.de/raspbian-updates/ . main

 

Then do an sudo apt-get update

next grab gstreamer

 

sudo apt-get install gstreamer1.0

 

 

On your recieving end you will also need gstreamer. Because I mainly use a mac, I decided to get it working on the mac so with help from arcanescu on IRC, we figured out how to get it working on mac os (10.8)

The simplest way is with brew, a package manager like apt-get, but for mac os. To install it run this in terminal on your mac simply run

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

It will grab and install brew. Now update it with

 

brew update 

 

Now we need to grab gstreamer

 

 brew install gstreamer gst-libav gst-plugins-ugly gst-plugins-base gst-plugins-bad gst-plugins-good 

 

Once that installs you should be good to go. Enter

 

 raspivid -t 999999 -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-PI-IP-ADDRESS port=5000 

 

on your raspberry pi and enter on your mac

 

 gst-launch-1.0 -v tcpclientsrc host=YOUR-PI-IP-ADDRESS port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false 

 

The picture quality is good but I see a number of flickers which isnt a problem for me, if it is for you, maybe try adjusting the resolution

 

So thanks again to arcanescu, I take no credit for this as it was him that came up with this, if you ever see him in IRC, give him a virtual pat on the back

Sumber: https://www.skiews.com/raspberry-pi-camera-board-gstreamer/

Leave a Reply