Rtmp Server

RTMP Overwiew

Rtmp

Like most servers, the RTMPMiniServer requires a dedicated IP address. Usually most studios are equipped with cable Internet and providers can give a dedicated IP without any issues. The main problem arises, if the studio, especially the mobile one, is connected to the Internet via a 4G / LTE connection. Download the RTMP server from here (2MB) and extract the zip file. Then double click on the “monaserver.exe”. A command prompt should pop up: 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): Replace “key” with some number.

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. To have full control over your contents and thanks to open-source solutions it is easy to configure an own live streaming server that uses the RTMP protocol.

Requirements

Hosting
  • You have an account and are logged into console.scaleway.com
  • You have configured your SSH Key
  • You have a virtual cloud server running on Ubuntu Bionic Beaver (18.04)
Rtmp server windows

Setting up the Server

1 . Log into the instance via SSH

2 . Update the apt sources lists and upgrade the software already installed on the instance:

3 . All required packages for the basic server configuration are available via APT. Install nginx and the required packages:

4 . Open the Nginx configuration file /etc/nginx/nginx.conf in a text editor:

And add the following lines at the end of the configuration file:

This sets up the live streaming server as well as recording of the streams. These will be stored in the directory /var/www/html/recordings of the instance.

Rtmp Server Iis

5 . Create the directory for recordings and make it writeable to the web server software:

7 . Open the file /etc/nginx/sites-enabled/default in a text editor and add a location block to the server configuration:

libnginx-mod-rtmp does not support authentication by default. To avoid that anybody knowing the stream key may broadcast media, copy / paste the following content into the server configuration block, under the server_name block, to setup a basic authentication mechanism. It will ask for a password when streaming. If the password is not correct, the user will see a 401 - Unauthorized message:

Replace a_secret_password with a secret password of your choice which authenticates against the server for broadcasting streams.

8 . Restart the Nginx web server:

Configuring the OBS Client

To broadcast a stream from a local computer to the streaming server, a broadcast system is required. Download OBS Studio, an open source broadcasting solution, which is available for Linux, Mac OS and Windows.

1 . In the Controls section of the Interface, click on Settings to enter the OBS configuration interface:

2 . Enter the Stream tab and enter the Information about your streaming instance: Server:

  • Service: Custom
  • Server: rtmp://<instance_ip>/live
  • Stream Key: your_stream?pwd=a_secret_password (replace your_stream with a custom name of your stream and a_secret_password with the password you have set in the Nginx configuration)

Save the configuration and setup your scene within OBS Studio.

3 . When ready, start broadcasting to your instance by clicking on Start Streaming in the Controls section of OBS.

Connecting to the Stream

The stream can be viewed in your favourite media player, for example VLC media player.

Rtmp Server Hosting

1 . Start VLC and click on Open Media

2 . Click on the Network tab and enter the URL of your Stream:

  • URL: rtmp://<instance_ip>/live/<your_stream>

3 . Click on Open and your stream will be visible in the media player.

Server

Setting up Multistreaming

Rtmp

It is also possible to rebroadcast a stream to platforms like Youtube, Facebook or Twitch to stream on multiple platforms at the same time.

1 . Open the Nginx configuration file /etc/nginx/nginx.conf in a text editor:

2 . Edit the file as required for the different streaming services that you want to use:

Rtmp Server Obs

It is possible to add additional applications in the same way as the examples above.

Rtmp Server Linux

3 . Restart Nginx to activate the new configuration:

Rtmp Server Twitch

4 . Start broadcasting from OBS. You can now either view your stream via a media player like VLC, but also from broadcasting platforms like twitch: