Technical blog / News / Releases

Instance variables

In Niostreamer version 0.3.0 we implemented a new useful feature called "Variables".

Now you can define a couple of values that can be re-used across you streaming instance settings.

How it looks like

There are two kinds of variables: user variables and system (or protected) vars.

User variables are defined using web control panel.

System variables are defined on the machine where Niostreamer installed. They are availably only to this instance locally, the values are not transferred to control panel.

Variables are located under "Variables" section of the corresponding instance:
chrome_TtrNQ2gDDS

On the above screen we can see that my.user.variable is a regular variable that has value and defined through control panel by user.

The ssl.default.certificate_file and ssl.default.certificate_key_file are defined on a Niostreamer side. They are located in /etc/niostreamer.conf (or whatever path where the config is located). The config in that case looks like:

server {
    ...

    vars {
        ssl {
            default {
                certificate_file = "/etc/ssl/niostreamer/ssl/cert.crt";
                certificate_key_file = "/etc/ssl/niostreamer/ssl/cert.key";
                certificate_password = "";
            }
        }
    }
}

System variables can be defined using hierarchy or in flat mode. The above example is equals to the following one:

server {
    ...

    vars {
      ssl.default.certificate_file = "/etc/ssl/niostreamer/ssl/cert.crt";
      ssl.default.certificate_key_file = "/etc/ssl/niostreamer/ssl/cert.key";
      ssl.default.certificate_password = "";
    }
}

Why do we need this?

The common idea is simple: good expirience and security. System variables are not available on a web control panel side, their values are not pushed by niostreamer instance to control panel at all, only the names are.

So, when you need to hide some secret points like password from SSL certificate when you setup a SSL network listener you can always use placeholders in favor of actual values.

To use variables in control panel you can type "{{ " (brace brace space) and select the coresponding var from popup list of suggestions:

chrome_TKTiveUgXw

User variables values will be resolved when sending settings to niostreamer, and System variables will be sent as placeholders and will be resolved on Niostreamer instance side.

In next posts we will talk about SSL SNI feature where it would be useful.

Enjoy!

Setup RTMP application for live streaming

In latest Niostreamer release 0.2.4 we implemented a couple of new features.

In this article we will talk about application concept. We will describe what is the application itself and how it can be setup in Niostreamer using control panel.

Applications is a main part of streaming. It's abstraction level to tune settings for different streaming scenarios in the same instance of Niostreamer. There is a couple of settings you can set up, in this article we show how protocols can be enabled for different applications.

When Niostreamer is up and running you can stream over RTMP/RTSP protocols to it. Those protocols are converted then into HLS/MPEG-DASH protocols. Also you can play the incoming stream over RTMP.

The incoming RTMP eendpoints can be looked like this:

rtmp://1.2.3.4:1935/my-live/my-stream-123

The pattern is:

rtmp://[niostreamer-ip]:[rtmp-port]/[application-name]/[stream-name]

The parameters are as follows:

  • niostreamer-ip is a public ip address of niostreamer instance
  • rtmp-port is a port for RTMP protocol set in control panel
  • application-name name of application for this scenario
  • stream-name an arbital name of stream

To start streaming to rtmp://1.2.3.4:1935/my-live/my-stream-123 you MUST create a protocol handler for RTMP that will ba available on 1.2.3.4:1935 TCP port and create an application with the name my-live.

Create protocol handler

Protocol handler enables user or broadcaster to start video streaming into the specific port using corresponding protocol.

One protocol handler can have many ports enabled.

Open a streaming instance page we want add protocol handler to:
FoHcZZzzFM

Then go to Protocols section and click "Add protocol handler" button
9yGQfSotIB

In dialog select "RTMP" protocol and enter arbital name for this handler
5ywKHxl7ms

Once added open protocol handler page:
chrome_TbeAtrzt3e

Click "Add network interface"
chrome_UuidVwuK5j

In opened dialog enter listening ip address "0.0.0.0" and port "1935":chrome_ZD7a9VQMmQ

We're done! Now we have new RTMP handler that listen for RTMP streams on all interfaces and port 1935. You can add many listeners or many different handlers:
chrome_nKMNMlKBD1

Create application

Open instance page and then open "Applications" section:
sZThkvazWD

Click "Add Application" to open dialog:
k3j6irhvMB

In the dialog appeared enter application name and enable protocols you need. In this example we enable only RTMP as we are not going to convert (transmux) RTMP streaming packets to HLS or MPEG-DASH protocols. You can also enable RTSP or MPEG-TS transports for this application.

chrome_ERWfWUQexg

Start streaming

We are ready to go! Right now we have application and protocl handler registered. We can use ffmpeg utility to start streaming RTMP to Niostreamer instance:

cmd_XyxRdfdh50

Using ffplay we can view the video:

cmd_fj3lfsBnOP

ffplay_vvWWoN2ybj

Enjoy!

Setup RTMP server on Windows

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.

First, Docker for desktop should be installed from official website

01

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:

02

03

Restart Windows after installation completed:

04

Create docker-compose.yml with the following content:

version: '3.1'
services:
    niostreamer:
        image: "niostreamer/niostreamer"
        hostname: "niostreamer"
        ports:
            - "1935:1935"

Run

docker-compose up

09

You will see message in logs:

|
| To register instance in control panel please follow the steps:
|
| 1. Log into your account on https://niostreamer.com
| 2. Copy and open this link to activate instance: https://niostreamer.com/activate?token=<TOKEN>
|

Register new account in https://niostreamer.com and open this link in you browser

You will see in logs that instance has been registered:

2021-07-23 04:47:46.920236 info [saas] Instance has been registered in control panel

And then you will see the new instance in web panel as well:

01-5

Now Niostreamer is ready to accept incoming connections from RTMP clients.

Create RTMP virtual host

In instance overview page press "Add Virtual Host" button

01-6

Enter virtual host and port and press "Save"

01-7

To start virtual host the listener interface must be created. Open Virtual host page and press "Add Listener"

01-8

Enter listening address and port and press "Add"

01-9

Wait a little bit until instance is syncronized with control panel. You'll see the virtual host is started in streamer logs:

niostreamer_1  | 2021-06-28 05:22:00.351304 info [live-stream-manager] Application 'live' registered
niostreamer_1  | 2021-06-28 05:22:00.351333 info [core] VHost 'rtmp-default' started

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".

01-10

Start the command from your machine:

ffmpeg -re -i C:/video/big-buck-bunny.mp4 -vcodec copy -acodec copy -f flv rtmp://vm.local:1935/live/bunny

Streaming is started now. niostreamer started to receive audio video data. Let's play incoming stream using ffplay utility:

ffplay -f flv "rtmp://vm.local:1935/live/bunny" -v verbose

ffplay

You will see video window playing the target sample.

Niostreamer is a fully functional streaming server. It can convert incoming RTMP streams to other ones, i.e. HLS.

In next articles we will show how to stream RTMP to niostreamer and the share it as HLS to other players.

Enjoy!

Simplify instance registration process

As you know niostreamer has it's rich web control panel.

Earlier, instance registration required interaction with internal REST API of niostreamer using curl command. Registration process could be done using command like this:

curl -X POST http://localhost:8080/api/v1/saas/instances/register \
     -H "X-Account-Key: AA1SXDJVUT277LNMM6P" \
     -H "X-Account-Secret: 2ithtayHRCetYkOh9r9IoYZqPcZ0oAj8DJrO5Sb8"

It works but requires too many steps for such a simple use-case.

Since version 0.1.256 Niostreamer support new simple method of registration new instance in web control panel.

When you start niostreamer first time you will see in logs message about instance registration status and link to activate instance:

2021-07-04 15:18:30.143799 info Niostreamer version: 0.1.256
2021-07-04 15:18:30.154345 info [geoip] File /etc/niostreamer/conf.d/GeoLite2-Country.mmdb does not exist. Skipping
2021-07-04 15:18:30.187350 info [geoip] File /etc/niostreamer/conf.d/GeoLite2-ASN.mmdb does not exist. Skipping
2021-07-04 15:18:30.188416 info [http-server] server started: 0.0.0.0:8080
2021-07-04 15:18:30.188455 info [core] VHost 'http-instance-api' started
2021-07-04 15:18:30.202712 error [saas-manager] Cannot open settings file: bad file descriptor. Ignore.
2021-07-04 15:18:31.147608 info [saas] This instance is not registered.

|
| To register instance in control panel please follow the steps:
|
| 1. Log into your account on https://niostreamer.com
| 2. Copy and open this link to activate instance: https://niostreamer.com/activate?token=XVXXSBCSCS6P3BVGRKSTPAQKRTCZJIF4R0A2HIJJ
|

2021-07-04 15:20:56.432473 info [saas] Instance has been registered in control panel
2021-07-04 15:21:10.342530 info [saas] First sync received

The only step you should do is to open link https://niostreamer.com/activate?token=XVXXSBCSCS6P3BVGRKSTPAQKRTCZJIF4R0A2HIJJ in you browser when logged in niostreamer account. Once done the rest of steps will happened automatically:

Screenshot-2021-07-05-at-01.35.06

In few seconds the instance will be activated and you will be redirected to instances page.

Enjoy!

Setup RTMP server in Docker

01-11

In this post we will demonstrate how Niostreamer can be configured as RTMP server to be able receive incoming RTMP connections and play RTMP streams. In this post will be shown how to create Virtual Host to listen to clients.

If you haven't installed Niostreamer yet please read corresponding documentation section here: https://niostreamer.com/documentation/install

In this tutorial we will use official Niostreamer Docker image located here: https://hub.docker.com/r/niostreamer/niostreamer

We expect that Docker is already installed on your local machine so we will spent time fo it. If not, pelase read Docker documentation first.

Niostreamer instance will be started using docker-compose functionality. To do it, let's prepare /home/user/niostreamer/docker-compose.yml we will use to start niostreamer with the following content:

version: '3.1'
services:
    niostreamer:
        image: "niostreamer/niostreamer"
        hostname: "niostreamer"
        ports:
            - "8080:8080"
            - "1935:1935"
        volumes:
          - /home/user/niostreamer/conf:/etc/niostreamer
          - /home/user/niostreamer/log:/var/log

Note the ports section. Here, port 8080 is REST API HTTP port niostreamer uses for internal needs. 1935 is a TCP port for RTMP streaming. When started this port is not opened as there are no virtual host registered yet. Once we add niostreamer instance to control panel the instance will open 1935 port.

In volumes section we mount configuration and logs directories.

Create directories:

mkdir -p /home/user/niostreamer/conf
mkdir -p /home/user/niostreamer/conf/conf.d
mkdir -p /home/user/niostreamer/log

Create configuration file /home/user/niostreamer/confniostreamer.conf with the following content:

server {
    listen = "0.0.0.0";
    port = 8080;
    logging {
        file = "";
        level = "info";
    }
    workers = 1;
}

You can change number of workers according to number of CPU cores on your machine.

Run niostreamer from the directory with docker-compose.yml you previously created:

docker-compose up

You will see niostreamer is started:

Starting niostreamer_niostreamer_1 ... done
Attaching to niostreamer_niostreamer_1
niostreamer_1  | 2021-06-26 16:27:51.663875 info Niostreamer version: 0.0.252
niostreamer_1  | 2021-06-26 16:27:51.664483 info [geoip] File /etc/niostreamer/conf.d/GeoLite2-Country.mmdb does not exist. Skipping
niostreamer_1  | 2021-06-26 16:27:51.664516 info [geoip] File /etc/niostreamer/conf.d/GeoLite2-ASN.mmdb does not exist. Skipping
niostreamer_1  | 2021-06-26 16:27:51.665099 info [saas] Instance status: registered in web control panel
niostreamer_1  | 2021-06-26 16:27:51.665355 info [http-server] server started: 0.0.0.0:8080
niostreamer_1  | 2021-06-26 16:27:51.665438 info [core] VHost 'http-instance-api' started

It opens API 8080 port, but it still knows nothin about 1935, we must tell directly niostreamer to start RTMP server.

Since niostreamer is up and running the next step is to configure RTMP virtual host. Virtual host is technically a server machinery that provides functionality for the specific protocol. When you create a virtual host niostreamer opens a network port to start recieving incoming connections from clients.

As mentioned earlier, in this tutorial we will create RTMP virtual host.

The Niostreamer instance must be registered in control panel to do that.

Using web control panel you can control all aspects of fuctionality your RTMP or HLS servers, you can monitor instance staitstics using web browser or mobile.

Please create a new account on niostreamer website: https://niostreamer.com/console/register

Sign into your account. You will see empty dashboard, because there are no server instances registered yet: https://niostreamer.com/console/instances

01-3

On this page you will see the example of curl command line utility demonstrates how to register instance in control panel. Niostreamer has special API on HTTP port 8080 to do that.

Run the following command in other window to register instance in control panel:

curl -X POST http://localhost:8080/api/v1/saas/instances/register \
     -H "X-Account-Key: AA1SXUJHBWT277LNMM6P" \
     -H "X-Account-Secret: 2ibhtnyHRCetYkOh9r5IoYZqPcZ0oBj8DJrO5Sb8"

You will see in logs that instance has been registered:

01-4

And then you will see the new instance in web panel as well:

01-5

Now Niostreamer is ready to accept incoming connections from RTMP clients.

Create RTMP virtual host

In instance overview page press "Add Virtual Host" button

01-6

Enter virtual host and port and press "Save"

01-7

To start virtual host the listener interface must be created. Open Virtual host page and press "Add Listener"

01-8

Enter listening address and port and press "Add"

01-9

Wait a little bit until instance is syncronized with control panel. You'll see the virtual host is started in streamer logs:

niostreamer_1  | 2021-06-28 05:22:00.351304 info [live-stream-manager] Application 'live' registered
niostreamer_1  | 2021-06-28 05:22:00.351333 info [core] VHost 'rtmp-default' started

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".

01-10

Start the command from your machine:

ffmpeg -re -i C:/video/big-buck-bunny.mp4 -vcodec copy -acodec copy -f flv rtmp://vm.local:1935/live/bunny

Streaming is started now. niostreamer started to receive audio video data. Let's play incoming stream using ffplay utility:

ffplay -f flv "rtmp://vm.local:1935/live/bunny" -v verbose

ffplay

You will see video window playing the target sample.

Niostreamer is a fully functional streaming server. It can convert incoming RTMP streams to other ones, i.e. HLS.

In next articles we will show how to stream RTMP to niostreamer and the share it as HLS to other players.

Enjoy!

Install Niostreamer in Docker on CentOS

In this article we will describe how to get started with niostreamer. We will show how to run Niostreamer in Docker container in CentOS operation system.

Docker is the easiest way to try Niostreamer in action.

In this post we will show how to install Niostreamer server to use RTMP, RTSP or HLS streaming capabilities in Docker.

Install Docker

Setup you repository first. Install yum-utils package and setup DOcker stable repository.

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

Install latest version of Docker engine amd containerd:

sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker:

sudo systemctl start docker

Ensure Docker is installed correctly by running the example:

sudo docker run hello-world

01

Install Niostreamer

Niostreamer has it's official Docker repository located here: https://hub.docker.com/r/niostreamer/niostreamer

Download niostreamer image:

sudo docker pull niostreamer/niostreamer

01-1

Prepare docker-compose file. Niostreamer is standalone application with static config file and dynamic cloud setting it got from admin panel. Config directories and logs should be mounted as external volumes.

Create configuration directories:

mkdir conf
touch conf/nio.conf
mkdir conf/conf.d
mkdir log

Create docker compose file docker-compose.yml:

version: '3.1'
services:
    niostreamer:
        image: "niostreamer/niostreamer"
        hostname: "niostreamer"
        ports:
            - "8080:8080"
        volumes:
          - /home/odiszapc/cppprojects/niostreamer/docker/conf:/etc/niostreamer
          - /home/odiszapc/cppprojects/niostreamer/docker/log:/var/log

TCP port 8080 is local port provide HTTP API for internal needs. Using this API you can register streamer instance in control panel on https://niostreamer.com.

First pull the container

docker-compose pull

And run it:

docker-compose up

01-2

Now niostreamer is up and running. Let's register it in admin panel.

Using control panel you are able to manage and monitor your instances using web browser or mobile.

First, register a new account to proceed: https://niostreamer.com/console/register

Sign into your account. You will see empty dashboard as there are no server instances registered yet: https://niostreamer.com/console/instances

01-3

You will see the exampl of curl command line utility demonstrates how toy register instance in control panel. Niostreamer has special API on HTTP port 8080 to do that.

Run the following command in other window:

curl -X POST http://localhost:8080/api/v1/saas/instances/register \
     -H "X-Account-Key: AA1SXUJHBWT277LNMM6P" \
     -H "X-Account-Secret: 2ibhtnyHRCetYkOh9r5IoYZqPcZ0oBj8DJrO5Sb8"

You will see in logs that instance is registered:

01-4

You will see the new instance in web panel:

01-5

Now Niostreamer is ready to accept incoming connections. In next articles we will show how you can ingest incoming RTMP connections to niostreamer server in Docker.

Best,

Niostreamer team

Niostreamer in Docker

Niostreamer streaming server is provided for multiple *nix operating systems: Debian, Ubuntu, Fedora, Centos.

To make it even more flexible for our customers today we starting support of distributions as Docker image.

With Docker Niostreamer can be installed on any platform like Windows or MacOS. In near future we will provide special .msi release for Windows. Now you can use Docker image to use Niostreamer on Windows 10.

Niostreamer has official Docker repository on Docker Hub.

To start using Niostreamer in Docker please follow instruction in documentation section.

Niostreamer for Debian, Ubuntu and Fedora

We continue investing our effort into Niostreamer distribution and extending of OS support.

Niostreamer already has support of CentOS for x86_64, we have RPMS for both 7 and 8 releases.

Today we are happy to announce support of a couple of popular operating systems.

Niostreamer is now available for latest stables releases of Debian, Ubuntu and Fedora operation systems. We support a wide veriety of them:

  • Fedora x86_64: 30, 31, 32, 33
  • Debian x86_64: Buster, Stretch, Jessie, Wheezy, Squeeze
  • Ubuntu x86_64: 20.04 Focal, 18.04 Bionic, 18.04 Xenial, 14.04 Trusty, 12.04 Precise, 10.04 Lucid

Please see installations details in documentation section.

Niostreamer for CentOS 8 released

Hi there.

Our customers asked for extended support of different operational systems. So we added some of popular platforms to our roadmap earlier.

Today we would like to announce that Niostreamer now supports CentOS 8 x64 platform.

Niostreamer is distributed in RPM format and can be easily installed via yum or dnf packet manager.

Installation process is typical and pretty simple.

Create a repository configuration file /etc/yum.repos.d/niostreamer.repo with the following content:

[niostreamer-release]
name=niostreamer stable - $basearch
baseurl=https://repo.niostreamer.com/release/centos/8/$basearch
enabled=1
gpgcheck=1
gpgkey=https://repo.niostreamer.com/RPM-GPG-KEY-niostreamer

and run sudo yum install niostreamer to install Niostreamer package.

Please, see details in documentation section.

We know your are waiting for Debian/Ubuntu packages, will see you soon).

Best,

Niostreamer team.

Getting Started

Install Niostreamer on CentOS 7

In this post we'll describe how to install and setup your first Niostreamer instance. Niostreamer is a media streaming server supports multiple popular protocols ike RTMP or HLS. At this moment we support Centos 7 only, but we have roadmap about Debian/Ubuntu/etc.

Niostreamer is distributed as RPM package and can be simply installed.

No registration required to install Niostreamer RPM package. The process is simple and pretty straightforward.

First, create a repository file: /etc/yum.repos.d/niostreamer.repo:

[niostreamer-release]
name=niostreamer stable - $basearch
baseurl=https://repo.niostreamer.com/release/centos/7/$basearch
enabled=1
gpgcheck=1
gpgkey=https://repo.niostreamer.com/RPM-GPG-KEY-niostreamer

Run sudo yum install niostreamer -y to install latest release version.

Confirm when asked about adding GPG key:

Retrieving key from https://repo.niostreamer.com/RPM-GPG-KEY-niostreamer
Importing GPG key 0x404F9F2A:
Userid     : "niostreamer \"
Fingerprint: 2f03 f5e9 3af6 728d 4fd0 e8c8 eb72 675a 404f 9f2a
From       : https://repo.niostreamer.com/RPM-GPG-KEY-niostreamer
Is this ok [y/N]: y

When installation completed you should enable service by running sudo systemctl enable niostreamer command and then start it with sudo systemctl start niostreamer.

Niostreamer is now up and running, you can check status by running sudo systemctl status niostreamer command:

● niostreamer.service - Niostreamer media server
Loaded: loaded (/usr/lib/systemd/system/niostreamer.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-11-10 12:15:00 UTC; 2s ago
Main PID: 4198 (niostreamer)
Tasks: 6
Memory: 596.0K
CGroup: /system.slice/niostreamer.service
└─3996 /usr/sbin/niostreamer -c /etc/niostreamer/niostreamer.conf

Niostreamer instance is ready now. What does that mean? Niostreamer server started it's threads but is not yet available as fully functional streaming server: it does not open streaming ports, nor RTPM/RTSP nor HTTP protocols like MPEG-DASH or HLS.

To try Niostreamer features you have to register running instance in https://niostreamer.com. It's simple procedure and gives you a full mechanisms of control. First, you have to create account and sign in.

Niostreamer web panel has API capabilities. Your account has special Access Key and Secret Key, you can see this information on API Access page:

Niostreamer instance can be registered in control panel using the credentials above. The process is simple: you tell streamer instance to register itself in control panel. When started Niostreamer instance opens local HTTP port 8080 to make local interactions with media server and control panel. Registration can be done by running curl command with provided API credentials:

curl -X POST http://localhost:8080/api/v1/saas/instances/register \
     -H "X-Account-Key: DD1SLNMM6PUJHBWXT390" \
     -H "X-Account-Secret: etYkOZ0oBj8DJrO5Sb82ibhh9r5IoYZqPctnyHRC"

Niostreamer instance is registered and can be seen on Instances page:

Niostreamer is going live!

Today we are happy to say first public release of Niostreamer media streaming server is ready and available for users!

There will be a couple of posts about feature-set soon, but right now we just want to say that a lot of effort was invested to make the first production release available.

Niostreamer supports a wide variety of operating systems. The first one supported is Centos 7. Follow our blog to see when support of other *nix and Windows operating systems will be added.

Niostreamer is a freeware media server. You can download and install as many instances as you want. For free.

The best way to manage installed instances is simple and flexible control panel.

The main website (https://niostreamer.com) is an administrative panel to manage all of your installed streaming server instances.

Please see the documentation section describing how to get started with you first Niostreamer instance here.

You can always contact our support team if you have any questions by sending us an email: support@niostreamer.com

Best,
Niostreamer team.