Installation of IPTV / OTT platform. From original streams to the first client.
Schematic presentation of platform
Work plan
Original streams
In this article, we use test streams from various rightholders.
Transcoding
TVIP Mira transcoder is used to provide the service on all possible platforms as well as an adaptive bitrate. This article does not contain its configuration.
Streams segmentation and publishing, DVR
Flussonic acts as a streamer, its settings will be described below. Output streams from transcoders are configured for the flussonic input.
Streams protection
TVIP CAS configuring for the work with TVIP TMS and flussonic
Setting up channels in TMS
Channel design (logos, names, EPG linking),
using fake epg
Creation of tariff plans.
Account-making
Basic user data, assignment of tariff plans
Connecting devices to the account
Demonstration of connecting various devices to the account
  • Using login and password
  • Using QR code
  • Using quick binding option
API for TVIP TMS interaction
Examples of enabling / disabling account, the appointment of tariff plans. Examples on Curl
Stream segmentation and publishing
In this article, we don't describe setting up transcoder for TV broadcasting purposes, the following streams will be available at the output of the transcoder:

HD media:
udp://226.181.0.41:1234
Живая природа: udp://226.181.0.220:1234
RT HD: udp://226.181.0.14:1234
RTД HD: udp://226.181.0.124:1234
Мир 24 HD: udp://226.181.0.252:1234
Мир Премиум HD: udp://226.181.0.251:1234
DW: udp://226.181.0.196:1234
France 24: udp://226.181.0.86:1234
Bridge Русский Хит: udp://226.181.0.194:1234
Bridge TV Classic: udp://226.181.0.190:1234
Глазами Туриста: HD:udp://226.181.0.218:1234

All streams have several videotracks with different bitrates. HLS output stream from Flussonic will support adaptive bitrate.

When configuring flussonic, you need to take a responsible approach to the name of the stream, in the future, in TMS it will be used to organize timeshift and catch-up services.
How does adaptive bitrate work?
Let's consider, output stream from Flussonic, using playlist content as in the example, with which the player will work. Focusing on the BANDWIDTH, AVERAGE-BANDWIDTH tags, the player starts broadcasting from one of the bitrates specified by the broadcaster (the first in the playlist). In the future, the player constantly measures the download speed of media segments and switches to the best quality that the bandwidth of the connection provides.
$ curl https://tv-demo.tviplabs.com/hdmedia/video.m3u8
#EXTM3U
#EXT-X-STREAM-INF:RESOLUTION=1920x1080,FRAME-RATE=30.000,CODECS="avc1.640028,mp4a.40.2",AVERAGE-BANDWIDTH=5130000,BANDWIDTH=6410000
tracks-v1a1/mono.m3u8
#EXT-X-STREAM-INF:RESOLUTION=1280x720,FRAME-RATE=30.000,CODECS="avc1.64001f,mp4a.40.2",AVERAGE-BANDWIDTH=3140000,BANDWIDTH=3930000
tracks-v2a1/mono.m3u8
#EXT-X-STREAM-INF:RESOLUTION=1024x576,FRAME-RATE=30.000,CODECS="avc1.64001f,mp4a.40.2",AVERAGE-BANDWIDTH=1750000,BANDWIDTH=2190000
tracks-v3a1/mono.m3u8
Timeshift, Catch-up, DVR
Timeshift - pause
Catch-Up, DVR - access to the archive, both through rewinding and selection of a specific program for viewing is possible.

All services are provided by flussonic DVR, real timeshift will be available only within the archive.

Selecting a hardware platform for DVR is a rather laborious task, in addition to the total volume of the archive, its distribution among disks, one must take into account the read speed (access to the archive) of a particular disk. During operation, popular channels are distributed to different disks to provide quick access to specific records.
Example of setting up one channel in Flussonic streamer
The flussonic configuration file is located in /etc/flussonic/flussonic.conf

In this config, all streaming protocols are disabled, except for HLS, the archive is configured for 5 days, but it cannot occupy more than 95% of the section, DRM is also configured - receiving encryption keys from TVIP CAS (https://keys-demo.tviplabs.com).
TVIP CAS is based on AES-128 is implemented on all possible players and provides more coverage than alternative DRM systems.

Detailed description of setting up streaming.
stream hdmedia {
  url udp://226.181.0.41:1234;
  dvr /data 5d 95%;
  hds off;
  rtmp off;
  rtsp off;
  dash off;
  mpegts off;
  m4s off;
  m4f off;
  drm aes128 keyserver=https://keys-demo.tviplabs.com/cas-server;
}
CAS server configuration
The server CAS configuration file is located at /opt/tvip-cas/application-prod.yml

In this example, it is behind the NGINX proxy installed on the same server that provides SSL and balancing, in this example balancing is not considered, the general recommendation is to always place the service behind NGINX.

Of the essential settings, you should specify all TMS addresses working with the CAS server and the addresses of all streamers (in our case, flussonic), you also need to specify the private-key and secret-key.
spring:
  redis:
    host: localhost
    port: 6379
    password: c8f1ee9a7c5fd4b3c66d7559e99807d0
server:
  port: 8081

servers:
# Address list of TMS servers. This CAS server may subscribe on these servers to get any appropriate notify requests and
# may get content access information. This feature is allowed for master CAS servers only.
  tms-servers:
    - 185.84.33.186:8605
# Address list of streaming servers that are allowed to send requests to this CAS server
  stream-servers:
    - 185.84.33.187
# Alias that will be specified as the URL root, when the link is being generated for the client to get the encryption key
# to decrypt the content segment
  user-key-url-alias:
    https://keys-demo.tviplabs.com
# Address list of proxy servers. They are allowed to mask the actual server remote address and deliver it to check
# in "white" list of servers (TMS or streaming) depending on the request context.
  proxy-servers:
    - 127.0.0.1
# If non-empty value specified, it means that this CAS server works as slave
# and may not write any content access information or generate content encryption keys, but only
# deliver any existing keys if allowed by content access info. Master server URL must have no prefix, but port,
# like master.keys.domain.com:8081
  master-server:

# Application settings
app:
# Used as the application identifier, when interacting with TMS servers
  name: 'keys-demo.tviplabs.com'
# Application-specific prefix for keys in Redis
  namespace: 'cas-server'
# Private key that is used to sign requests from CAS server application
  key: 'f698f997c68f2db029e612e95566badbf'
# Secret that may be used to generate key in case of fail back scenario.
# If no specified or empty, fail back key generation is not used.
  secret: 'real-secret-key'
From TMS side, you should provide the CAS server address and the key specified in the CAS server settings.
CAS Server connecting to TMS
Flussonic setup summary
At this stage, we have a set of streams, an archive of each channel for 5 days, streams are protected from unauthorized access

HD media: https://tv-demo.tviplabs.com/hdmedia/video.m3u8
Живая природа: https://tv-demo.tviplabs.com/zhivayapriordahd/vide...
RT HD: https://tv-demo.tviplabs.com/rthd/video.m3u8
RTД HD: https://tv-demo.tviplabs.com/rtdhd/video.m3u8
Мир 24 HD: https://tv-demo.tviplabs.com/mir24hd/video.m3u8
Мир Премиум HD: https://tv-demo.tviplabs.com/mirpremiumhd/video.m3...
DW: https://tv-demo.tviplabs.com/deutschewelleenglish/...
France 24: https://tv-demo.tviplabs.com/france24/video.m3u8
Bridge Русский Хит: https://tv-demo.tviplabs.com/bridgetvruskyhit/vide...
Bridge TV Classic: https://tv-demo.tviplabs.com/bridgetvclassic/video...
Глазами Туриста HD: https://tv-demo.tviplabs.com/glazamituristahd/vide...

To organize DVR we used in our example dvr-demo.tviplabs.com, we advise you to split live and dvr broadcasting at the logic level, in more complex examples this allows you to simplify further configuration.


TVIP TMS supports two protocols:
XMLTV
EPG-Service
The example shows XML-TV protocol from epgservice.ru
EPG setup
TMS supports creating multiple DVR sources, in our example presented one DVR server.
In its options, you should specify the address of the DVR server (flussonic) and the default archive depth in seconds. In example below - 5 days.
DVR setup
When creating a channel, pay attention to the System-name, it should exactly repeat the name of the stream in flussonic. Based on this name, the URL for the archive is formed.
To configure the DVR - you need to select the DVR server created in the previous step.
To configure EPG - you need to select the channel name in the EPG source.
Channel setup
Service tariffication
Tariffs are implemented through tagging systems for channels and tariff plans, for more information follow the link .
Subscription management is available both through the admin panel and the API. To check the result, after adding channels and setting up tariff plans, we will check how it works through the web portal.
Create demo user with the password 12345678 and add Base subscription to it.
Adding a subscription
Портал доступен по адресу https://tms-demo.tviplabs.com/portal
Devices connection and API
Contacts
E-mail: sales@tviplabs.com