I'm trying to set up a video conferencing system by using two Raspberry Pi boards.

How can I stream the H.264 protocol over a real-time streaming protocol via an Ethernet connection?

Which OS should I use to develop on the Raspberry Pi board?

  • nginx with rtmp-module is really decent but also CRTMPServer is very decent and stable. I managed to get sub 1 seconds delays with both solutions. Demonstrated in my book or partially on my blog – ppumkin Apr 3 '14 at 11:46
  • Check UV4L at linux-projects.org. It also supports H264 hardware-encoded video, realtime, full fps, minimal CPU usage. – prinxis Jan 14 '16 at 21:40

EDIT: This is not with RTSP but may help you

You can try with How to stream video and audio from a Raspberry Pi with no latency.

Install gstreamer1.0 on the Raspberry Pi video server:

  1. In /etc/apt/sources.list, add "deb http://vontaene.de/raspbian-updates/ . main"
  2. sudo apt-get update
  3. sudo apt-get install gstreamer1.0

Start streaming the video

  1. In the Raspberry Pi with command:

    raspivid -t 0 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=VIDSERVERIP port=5000
    

Start receiving video

  1. On your PC, type the command:

    gst-launch-1.0 -v tcpclientsrc host=VIDSERVERIP port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
    
  • You'll also need to install software on your client to get this working. On OS X: brew install gstreamer gst-libav gst-plugins-ugly gst-plugins-base gst-plugins-bad gst-plugins-good – ThomasW Mar 5 '15 at 19:09
  • 1
    This doesn't use RTSP. – Alistair Buxton Apr 15 '15 at 18:06
  • What technically this use? – Łukasz Zaroda Sep 16 '16 at 19:54

I posted a possible solution in raspberry forum using a simple RTSP server based on live555 that is fed with H264 V4L2 driver that you can find from github h264_v4l2_rtspserver

There is a custom source called nginx-rtmp - This works really well but you need to do quite allot of things before it works. It is awesome because it has allot of built in features and supports other streaming protocols, like HLS or embedding MPEG-DASH into websites, not just RTMP. It is extremely efficient in repackaging the video stream into flv or mp4.

Here is a blog post on how to get it working.

The only serious prerequisite is ffmpeg needs to be compiled on Rasbpian (Do not use the repo one it is slow) from the newest fork. I think on Arch it has the correct ffmpeg. This takes 5 hours on the Pi. Try and find a compiled version or use qemo to cross compile.

But in a nutshell using nginx 1.4.1 (you can try newer if you need to)

 cd /usr/scr  
 #clone the latest version of rtmp module for nginx  
 git clone git://github.com/arut/nginx-rtmp-module.git  
 #download nginx source tested with- 1.4.1  but 1.5.0 is also supported
 wget http://nginx.org/download/nginx-1.4.1.tar.gz  
 tar xzf nginx-1.4.1.tar.gz  
 cd nginx-1.4.1  

You need to get dependencies (check the link to the blog) for building and nginx. Then you configure the build inside the nginx source linking to the rtmp module. The build takes 10 minutes on the Pi.

 ./configure --prefix=/var/www \  
             --sbin-path=/usr/sbin/nginx \  
             --conf-path=/etc/nginx/nginx.conf \  
             --pid-path=/var/run/nginx.pid \  
             --error-log-path=/var/log/nginx/error.log \  
             --http-log-path=/var/log/nginx/access.log \  
             --with-http_ssl_module \  
             --without-http_proxy_module \  
             --add-module=/usr/src/nginx-rtmp-module \  

The latest version of Raspbian includes the UV4L driver that fixes the PSIPS (the time frame embedding for h264 that was broken in the original raspivid drivers.) So that should fix quite allot of streaming issues now.

Here's a recipe to get you started: Sending and receiving PI Camera video over the network

  • 1
    The first two lines in that article are how to stream video in command lines, which is ok, but not really robust and does not explain much what is going on with all the pipes! But the rest of the article doesn't really relate to the OP's question. Short, link based answers are also frowned upon. Consider enhancing your answer slightly. Downvotes can be converted into upvotes after you edited your answer. – ppumkin Apr 3 '14 at 11:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.