Live Application - Storm Streaming Server

Storm Streaming Server operates based on what are called "applications," which are collections of streams and the settings that govern them. Each server instance can have multiple applications, which are completely independent of each other. Each application has its unique name and type, which defines its role. Among the things that an application allows you to define are for example: the method of authentication for incoming streams, whether streams should be recorded, or whether you want to use transcoding to create multiple quality versions.

The basic type of application is called "live", which within a single server instance allows for both publishing and playing back streams. There are also other applications like "origin" and "edge", which are used in building clusters consisting of multiple server instances. You can learn more about these here in our Scaling & Cluster Guide.

Sample Configuration

This type of applications is the simplest one and are best suited for single instance configuration.

                        
<Application name="live" type="live">

    <RTMPController>
		<AllowStreamPublish>true</AllowStreamPublish>
		<AllowStreamOverwrite>true</AllowStreamOverwrite>
		<AllowClientPlayback>true</AllowClientPlayback>
		<AutoPublishStream>true</AutoPublishStream>
        <KeepClientStreamsAlive>true</KeepClientStreamsAlive>
		<PlaybackAuthRequired>false</PlaybackAuthRequired>
		<Authorization enabled="false"></Authorization>
	</RTMPController>

	<SecureStream enabled="false">
		<Password>qwerty</Password>
		<CheckViewerIP>true</CheckViewerIP>
		<TokenLifespan>10</TokenLifespan>
	</SecureStream>

	<MP4MuxerSettings>
		<VariableFPS>true</VariableFPS>
		<KeyFrameCompensation>false</KeyFrameCompensation>
	</MP4MuxerSettings>

	<DVRSettings enabled="false">
		<CacheSize>100</CacheSize>
	</DVRSettings>

	<RecordingSettings enabled="false">
		<SavePath>/Users/Johny/Desktop</SavePath>
		<CacheSize>15</CacheSize>
        <MaxFileSize>15</MaxFileSize>
        <MaxFileDuration>0</MaxFileDuration>
        <MaxStorageSize>0</MaxStorageSize>
        <RemoveOldFiles>true</RemoveOldFiles>
	</RecordingSettings>

	<TranscoderSettings enabled="true">
		<Preset name="720p" />
		<Preset name="360p" />
	</TranscoderSettings>

</Application>
                    

Main Parameters Explanation

Application:nameName of this application. If there are more applications within your preferences.xml they all must have unique names. The default one is called “live”.
Application:typeThis value must be set to “live” for this type of Application. Other types are “origin” and “edge” and you can learn more about them here.
Table 1. Main parameters explanation table

RTMPController

This block of settings specifies the exact behavior for RTMP-based connections.

AllowStreamPublishDefines whenever publishing (using for example OBS) to this application is allowed or not.
AllowStreamOverwriteIf this option is set to true a stream can be overwritten by another one with the same name.
AllowClientPlaybackDefines whenever playback from this application is possible for RTMP connections.
AutoPublishStreamIf set to false, an incoming (ingest) stream will not be published automatically upon its creation. This means it cannot be viewed by viewers unless it is set to **published** manually (using the Control Panel or RESTful API).
KeepClientStreamsAliveIf this option is set to false, any RTMP created though pull mechanism (external RTMP server) will be closed if number of viewer drops to zero and remain at that level for 30 seconds.
PlaybackAuthRequiredIf this option is set to true all RTMP clients must authorize for playback using either a token or credentials.
Table 2. RTMP-based connections table

To enable authorization for Publish or Playback Authorization block must be configured:

Authorization:enableIf true authentication is enabled and required (by default only for publishing). If you wish to authenticate client (playback) connection PlaybackAuthRequired must be set to true.
sourceTypePossible values:

local – you can define auth items within Authorization tag in the following manner. One item is of credentials type (username & password), the other is a token:

<Authorization enabled="true" sourceType="local">
   <auth username="admin" password="qwerty" />
   <auth token="62cjdj" expire="2022-02-01 16:22:00" />
</Authorization>

global – application will use global pool of users and tokens for authorization. This pool is defined in <StreamAuthorization> tag.

request – server will perform a request to an URL specified in parameter sourceTarget with added streamKey at the end:

<Authorization enabled="true" sourceType="request" sourceTarget="localhost/api/auth"></Authorization>

(for a stream called “test”, request will take a form of "localhost/api/auth/test")

A response should looks as follow:

{
 "status":"success",
 "data":[
  {
   "steamKey":"test"
   "username":"admin",
   "password":"qwerty"
  },
 ]
}
sourceTargetAn URL where request should be made for auth items (only for sourceType:request).
Table 3. RTMP authorization table

SecureStream Settings

SecureStream allows to protect stream playback using a special token. Can will change depending on viewer’s IP (optionally) or time. If you wish to learn more about this function, check our guide for SecureStream.

SecureStream:enableDefines whenever SecureStream is enabled for this application or not.
PasswordUnique password that will be used for creating a token.
CheckViewerIPDefines whenever viewer’s IP should be used to create a token.
TokenLifespanDefines token’s lifespan (in minutes).
Table 4. SecureStream settings table

MP4 Muxer Settings

MP4MuxerSettings block defines basic options for MP4 packager that is used for MSE/HLS connections.

VariableFPSIf the source stream has no const frame rate (e.g. WebRTC-based source) muxer will try to fix the stream by adjusting composition times for selected frames.
KeyFrameCompensationEnables mechanism where “empty” frames are inserted into a stream if Audio/Video desynchronization is detected.
Table 5. MP4 muxer settings table

DVR Settings

DVR function allows for short live-stream rewind mechanism based on cached stream.

DVRSettings:enabledDefines whenever DVR is enabled.
CacheSizeNumber of MB within memory for storing video stream. Length of stored video material will depend on resolution and bitrate.
Table 6. DVR settings table

Recording Settings

Recording option allows for recording video streams into MP4 files.

RecordingSettings:enabledDefines whenever recording is enabled.
SavePathPath were MP4 files should be saved.
CacheSizeDefines how much of a video stream should be kept in memory before being flushed to a file.
MaxFileSizeMaximum video file size. If a stream reaches this size, it will be split into additional files. This parameter is optional, and if not present or set to zero, no limit will be in effect.
MaxFileDurationMaximum video file duration (time). If a stream exceeds this duration, it will be split into multiple files. This parameter is optional, and if not specified or set to zero, there will be no limit in effect.
MaxStorageSizeStorm will calculate sum of all saved video files in particular folder and either stop saving new ones, or it'll start overwriting older files if RemoveOldFiles is set to true. This parameter is optional and if not present or set to 0 no limitation will be added.
RemoveOldFilesIf set to true and combined with MaxStorageSize, older video files will be removed to make space for new ones.
Table 7. Recording settings table

Transcoding Settings

For each individual application a set of presets for transcoding can be selected. Please keep in mind that presets must be already defined in your preferences.xml file. If you would like to define your own presets and learn more about transcoding check our Transcoding Guide.

TranscoderSettings:enabledIf set to false, no video stream will be transcoded.
preset:nameName of a template, previously defined in main Transcoder tag.
Table 8. Transcoding settings table
Next Step

In the next step you'll learn how to configure Control/Admin Panel.

Support Needed?

Create a free ticket and our support team will provide you necessary assistance.