Most people who stream enjoy using services such as Twitch.tv or Ustream to deliver video to viewers, and that works well enough. But sometimes you want some more control over your stream, or you want other people to be able to stream to you, or you want to stream to multiple places, or any number of things that requires you to have access to an actual RTMP stream from an RTMP server. This guide will cover the very basics of setting up a simple RTMP server on a Linux computer. Don't worry, it's not too complicated, but having familiarity with Linux will certainly help.
Anymix Media Server. Anymix Media Server is a free (as in 'free speech' and also as in 'free beer') Flash Media Server (FMS) or rtmp stremming server. Running in the MS Windows environment. How to install: From the zip: just unzip all the files into a directory you want then launch it. Its a portable and little FMS. RTMP Overwiew Live video streaming is something becoming more and more popular on the Internet and platforms like Twitch or YouTube provide a infrastructure to consume endless hours of live and recorded media. While these services provide a basic solution for free, they hold contents generally behind advertisements without a paid subscription. Nginx RTMP is an Nginx module which allows you to add RTMP and HLS streaming to your media server. Previously, the RTMP and HLS modules were seperate Nginx modules, but they can now all be added to Nginx as a single module. Our RTMP server ingest your stream and then encodes and sends it to HLS (HTTP Live Streaming) which then your viewers can watch it anywhere from desktops to mobiles. With our HTML5 Players. Live Streaming for live broadcasts, sport or church events with high quality. On-Demand Video Streaming, upload your videos with dynamic playlists. SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT/GB28181. Rtsp Simple Server ⭐ 1,305 ready-to-use RTSP / RTMP / HLS server and proxy that allows to read, publish and proxy video and audio streams Pingos ⭐ 640.
A couple things you can do with your own RTMP server that you might be interested in:
- Stream to multiple external channels
- Import other people's streams to incorporate for your own purposes (I use it in my casts for multiple camera angles, like in this video I did of a Tribes Ascend broadcast with multiple camera angles)
Step 1: Get a Server Box
Believe it or not, RTMP is actually extremely light on system resources. Essentially it just grabs data from the input and forwards it on to the output, simple data transfer. Don't believe me? My RTMP server for a long time was a Raspberry Pi, a $35 mini-computer, sitting under my desk, and it was capable of hosting at least 3 simultaneous streams, and I never even stressed it to see how many more it could handle. So I assure you, even a cheap old box would suffice.
If you don't have your own box, a VPS can also work. I recommend Linode or Digital Ocean as providers. Just make sure you have enough bandwidth...remember that bandwidth usage will be (the size of a stream) * (the number of people uploading + the number of people downloading). So when I have 2 streamers stream to my server, and I download both of them, I can chew up 10GB of bandwidth in 2 hours.
I recommend using Ubuntu for the server software for the sake of ease, but you can obviously use whatever you want. As long as you get the dependencies for nginx somewhere besides apt, you can follow this guide just fine.
Note to Windows users: This guide focuses on using Linux. If you want to use Windows, you can find Windows binaries for nginx with the RTMP module already included here: http://nginx-win.ecsds.eu/download/
Rtmp Server Pc
Note to Mac users: You can install nginx with the RTMP module via Homebrew: http://brew.sh/homebrew-nginx/If you are hosting your server in your home, you will have to forward TCP port 1935 to the box...this varies by router, so look up how to set up port forwarding for your router. Also, I recommend using a dynamic DNS service to overcome dynamic IP issues that come up with residential hosting.
Step 2: Installing nginx with RTMP module
Log into your box, and make sure you have the necessary tools to build nginx using the following command:
From your home directory, download the nginx source code:
Next, get the RTMP module source code from git:
$ unzip dev.zip
$ cd nginx-1.15.1
$ make
$ sudo make install
And to test to make sure nginx is running, point your browser to http://<your server ip>/ and you should get the 'Welcome to nginx!' page.
Step 3: Configuring nginx to use RTMP
Open your config file, located by default at /usr/local/nginx/conf/nginx.conf and add the following at the very end of the file:
This is an extremely basic configuration with a 'live' application that simply forwards the RTMP stream on to whoever requests it. You can play with it some more later. Here's the whole configuration guide, which shows you how to forward streams to other places (such as Twitch), save recordings of uploads, output stats, etc.
Restart nginx with:
$ sudo /usr/local/nginx/sbin/nginx
Your server should now be ready to accept RTMP streams! Let's try it out.
Create a new profile in OBS, and change your Broadcast Settings thusly:
Server: rtmp://<your server ip>/live
Play Path/Stream Key: test
You should now be able to start streaming to your server. If you hit 'Start Streaming' and don't get an error from OBS, that's a good sign.
So how do you watch it? The easiest way to do so is with VLC (v2.1.0 or later). Just Open a Network Stream and enter in rtmp://<your server ip>/live/test as the URL. If it all worked right, then you should now be seeing your stream in VLC!
You now have a working RTMP server! Congrats!
What now?
You can add the stream to OBS itself using the Media source or VLC source, or use something like JWPlayer to play back the RTMP stream on a web site you set up.
You can also use your RTMP server to forward to other streaming services and channels! Underneath the 'record off;' line in your nginx.conf, add the following:
FAQ
Q: Why nginx? Why not crtpmserver/Red5/Wowza?
A: I've tried crtmpserver (aka rtmpd) before, and it works, but is harder to use. If you need to use RTSP, though, instead of RTMP, then I recommend it, since the nginx RTMP module doesn't do RTSP. Red5 seemed overly complicated and heavy to me, and written in Java...you can use it if you want though. I haven't investigated it deeply. Wowza is not free. You can use what you like, but so far nginx is lightweight, easy to use, and free, so you're going to have to pry it from my cold, dead hands.
Rtmp Server C++
Q: How do I X?
A: This FAQ is still in progress...ask questions so I can add them here!
In this post we will show how Niostreamer can be installed in Windows. We will setup RTMP server, push MP4 video using ffmpeg and play in with ffplay.
Niostreamer is provided for multiple operating systems. It's cross platform. For now, the native package for Windows is in progress, so we will use Docker to run Niostreamer on Windows.
Rtmp Server Mac
First, Docker for desktop should be installed from official website
Download the Installer from here: https://desktop.docker.com/win/stable/amd64/Docker Desktop Installer.exe
Follow the steps provided by insteller to prepare Docker for Desktop:
Restart Windows after installation completed:
Create docker-compose.yml with the following content:
Run
You will see message in logs:
Register new account in https://niostreamer.com and open this link in you browser
You will see in logs that instance has been registered:
And then you will see the new instance in web panel as well:
Now Niostreamer is ready to accept incoming connections from RTMP clients.
Create RTMP virtual host
In instance overview page press 'Add Virtual Host' button
Enter virtual host and port and press 'Save'
To start virtual host the listener interface must be created. Open Virtual host page and press 'Add Listener'
Enter listening address and port and press 'Add'
Wait a little bit until instance is syncronized with control panel. You'll see the virtual host is started in streamer logs:
Niostreamer has opened TCP port 1935 and is ready to listen for incoming connections.
As a test stream we will use command line utility ffmpeg
. We will try to stream popular video sample used to test video streams called 'Big Buck Bunny'.
Start the command from your machine:
Streaming is started now. niostreamer started to receive audio video data. Let's play incoming stream using ffplay
utility:
You will see video window playing the target sample.
Rtmp Server
Niostreamer is a fully functional streaming server. It can convert incoming RTMP streams to other ones, i.e. HLS.
Rtmp Server
In next articles we will show how to stream RTMP to niostreamer and the share it as HLS to other players.
Enjoy!