Templates for effective stream management in UGC

December 3, 2021

stream management

The media server receives video data in different ways. In the case of UGC it is always a publication. When publishing, the initiator of the connection is an external device from which the media server receives the video. In this case, you cannot capture streams; after all, the device you are streaming from does not have a static IP address or is located behind the firewall on a private IP network (eg a smartphone).

In IPTV, the source is known, streams are available 24/7, and we know their number. That’s not the case with UGC. We are talking about tens of thousands of open sessions with unknown duration, that’s how large the UGC platform is. To create a separate stream for each publication (as in the case of TV channels), and then specify settings for each stream, takes a long time and is not very convenient. Moreover, in some cases, it is not known at all with what name the external system will 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;
}

The creation of template-prefix pairs is necessary to apply certain pipeline parameters to the streams. For example, you may need to send a stream to a specific transcoder, depending on the required transcoding parameters. Also, some UGC platforms can sell additional features to users for money (logo overlay, archive, etc.) Eventually, there are certain technical and business conditions, depending on which, the system needs to distribute some users to some groups of servers (with some configurations of the video pipeline), and others 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;
}

The loss of several lines always led to publication errors and to a call to the platform support. Unlike it, templates reduce the number of characters in the configuration. This means that the opportunity to make a mistake is reduced drastically.

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.

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