Templates for effective stream management in UGC

December 3, 2021

4minute read

stream management

The media server operationalizes the data by different input methods. In the case of UGC it is always a publication. In publish time, the initiator of this relation is the external hardware and the video is passed to the media sever from the device. Cannot encompass the streams. There is not static IP address with your streaming device, also the device is behind the firewall and has private IP address (like a smartphone).

In IP TV (IPTV) the source is definitive, the streams are available all the time and the number of streams is identical. It’s not as easy as it may seem with UGC, though. This (UGC) platform maybe is made up of thousands of open sessions that nobody knows how long those (all those session) are able to last. It would be much more convenient if a one-time creation of a separate stream for each publication was possible, and then an individual setting of each stream would be possible, as well as that would be a quick and easy task. Besides that, in certain cases, the external system may even keep silent with the annotation or name with which we intend it to publish the stream. Therefore, publication in UGC is often organized by a dynamic name.

Simultaneous configuration management of a large number of streams

So, we have a large UGC platform with multiple streams, and they should be published with a dynamic, previously unknown name. To do this, you need to configure templates with prefixes on the servers in advance. For example, you can specify the prefix ‘/mobile’ on the ingest server 3 so that all streams from mobile devices go there. When a streamer comes to the platform to publish his stream, the platform will give it a name (previously unknown to the media server), let it be “ABC”. The stream name will be formed from “ABC” and the prefix ‘/mobile’ – “/mobile/ABC”. The streamer will receive a link to publish to a specific server: rtmp://ingest3/mobile/ABC (in the case of publication by rtmp://).

The settings of all streams inside the ’/mobile’ prefix will be the same. We call this a configuration template. Templates make it unnecessary to prescribe settings separately for each stream. Each prefix can be assigned a separate template (with the same configuration settings for all streams inside the prefix). And for each publication, the stream will be created using the appropriate template.

For example, to apply the archive depth of 1 day to all streams inside ‘/mobile’, you can configure a template:

template mobile-devices {
  prefix mobile;
  input publish://;
  dvr @s3 1d;

Some things that we need to create are template-prefix pairs in order to apply some pipeline parameters to the streams that we want. As a result, issues such as selecting the appropriate transcoder for streams with specific transcoding requirements might become relevant. Moreover, there some UGC platforms can provide for the users additional features (logo overlay, archive, etc.) which they could receive for money. Eventually, under certain conditions both technical ones and business-oriented there is a necessity to divide some users among some groups of servers (with a certain configuration of the video pipeline) and others in to others.

For example, you can create a “mobile-vip” location, enable the transcoder and long-term storage in the archive as follows:

template mobile-devices-vip {
  prefix mobile-transcoded;
  input publish://;
  transcoder vb=1500k size=-1:720 logo=company.png ab=64k;
  dvr @s3 7d;

Is it possible to live without templates?

What would it mean to enable the DVR (digital video recording) option for 50 streams if there were no configuration templates? It would be necessary to overwrite the same construction in configs 50 times and apply new settings 50 times. Templates allow you to simultaneously manage the configuration of a large number of streams.

We have met services where, after registering on the platform, administrators generated a separate stream for each streamer-user and duplicated it between all servers. This is a monstrous duplication of information, which eventually led to the fact that it was necessary to fill 5000 lines on all 20 servers. And all these are the same type of configurations with minimal difference:

stream mobile/usernameA {
  input publish://;
  dvr /storage 1d;
stream mobile/usernameB {
  input publish://;
  dvr /storage 1d;
stream mobile/usernameC {
  input publish://;
  dvr /storage 7d;

Obviously, without these commands, it would always end up in publication errors and some call to the platform support then. However, the tool offers workaround possibility by reducing the template parameters count. In simple words, this implies that the probability of mistakes gets low.

The configuration given in the examples is not complete and may be changed. For up-to-date information, please refer to the documentation and service support@flussonic.com.

Maksim Klyushkov
Flussonic Media Server Team Lead
At the forefront of Flussonic innovations: responsible for development of Flussonic Media Server, video analytics & UI services