Humble Pi

This blog is for my own personal use on how to set up a Raspberry Pi to auto-boot straight into an incoming RTMP stream!

Raspberry Pi 2 Installation Guide Install Raspbian

For Screen and File Sharing on a Mac On the Pi:

sudo apt-get install netatalk

Now from the Mac, open Finder, and hit ⌘K. Enter afp:// (using the IP address of your Pi). On the Pi:

sudo apt-get install avahi-daemon
sudo update-rc.d avahi-daemon defaults

Now create a file /etc/avahi/services/afpd.service (as root):

sudo vim /etc/avahi/services/afpd.service

and add this content:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
   <name replace-wildcards="yes">%h</name>

Then run this command:

sudo /etc/init.d/avahi-daemon restart

You should now be able to see the Pi in the Finder sidebar.

Setting up vncserver

On the Pi:

sudo apt-get install tightvncserver

Enter an eight character password. Now do:

cd /etc/init.d
sudo vim tightvncserver

Add the following content to the file:

# /etc/init.d/tightvncserver

# Carry out specific functions when asked to by the system
case "$1" in
    su pi -c '/usr/bin/vncserver -geometry 1440x900'
    echo "Starting VNC server "
    pkill vncserver
    echo "VNC Server has been stopped (didn't double check though)"
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1

exit 0

(Change the geometry setting if your monitor is a different size.)

Now do:

sudo chmod +x tightvncserver
sudo pkill Xtightvnc

Check the VNC server is not running:

ps aux | grep vnc

Then do:

sudo /etc/init.d/tightvncserver start
cd /etc/init.d
sudo update-rc.d tightvncserver defaults

Finding your VNC server using Bonjour

[Source: Getting Started With Raspberry Pi] Create the avahi rfb service file:

sudo vim /etc/avahi/services/rfb.service

and add this content:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
  <name replace-wildcards="yes">%h</name>

Then run:

sudo /etc/init.d/avahi-daemon restart

Now you should be able to see the Screen Share option for the Pi in your Finder sidebar.

Update raspi-config

  • “sudo raspi-config”
  • Advanced Options > Update This

Update all packages

  • “sudo apt-get update”
  • “sudo apt-get upgrade”

Install Nginx with RTMP Module

Configure Nginx for RTMP

  • “sudo nano /usr/local/nginx/conf/nginx.conf”

REMEMBER! First line of config should read:

  • “user pi;” instead of:
  • “#user nobody;”

Then add to the bottom of the config:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

exec_push /usr/bin/omxplayer --live rtmp://;

                application live {
                        live on;
                        record off;

Start and stop Nginx

  • sudo /usr/local/nginx/sbin/nginx
  • sudo /usr/local/nginx/sbin/nginx -s stop

Edit rc.local for Nginx start-up at boot

OUTCOME: System automatically starts RTMP server at boot. RTMP Server (Nginx) detects incoming video stream via RTMP and sends data to the video player (OMXPlayer).

PROBLEM: OMXPlayer stops playing the incoming RTMP stream between 1-15 seconds, event hough RTMP incoming video has not stopped.

Things to try

Over clock?


Modest – NO AFFECT

Medium – NO AFFECT


Turbo – ?


Change GPU memory size?

Tried 64, 128 and 256. NO AFFECT

Named pipe?

  • “mkfifo /tmp/livestream”


  • “sudo apt-get install rtmpdump”
  • “rtmpdump -r rtmp:// –live -o /tmp/livestream | omxplayer /tmp/livestream”

About Mercian Media

My name is Alex, and I work in the Film and TV industry. I work freelance for various employers on several shows including Big Brother, Celebrity Big Brother, Sky News, Sky Sports, London Live, Bloomberg and QVC. All views are my own.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: