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!