Home GoPro How to setup a RTMP streaming server on Raspberry Pi (e.g. for GoPro cameras).

How to setup a RTMP streaming server on Raspberry Pi (e.g. for GoPro cameras).

1
How to setup a RTMP streaming server on Raspberry Pi (e.g. for GoPro cameras).


This article describes how to setup a RTMP streaming server on the Raspberry Pi. The streaming server can then be used to stream from multiple sources, such as GoPro cameras. At the end of the article we have linked a YouTube video which shows the whole process.

Prerequisits

 

Setup

As a first step we have to update the packages and install the nginx webserver. Therefore open a terminal on the Raspberry Pi and copy and paste the following lines:

sudo apt-get update
sudo apt-get install nginx libnginx-mod-rtmp

 

If you are running a web server on your Pi (for instance an Apache instance) then the following lines can be used for deactivating the nginx web server which listens on port 80 (generally you can just copy and paste the lines into the terminal):

sudo rm sites-enabled/default
sudo systemctl start nginx.service
sudo systemctl status nginx.service

 

Next we configure the RTMP server. Therefore we create a new file “rtmp.conf”:

sudo nano /etc/nginx/rtmp.conf

with the following content:

rtmp {
  server {
    listen 1935;
    chunk_size 4096;
    application live {
      live on;
      record off;
    }
  }
}

 

Then we tell the nginx configuration about the RTMP file by modifying the “nginx.conf” file

sudo nano /etc/nginx/nginx.conf

with the following line (the location in the file is not important):

include /etc/nginx/rtmp.conf;

 

Then we restart the nginx server:

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl status nginx.service

 

Finally we can check if everything is correctly setup:

netstat -an | grep 1935

The command should return a single line indicating that the server is listening at port “1935” (red letters).

 

The RTMP server is now ready for receiving streams. The RTMP url looks like this (the IP address has to be replaced with your IP address):

rtmp://192.168.1.105/live/key

 

You can use a different string instead of “key”. Each “key” represents a new video stream. For instance, the following two urls represent two live streams:

rtmp://192.168.1.105/live/1
rtmp://192.168.1.105/live/2

 

You can use the Live Streamer for GoPro Heros app, which is also available for the Raspberry Pi, if you want to live stream from GoPro cameras.

 

The whole setup process is also shown in the following video:

1 COMMENT

  1. 3 times tried this install methjod, everytime it gets stuck on the sudo systemctl start nginx.service command

    response is

    Job for nginx.service failed because the control process exited with error code.
    See “systemctl status nginx.service” and “journalctl -xe” for details.

    whats going on?

LEAVE A REPLY

Please enter your comment!
Please enter your name here