Streaming H264 using RaspberryPi camera

Viewed 5096

I am working on a project to build a robot using raspberry pi that will send video to android device, and will be controlled from it.
I decided to use the RaspberryPi camera (maybe usb webcam is better?). I want the video to be in H264 format, but I got problem in getting streaming in this kind of format. I tried using gstreamer and vlc:

  1. If I use vlc I get a very delayed video, and not smooth.
  2. If I use gstreamer I get a good video, but I don't know how to set a url to put in the android app code. I can see the video by running the gstreamer command in my pc. The commands I use are:

On the RaspberryPi:

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=192.168.1.102 port=5000

On my PC (to view the video):

gst-launch-1.0 -v tcpclientsrc host=192.168.1.102 port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

So first, my question is if there is any way to set a url to catch this gstreamer stream (or any other way to catch the stream in the android app code)?
Second, If you have any other advices, such as using a different camera, different format (not mjpg), different streaming way, etc.

5 Answers

I had a similar need and after many trials with vlc, gstreamer I solved using raspivid, nc (netcat) and the following android app:

https://github.com/ShawnBaker/RPiCameraViewer

it's probably not the best solution yest the source code is only partially open but it works and has a very short delay.

Related