Hopp til innhold

This guide is based on an article to use nginx as an RTMP server. Also note that this guide has little to no focus on security. If you plan on using this for something critical or online you must secure your setup better then I do here.

What does it do?

When streaming there might be edge cases where you want to stream to a local server. This server can record incoming streams and have a simple webpage showing a youtube style video player. This server does not transcode the video and can not handle many concurrent viewers. But it can be made very small and simple. Stability might also be a problem.

The OrangePi Zero

OrangePi Zerois a tiny ARM based computer similar to a Rasperry Pi. It contains a quad core 1,2 Ghz ARM prosessor and 256 or 512 MB or RAM. It has one USB port, wireless and 100 Mbit wired ethernet. The reason I use this ARM computer is the size and price. An 256 MB version cost 7 dollars and an 512 MB version cost 9 dollars.

What will you need?


  • OrangePi Zero
  • SD card (4GB or more)
  • 5 Volt USB power supply (I have not seen the OrangePi use more then 500mA)
  • Free ethernet port on your router and internet connection
  • Ethernet cable


Flashing the image to the SD card.

put your SD card into your computer.

Download and unzip the Armbian image.

Install Win32 Disk Imager and run it as Administrator.

Choose the image file and drive that the SD card is connected to. Press write to start flashing the card. (Content on the SD card will be deleted in this process).

When the image is copied to the SD card. Unplug it and put it into the OrangePi Zero. Put in network cable.

Scanning for the OrangePi Zero on your network

before connecting power to the OrangePi Zero you should scann your network using Angry IP scanner. Run the scan and use "Tools - Selection - Dead hosts" to remove unresponsive IP adresses from the list.

depending on the size of your network you might get many IP addresses that are in use on your network.

Connect your OrangePi Zero to the network and give it power. Wait 1-2 minutes and open a new Angry IP Scanner. Redo the test.

If the OrangePi Zero has booted it should now have asked the network for an IP address and we can find it. In my setup it got the IP address

Connecting using Putty

To connect to the OrangePi Zero we use a program called putty. Install it and open it. input the IP address you found in the last step and connect.

You will be asked to accept that the computer you are trying to connect has a self signed certificate. this is just to say okay to.

The default username for Armbian OS is root. The password is 1234

At first logon you must change the root password and create a user account. Just follow the instructions given.

When the user account is created you can start imputing commands. I would start by rebooting the system. This will expand the partition used on the SD card. That way you can fit all the required software.


After restart you can connect again using putty. It is recommended to start by updating the OS. This might take some time. (Run each line of commands by itself)

apt-get update
apt-get update

Setting a static IP adress

It is almost always smart to use a static IP address when running a server. Armbian has a tool that can be used to set a static IP address. Find a free IP address in you network. It might also be smart to put it outside you DHCP's IP range.


choose "Edit a connection" and OK button

choose "Wired connection 2" and press Edit button.

Select "Manual" as shown above and select "Show" as seen below.

Input the IP address that you want your server to use.

When you input the IP address you must also input a subnet mask. My network is a or /24 network. Yours might be different. Here is a page showing conversion between the different formats.


Use putty to connect to your OrangePi using the new IP address.

Set time zone

The OrangePi Zero don't have a real time clock  it must therefor use a time server to get the right time. To set the time zone use the following command.

dpkg-reconfigure tzdata

Installing nginx with RTMP module

Nginx is a webserver that can run on simple machines like the OrangePi. First download dependencies.

sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

Before continuing it's recommended to switch to your own user (the one you created the first time you logged in). Close putty and start it again using your own username instead of root.

Start by downloading nginx. newest version can be found here.

wget http://nginx.org/download/nginx-1.11.13.tar.gz

Download the RTMP module for nginx

wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

Unzip both files into folders.

tar -zxvf nginx-1.11.13.tar.gz
unzip master.zip  

Enter the nginx folder and build it with the RTMP module

cd nginx-1.11.13
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
sudo make install

The installation is located at (/usr/local/nginx). Start nginx by typing the following command.

sudo /usr/local/nginx/sbin/nginx

You can now test the basic server by using your computers browser and typing in the IP address of you server.

sudo nano /usr/local/nginx/conf/nginx.conf 

Add the following to the end of the file.

rtmp {

        server {
                listen 1935;
                chunk_size 8192;
                buflen 5s;

                application live {
                        live on;
                        record off;

Exit nano (Ctrl x) and save changes.

This config is very simple. There is so much more that can be added. instructions on this can be found here.

Restart the nginx
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/ngin

You can now test the setup by getting your streaming software (OBS  (free) or X-split).

In the streaming software. Add a custom streaming server.

The URL rtmp://your servers IP/live (mine is rtmp://

Choose a Stream key, I just use "test".

Save changes and try starting your stream. No errors means it works.

To test the stream you can open it in VLC. select media and open network broadcast. input your servers address with the stream key. (mine is rtmp://

Autostart webserver on reboot


sudo nano nginx-passenger.sh

Insert the following command and save the file.


# this script starts the nginx process attached to passenger

sudo /usr/local/nginx/sbin/nginx

sudo chmod +x  /etc/init.d/nginx-passenger.sh
sudo update-rc.d nginx-passenger.sh defaults


CPU load

While testing the streaming system (with a 2,5mbit datastream) with one client wathing the server only uses 5-6 % of CPU and not much memory.

I believe this small server could service multiple clients but there might be problems with stability so testing is a must.

The picture above shows a simple streaming setup. You got a camera sending live video to a computer (you need a capture card in your computer or connected by USB). The streaming computer encodes the video (this takes a lot of computer power so an i5 or higher is recommended).
A datastream containing the encoded video is sent via your router to a Content Delivery Network. This could be Youtube live, Ustream or any other provider. The Content Delivery Network works like a relay and makes it possible for a viewer to watch your stream.


Notice on the picture above how we on the streaming side use upload speed while on the viewer side use download speed. Most internet connections are tailored for consumers downloading and not content creators like us that need a good upload speed. ADSL is a good example. It is typical that an ADSL line has a download speed of 10+ Mbit/s but only 1 Mbit/s upload. Getting an satisfactory  internet connection from the streaming venue is there for often the biggest problem you will encounter when streaming. Some places (like Norway where I live) using high-speed cellular connection might be the best and only possibility for getting the required upload bandwidth to stream 720p or higher at the venue.

Basics of Content Delivery Network (CDN)

We use a Content delivery network for multiple reasons but the most important is to be able to have multiple viewers at the same time without this overloading your own upload speed limit. The CDN is between you and your viewers and will take the load. If you have one or a thousand viewers makes no difference to you when it comes to the hardware or broadband connection requirements at the venue.

Beware that some CDN charge per hour streamed. So if you think that you will have many viewers then be sure that you have the right CDN.

To transcode or not to transcode

The CDN will work in one of two modes. Either they will transcode your data stream or they won't. Transcoding means that the video data stream is decoded to raw video and then encoded again before it is sent out to the viewers. Both modes have their flaws but the gist of it is as follows.

If your CDN don't transcode then all the viewers will have to watch the stream at the same bitrate and resolution as you are streaming in. This could be a problem if some of them have a slow internet connection. it would work out as shown on the picture below.

The good thing with not transcoding is that the delay between you streaming the live content and the viewer will be as close as possible. less then one minute in most cases.

If the CDN transcodes the video stream the delay will be longer. Dependent on the CDN this might be 2-3 minutes. This takes a lot more processor power for the CDN and for some providers this is therefor a function reserved only for paying streamers or streamers with high viewer count.

With transcoding the viewers can now choose what bitrate and resolution they want to watch the stream in. Especially if you are streaming in a very high bitrate or resolution transcoding is very important so that all your viewers independent of internet capacity can watch your stream.

When I broadcast I always use an external mixer. The main reason is that I find it it's much simpler to handle live then a software mixer running in the broadcast software. I also have a lot of opportunity to add different audio sources.This mixer is my main one for streaming Beringer xenyx X1204usb

This mixer is perhaps a bit overkill for most streamers but I like the faders.

When you mix with an external mixer you use a headset that has it's own volume knob on the mixer. then you use the faders and listen to the result. That way you can mix the sound without actually watching the mixer. You just rest your fingers on the faders and use your headset volume to guide your.

This is perhaps the best way to do mixing. the problem is that what you hear on your headphones might not be the same as goes out on the stream. If your headset volume is set to high in relation to the volume going out if your mixer then your watchers will have a bad day.
You will stand there thinking everything is play while your audience have to crank their stereos all the way up just to get a minimum of sound.

How to get this right?

I would never use a mixer that don't have a output volume level meter. My mixer uses a row of LED bulbs and it works fine for me. This must always be you reference when mixing live.

If you use your output volume meter first and then calibrate your headset volume knob while the output levels are right then you can use the headset as a guide for mixing. But if you change the headset volume you must check you row of LEDs again.

I would also recommend to listen in on the stream from a phone or separate computer so that you can be sure that the levels and content is the same as you are sending from your mixer.
This last part is perhaps even more important if you use a software mixer directly in your streaming software.

My setup is not very expensive and I was lucky because I had or could borrow most of the needed equipment for free. There is some drawbacks with my system but overall it works good and gives me a lot of bang for my buck.

Part 1 - The streaming hardware.

my setup consist of the following components.

  • Canon Legria HF R506 (VIXIA HF R500 in the US). cost around 299 dollars
  • Avermedia LGP lite USB capture card. Cost around 120 dollars (the card has some challenges with latency. If I was to buy a capture card today I would buy a USB3 card like the Magewell XI100DUSB-HDMI)  
  • Beringer xenyx X1204usb audio mixer. Cost around 180 dollars  
  • Sennheiser XS Wireless headmic set. Cost around 450 dollars
  • Laptop with i7 processor.  

Okay so the setup is quite expensive. But it is totaly possible to reduce the cost without redusing the quality of the stream.

Firstly the audio mixer is overkill. you could use any mixer that is half the cost or use a software mixer in you streaming software.

secondly I use a Sennheiser XS Wireless headmic set for my announcer audio. This set gives me the possibility to either have the announcer use two microphones (one for me and one for the venue speakers) or I can use the Wireless set directly on the venue audio mixer and fetch the announcers audio signal right from that. this part is a bit complicated but I will write about it at a later point. 

I have access to a good laptop but you could use a normal stationary computer. I would recommend i5 processor if you want to stream 1080p. 

basic layout

In this setup you can see the video signal in green and audio in blue. Note. The HDMI cable also carries the audio from the camera, but I chose in the software for the capture card not to use the sound that follows the HDMI cable. Instead I pull audio from the camera using a mini-jack cable and input it to my audio mixer. The mixer also has the sound from the announcers coming in. From the audio mixer I output the audio (with the levels I want) to a jack input on the capture card.

I use the audio input jack on the capture card to avoid getting audio / video sync problems. This is a common problem if you input you audio on a normal sound card input and video with the HDMI capture card.

Adding in the venue PA system

Earlier I said that I use the a wireless headmic set for my streaming. The main reason I do this is so I can place the streaming computer and camera in the best location for the camera (Since it uses HDMI for transfer of video the distance between camera and streaming computer is limited). in my setup I use an FX send port on the venue PA mixer to get the announcer audio but not other elements like music that is run out on the PA system. Most mixers got a AUX output, FX output or similar that allows the mixer to send both vocal and music to one output and only vocal to another output. 

The sound goes via the wireless transmitter / receiver to my streaming mixer. The good thing about this system is that the announcer only need one microphone and that i can locate the streaming computer / camera anywhere within the venue. But for every component you add to you setup you gain more sources for future problems. If you for instance have a dedicated stream announcer then you could use the first example and don't have to have anything to do with venue PA systems or wireless audio or nothing.

Part 2 - The computer network   

Venues often don't have descant internet lines. Or they won't lend them out. This is a problem that I hope will change in time. What I have done to get internet is to use a 4G router. It gives me fast internet speed and also gives me both wired ethernet and WiFi. I connect my streaming machine using wired ethernet to reduce the chance of frame drops. Scoreboard computers are connected to WiFi. This makes it very easy to get the scoreboard overlay into the streaming machine.

Using WiFi has worked good for us. But we are mostly at small venues where the signal is strong. If it was bigger venues or weekend long tournaments I would properly try to get everything on wired ethernet.

It is recommended that scoreboard machines are given a static IP address. It is also recommended to check for software update on all machines the day before the match. Especially new operating systems like windows 10 will download updates by it self. This is a problem if you have limited download / upload cap on your 4G router. Such updated will in some instances force the computer to restart. And that's not something you want happening mid match.

A few days ago I got to play with a venue audio system containing 10x2400 watt of amplifier power. It was daunting at first but by following some basic know how it worked out just fine.

A lot of larger amplifiers don't have a volume control. They are designed to be put in a rack and audio levels are controlled by a audio mixer. This audio mixer might have multiple outputs that can be separately controlled. By not having a volume knob on each amplifier you have full control on the audio mixer and you reduce the possible points of fault when you stand there and there is no sound. But having the amplifiers always on "full" is also a challange.

You know the sound when someone shorts the jack plug when they connects and disconnects a phone from a small amplifier. Think about 100 times as bad as that.

Never turn on the amplifier before it is connected to both speakers and audio source A.K.A audio mixer.

Turn down all level knobs on the audio mixer before turning it on.

This is the second big thing. When you set up your audio mixer you most likely have turned some knobs or faders in the mixer. Turn everything downn only exseption is EQ knobs that you set to 0 (middle position).

When everything else is powered on then I start the amplifiers. If you have a broken cable you might hear it right away, then you can shut down the amplifier in question and start faultfinding.  If everything is okay the you can put a audio source into your mixer. A microphone or MP3 player and slowly crack up volume.

If you can't get sound out on the speakers I would recommend that you turn down mixer volume before starting a search for faults.  If you need to switch cables from mixser to amplifiers then iI would turn off the amplifiers before doing anything.

When iI got to play with the amplifier rack on the picture above it was already connected to speakers. The amplifiers was connected together by an elaborate system. This reduced my workload a lot. And I could connect to the system in minutes instead of hours or days if things had been non functioning.

If you are using the venus audio system. If possible get a walk-true or possibility to test the system before match day.

In the beginning I talked a bit about the amplifiers being set to "full" with no individual volume control. If you get any problems with your audio signal going to the mixer. perhaps that you have a bad cable or maybe that the cable absorbs noise from external sources. There is some things you can do to avoid this.

If you have anymore then a few meters from the mixer to your amplifier you should user a balanced cable. These will reduce the amount of noise a lot at the same time as they help you get a low signal loss on the cable. 

Avoid laying audio and power cables close to each other. Especially if you use dimmers for lights and these cables get anywhere near audio cables you will have a bad day. The important thing is not allowing the cables to lie side by side. 

If you need to cross power and audio cables. do so at a 90 degree angle. That way you get as little noise as possible. 

Test lighting with audiosystems on (also microphones). That way you can see if there is any noise going from the lighting to the audio system. Espesially old light dimmers will make a lot of noice.