Local RTMP Stream Server

Area for discussing streaming over the Internet, especially as it relates to ATV
Forum rules
This forum is run by the BATC (British Amateur Television Club), it is service made freely available to all interested parties, please do not abuse this privilege.

Thank you
Post Reply
Posts: 36
Joined: Tue Oct 31, 2017 2:47 pm

Local RTMP Stream Server

Post by gi7ugv » Mon Jul 01, 2019 10:37 pm

I've been using a local RTMP streaming server for a while now to allow me to send video from my mobile phone camera both locally on the network to the likes of OBS and other devices and for sending video in remotely over the cellular network allowing me to walk about the garden sending video to OBS out of WiFi range. I've also got a number of subnets configured locally which complicates things a bit so I can't easily use multicast or things that only work in a local network.

My main use is using the good camera in the mobile phone to stream in to the RTMP server, and any clients like OBS/VLC/ffmpeg etc can connect to the RTMP server to obtain the video.

It's simple enough to set up an RTMP server using NGINX in Linux and it doesn't take up much in the way of resources and runs fine on a Pi while it's doing other stuff. I've been using an NGINX RTMP server on a Pi whilst it is taking the input and sending to ffmpeg and out over SDR.

The quickest way to run one in Linux would be to use Docker. With docker installed the following will download and run an image and make the RTMP service available on

Code: Select all

docker run -d -p 1935:1935 --name nginx-rtmp tiangolo/nginx-rtmp
You can then configure your mobile application to stream to rtmp://<ip address>/live/<streamname> and the stream will be available to add in to OBS/VLC/ffmpeg etc with the same URL.


While you could port forwarding to port 1935 from the Internet to allow you to stream in remotely, it would mean that anyone can connect to it. If you want to do this it would be better to use an alternative NGINX configuration file with some more secure options or obscure stream names.

You could do the like of this if you wanted to keep working with Docker, but it might be as easy to install it locally instead.

Code: Select all

git clone https://github.com/tiangolo/nginx-rtmp-docker.git
cd nginx-rtmp-docker/
< Edit nginx.conf to change the application from live to something obscure, or require auth or something else >
docker build -t nginx-rtmp-altered .
docker run -d -p 1935:1935 --name nginx-rtmp-altered nginx-rtmp-altered 
For the iPhone there are a lot of applications that allow you to stream video using RTMP but one of the more configurable free ones is Larix which lets you configure multiple destination sources (could point it to your BATC RTMP streamer URL) and video options, there will be plenty for Android too.

Image Image
Last edited by gi7ugv on Mon Jul 01, 2019 10:50 pm, edited 2 times in total.

Posts: 36
Joined: Tue Oct 31, 2017 2:47 pm

Re: Local RTMP Stream Server

Post by gi7ugv » Mon Jul 01, 2019 10:47 pm

As mentioned you could also install NGINX with the RTMP module locally on any Linux system. It runs no bother at all on a Pi without using much CPU at all.

Code: Select all

apt-get install -y curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev

mkdir nginx_src
cd nginx_src
git clone https://github.com/arut/nginx-rtmp-module.git
wget http://nginx.org/download/nginx-1.16.0.tar.gz
tar -zxvf nginx-1.16.0.tar.gz
cd nginx-1.16.0/
./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=../nginx-rtmp-module
sudo make install
If the configure fails on Raspbian with "cc1: all warnings being treated as errors", add --with-cc-opt="-Wimplicit-fallthrough=0" to the ./configure line.

Edit the /etc/nginx/nginx.conf file to remove the http section to disable the http service on port 80 and possibly alter the application name if you like to change the default URL, a very basic configuration could be:

Code: Select all

worker_processes auto;
rtmp_auto_push on;
events {}
rtmp {
    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;

        application live {
            live on;
            record off;

Post Reply

Return to “Streaming”