Flussonic Media Server documentation

Configuring Flussonic Media Server

Flussonic Media Server configuration management Anchor Anchor x2

Flussonic Media Server settings are stored in the configuration file /etc/flussonic/flussonic.conf.

You can edit Flussonic settings in several ways:

After you have made changes to configuration parameters within flussonic.conf, you must reload the Flussonic Media Server service with the following command:

/etc/init.d/flussonic reload

Another way to reload the service is to use the HTTP API:

curl -u user:pass http://localhost:8080/flussonic/api/reload

where user:pass — the login and password specified in the option edit_auth (see Other server options later on this page) .

Restarting Flussonic Media Server Anchor Anchor x2

To restart the server with Flussonic, run this command:

/etc/init.d/flussonic restart

The server's global options Anchor Anchor x2

Global options include ports for protocols and general settings.

Ports and protocols

Server Options (Ports and Protocols) Description
https 443; Turns on accepting HTTPS requests via the specified port. Multiple ports can be specified with multiple lines.
http 80; Turns on accepting HTTP requests via the specified port. Multiple ports can be specified with multiple lines.
http 127.0.0.1:80; Turns on accepting HTTP requests via the specified port and IP address. Multiple ports can be specified with multiple lines.
rtmp 80; Turns on accepting RTMP requests via the specified port.
rtmps 1443 Turns on accepting RTMPS requests via the specified port.
rtsp 554; Turns on accepting RTSP requests via the specified port.
rtsps 1554; Turns on accepting RTSPS requests via the specified port.
mysql 3306; Turns on accepting MySQL queries via the specified port.

Notes

When configuring protocol HTTPS, RTMPS, and RTSPS, Flussonic Media Server expects that there are certificates in the directory /etc/flussonic.

The RTMPS protocol works only if you have a valid certificate that works without any warnings or errors.

Flussonic Media Server expects the private key of the server in the file /etc/flussonic/flussonic.key with the password flussonic. The server's certificate is in the file /etc/flussonic/flussonic.crt. The intermediate certificate and CA certificate are in /etc/flussonic/flussonic-ca.crt.

For example, when you receive the purchased set of keys and certificates, you must do the following:

cat intermediate.crt ca.crt > /etc/flussonic/flussonic-ca.crt
cp server.crt flussonic.crt
openssl rsa -des3 -in server.key -out flussonic.key

Other server options

Server Options Description
loglevel info; Manages the level of detail in the data being logged. Variable values: debug, info, alert.
logrequests true; Turns on logging all HTTP requests to /var/log/flussonic/access.log.
auth_token TOKEN; Specifies the name of the query string parameter to be interpreted as the authorization token.
auth false; Turns off authorization at the global scope.
auth http://backend/auth.php; Turns on the authorization backend at the global scope.
max_sessions 1000; Sets global limit on the quantity of concurrent sessions.
no_auto_token;

auto_token false;
If this option is specified, any incoming request without the token variable in the query string will be refused immediately.
auto_token UUID; If this option is specified, the authorization token will be generated automatically, provided that it is not found within the query string.
auto_token blank; If this option is specified, a blank authorization token will be accepted, provided that no token is found within the query string. This is the default behavior.
cluster_key SECRETKEY; This line of code is used for authorizing other Flussonic servers comprising a cluster.
view_auth USER PASSWORD; Turns on authorization for read-only access to API.
edit_auth USER PASSWORD; Login and password for administrator access to the server.
api_allowed_from 10/8 192.168/16; Specifies IP addresses or networks from which accessing API is allowed.
notify HANDLER_NAME {
  sink http://backend/event.php;
}


notify HANDLER_NAME {
  sink /etc/flussonic/events.lua;
}
Flussonic events will be sent to the specified URL or script. Learn more in Events API
pulsedb /var/lib/flussonic; Specifies the path to which streams statistical data will be recorded.
session_log /var/lib/flussonic; Specifies the path to which session history will be recorded.
session_log false; Disables writing sessions to disk.
url_prefix PREFIX

url_prefix http://my.domain.address.com:8080;
When using the HLS protocol, for all streams on the server the addresses of individual segments and playlists within the playlist variable will start with the speicified prefix. This setting is available in the global part of the config file as well as locally for any individual stream. Naturally, when specified at the stream level, it is only valid for this particular stream.
source SOURCE/PREFIX;
source SOURCE/PREFIX { }


source origin1.tv {
}
This directive turns on automated stream repeating to the local server from a remote one.
stream ntv {
  url tshttp://source/ntv.ts;
}
The stream directive turns on a permanent stream that will be kept alive for the entire lifetime of the server, even if no data sources are available. Please see below for the stream directive's options.
ondemand ntv {
  url tshttp://source/ntv.ts;
}
The ondemand directive specifies the stream to be started on demand. If the stream has been unavailable for a certain amount of time, it will be turned off automatically. Please see below for the ondemand directive's options.
rewrite client16/* {
  url rtmp://origin/%s;
}
The rewrite directive turns on dynamic stream start on demand, for all streams with the names satisfying the client16/* mask. Please see below for the rewrite directive's options.
live published { } The live directive makes it possible to publish to the server all streams with the names starting with published/. Please see below for the live directive's options.
file vod {
  path /storage;
}
The file directive turns on broadcasting for all files in the /storage directory with the names starting with vod/. Please see below for the file directive's options.
cache globalcache /var/www misses=4 2d 40G; Сonfigures a global cache named globalcache in the /var/www directory, with the limits of 40 Gigabytes and 2 days, and Flussonic beginning to put files in the cache only after 4 requests for the files (cache misses).
nvidia_monitor true; Сonfigures Flussonic to save statistics on Nvidia performance (true) or to stop saving it (false). You can retrieve the statistics figures in the Pulse section in the UI. Run a custom query like this one `sum:1m-avg:gpu_dec{from=-2h,gpu=nv0}`. Learn more
geoip PATH_TO_DATABASE; Сonfigures Flussonic to use the specified GeoLite2 database for geolocation instead of the built-in GeoLite2 database. Learn more

Stream and group settings Anchor Anchor x2

These settings are used in the directives stream, ondemand, rewrite, and live. We call them options.

auth

auth http://backend/; Enables authorization for a stream. See more in the authorization section.

domains

domains host1.ru *.host1.ru; Specifying the domains, within which playing this video is allowed. This does not work for those clients that do not pass the value of Referer. To work correcty in the WEB the flussonic domain must present in the list (the domain of the embed.

allowed_countries

allowed_countries CA US UK; The list of two-character codes of countries where the access is allowed (for code reference see the MaxMind database).

url

url tshttp://transcoder:port/; URL of the data source. It is possible to list several URLs to enable trying the first available data source.

Important: If a UDP source is used, the configuration file must contain this particular UDP address only once. If multiple streams use the same UDP address, chances are it will not work.

urls

urls source1 source2; A list of data source URLs. More info about switching sources.

url_prefix

url_prefix prefix

for example

url_prefix http://my.domain.address.com:8080
When using HLS protocol, the addresses of individual segments and playlists within the variant playlist will start with the specified prefix. This option may be used not only as part of an individual stream's settings but also in the global portion of the config file. If the option is specified globally, it will be applied to all streams on the server.

dvr

dvr /storage 1d 50% schedule=8:00-16:00;

dvr @my_raid 1d 50% schedule=8:00-16:00;

Enables the archive feature. The first command indicates that Flussonic Media Server should store the archive in the /storage/streamname directory. The second command configures the server to store the archive in the disk array @my_raid. Flussonic will clean up that directory either once a day or when the disk gets 50% full. To set up time you could use days or hours: 20h. Parameter `schedule` allows you to set a schedule on the DVR in the form of intervals. The time is specified in UTC in hours and optionally with minutes; the interval can carry on after midnight: 22-1:30. A schedule can contain multiple intervals, separated by a comma: 8:00-16:00,22-1:30.

dvr_offline

dvr_offline /storage 1d 50%; With this option specified, Flussonic would not write the stream to the archive on the start. Archiving of this stream will have to be turned on explicitly via API. This option used in place of dvr option.

udp

udp 239.0.0.1:5001 multicast_loop;

udp 239.0.0.1:5001;
This option makes Flussonic Media Server to send the stream via MPEG-TS over UDP. To set MULTICAST_TTL parameter on the UDP socket use the following syntax: udp 239.0.0.1:5001?ttl=8;. To set constant bitrate (CBR) use: udp 239.0.0.1:5001?cbr=2000;, where 2000 is the bitrate in kbit/sec.

thumbnails

thumbnails; Turns on generation of the stream preview JPEG thumbnails).

retry_limit

retry_limit 10; Sets the number of times Flussonic Media Server will try to connect to the data sources before closing a non-static stream.

clients_timeout

clients_timeout 10; Sets the time period (in seconds) for which Flussonic Media Server will keep serving a non-static stream after the client's last request.

source_timeout

source_timeout 10; Specifies the period of time, in seconds, for which Flussonic Media Server waits for new frames to come from the data source. When this time passes, Flussonic attempts to reconnect to the data source. Default source_timeout is 60 seconds.

frames_timeout

frames_timeout 3; Specifies the period of time, in seconds, for which Flussonic Media Server waits for new frames to come from the data source before it generates the event frames_timed_out. This period of time must be smaller than in source_timeout. The event frames_timed_out informs you that the source might soon be lost. If frames come again from this source, before source_timeout has passed, Flussonic issues the frames_restored event.

password

password secret; The password that will be passed via query string (http or rtmp) for publication in a stream or group.

push

push rtmp://destination-server/name; With this option Flussonic will publish the stream to another server.

backup

backup vod/blank.mp4; Setting this option for the stream will launch the specified file vod/blank.mp4 in case the video from the data source becomes unavailable.

url publish://

url publish://; This option is used for publishing video into the stream. This option is not applicable for stream groups.

on_publish

on_publish http://host/publish.php;

on_publish /etc/flussonic/publish.lua;
Enables callback script or http push event when video is being published to this stream or group. HTTP push event could contains infomatino about the stream name, publisher's IP, etc. In response it is possible to allow or deny the publication: the HTTP backend must return 200 OK or 403 Forbidden; the .lua script must return {true, {}} or {false, {}.

max_sessions

max_sessions 1000; Sets the limit on the number of sessions for the stream.

settings_rtp

rtp udp; Turns on mandatory use of UDP for communicating with RTSP cameras.

add_audio_only

add_audio_only; Adds to the HLS playlist a link to an audio-only stream. This is needed to validate an app in Apple devices.

prepush off

prepush off; Turns off the quick-start prepush feature. This option is useful for broadcasting real-time streams.

prepush

prepush 10; Enables a buffer of a specified duration, in seconds. If the client's connection to the server is interrupted or slowed down, it will keep playing video from the buffer. This allows the player to start faster, but with a delay relative to the source.

max_bitrate

max_bitrate 1000; Sets the bitrate limit for the stream that is being published.

logo

logo path=flu/embed-logo.png height=100 width=100 left=0 top=0; Add logo at playback. This logo will not be displayed on mobile devices and in the DVR player. To add logo to the video use transcoder.
path (required) — path relative to wwwroot directory.
height, width — logo image size in px. If ony only one of these parameters is present then the other is scaled proportionally. Omit these parameters to display logo in the original size.
left, top, right, bottom — logo image location specified by offset in px. For example, right bottom corner: right=0, bottom=0. Don't use left and right, top and bottom parameters together.

mpegts_pids

mpegts_pids pmt=4095 sdt=0x12 v1=211 v2=212 a0=220 t0=16#fb; This parameter sets PIDs values for outgoing MPEG-TS streams. It is possible to set PID values for PMT, STD and video and audio tracks. Tracks are numbered starting from one. The code a1=123 sets a PID value for the first audio track. It is possible to set base index for the tracks of certain type using the 0 (zero) index. Example: `t0=100` sets PID=101 for the first track, 102 for the second, and so on. Numbers can be given in decimal form (by default) or in hexadecimal with 0x prefix.

segments

segments 5; Specifies the number of segments in HLS and HDS playlists.

segment_duration

segment_duration 4; Specifies the duration of a segment for HLS and HDS streams in seconds. For some incoming streams Flussonic will not apply the specified segment duration. This depends on a stream's GOP duration in seconds. A segment duration must be divisible by GOP, because GOP structure cannot be split into smaller parts. For example, for a stream with 4-second GOPs, possible segment duration is 4 seconds, 8 seconds, 12 seconds, and so on. Otherwise, Flussonic will create segments equal to each GOP in a stream.

segment_count

segment_count 4; Number of segments for buffering.

group

group sport; Used only on a source server to define the names of TV channel groups where the stream is included. Learn more

disabled

disabled; Disables the stream.

VOD settings Anchor Anchor x2

These settings are for use in the file directive, which specifies file broadcast settings. We call them options.

file

file vod {
  path /storage;
}
Complete version of the location for file playback.

cache

cache /ssd misses=5 2d 40G; All requests for files will be cached in the /ssd folder for no longer than 2 days, with the size limit of 40GB. The caching feature will turn on when one file gets more than 5 uncached requests.

domain

domain host.com; Specifies the domains where the video can be played. This does not work for those clients that do not pass the value of Referer.

domains

domains host1.com *.host2.com; Specifies the domains where the video can be played. This does not work for those clients that do not pass the value of Referer.

path

path /storage;

path s3://key:secret@s3.amazonaws.com/bucket/;
Specifies file search path. You can specify multiple search paths.

read_queue

read_queue 100; The number of simultaneous requests to disk for a given prefix.

download

download; Enables downloading the file and Range requests for it.

max_readers

max_readers 10; Specifies the max number of simultaneous disk requests to the entire prefix.

thumbnails

thumbnails offset=10; Turns on thumbnail generation with optional offset time in seconds.

auto_mbr (new in v19.02)

auto_mbr; Turns on automatic creation of a multi-bitrate HLS playlist from several files with different bitrates.