Flussonic Media Server documentation

Configuring the Flussonic server

Flussonic configuration management Anchor Anchor x2

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

If any changes have been made to configuration parameters within flussonic.conf, the Flussonic service must be reloaded 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 — login & password in the api section (see below).

To restart the server itself:

/etc/init.d/flussonic restart

The server's global options Anchor Anchor x2

https 443; turns on accepting HTTPS requests via the specified port. Multiple ports can be specified with multiple lines.

https 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.

When configuring protocol HTTPS, RTMPS, RTSPS Flussonic expects the availability of certificates in the directory /etc/flussonic. For what would RTMPS protocol to work, you must have a valid certificate, which works without any warnings or errors.

Flussonic expects the private key of the server in the file /etc/flussonic/flussonic.key with password flussonic. The server certificate will be read from the file /etc/flussonic/flussonic.crt. Intermediate and CA certificates will be taken from /etc/flussonic/flussonic-ca.crt.

For example, upon receipt of the purchased set of keys and certificates, it is necessary to 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

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 it is not found within the query string.

auto_token blank;
if this option is specified, a blank authorization token will be accepted, provided 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 & 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 http://backend/event.php;
notify /etc/flussonic/events.lua;
all internal events will be sent to the specified URL or script

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 { }
this directive turns on automated stream repeating to the local server from a remote one. please see below for the source directive's options.

stream ntv tshttp://source/ntv.ts;
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 tshttp://source/ntv.ts;
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/* rtmp://origin/%s;
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;
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 /storage;
file vod { path /storage; }
the file directive turns on casting 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;
configures a global cache named globalcache in the /var/www directory, with the limits of 40 gigabytes and 2 days, and the program beginning to put files in the cache only after 4 cache misses.

Stream or group settings Anchor Anchor x2

auth

auth http://backend/; Turning on authorization for a stream. See more under the authorization section.

domain

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 palyer).

allowed_countries

allowed_countries RU US CN; 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 for 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 instance 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; Turning on archiving feature. This command tells Flussonic to store archived data in the /storage/streamname directory and clean up that directory either once a day or when the disk gets 50% full. Instead of days, hours can be specified: 20h. Parameter schedule allows you to set a schedule on the DVR the form of intervals. The time is specified in UTC in hours and optionally with minutes, the interval can overlap 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, the stream will not turn on archiving on start. It 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 causes Flussonic to send the stream via MPEG-TS over UDP.

To set MULTICAST_TTL parameter on UDP socket use following syntax: udp 239.0.0.1:5001?ttl=8;.

To set constant bitrate (CBR) use following syntax: udp 239.0.0.1:5001?cbr=2000;, where 2000 is bitrate in kbit/sec.

thumbnails

thumbnails; Turns on generation of stream preview thumbnails. The flussonic-ffmpeg package must be installed.

segments

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

retry_limit

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

clients_timeout

clients_timeout 10; This sets the time period (in seconds), for which Flussonic 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 will wait for new frames to come from the data source. When this time passes, Flussonic will attempt to reconnect to the data source. Default source_timeout is 60 seconds.

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; This option tells Flussonic to 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 while the video from the data source is unavailable.

publish_enabled

publish_enabled; Specifying this option for the stream allows to publish video into it. Meaningless for a group of streams.

on_publish

on_publish http://host/publish.php; on_publish /etc/flussonic/publish.lua; Causes publishing to this stream or stream group to call a script or send HTTP request with such parameters as the stream name, publisher's IP, etc. In response it is possible to refuse publication or allow: 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 quantity of sessions for the stream.

settings_rtp

rtp udp; Turns on obligatory use of UDP for working 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 the app in Apple devices.

no_prepush

no_prepush; Turns off the quick-start prepush feature. Might be useful for keeping real-time streaming.

prepush

prepush 10; Enables a buffer of specified duration, in seconds. If the client's connection to the server is interrupted or slowed down, it plays video from the buffer, which allows the player to start faster, but with a lag.

max_bitrate

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

logo

Version 4.6.15 and above. 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 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 stream. It is possible to set PID for PMT, STD and tracks. Tracks numbered starting from one: a1=123 sets PID for the first audio track. It os possible 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.

gop_duration

gop_duration 8; GOP size (GOP duration), interval between keyframes.

segment_count

segment_count 4; Number of segments for buffering.

disabled

disabled; Stop stream.

VOD settings Anchor Anchor x2

file

  • file vod /storage; shortened version of the prefix for file playback.
  • file vod {path /storage;} complete version of the prefix 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.
  • cache @globalcache; all requests for files will be cached in the global cache globalcache.
  • cache globalcache /ssd misses=5 20d 800G; specifying global cache for different file prefixes. all requests for files will be cached in the /ssd folder for no longer than 20 days, with the size limit of 800GB. 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 poster generation with optional offset time in seconds. The flussonic-ffmpeg package must be installed.