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.

If any changes have been made to configuration parameters within flussonic.conf, the Flussonic Media Server 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 specified in 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

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.

When configuring protocol HTTPS, RTMPS, RTSPS Flussonic Media Server 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 Media Server 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

Other server options

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

Stream or group settings Anchor Anchor x2

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

auth

auth http://backend/; Turning on 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 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 Media Server 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 Media Server 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.

retry_limit

retry_limit 10; This 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; This 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; 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.

segments

segments 5; Specifies the number of segments in the 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. All depends on a stream's GOPs in seconds. A segment duration must be divisible by GOP because GOP cannot be cut 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.

disabled

disabled; Stop stream.

VOD settings Anchor Anchor x2

These settings are for use in the file directive. 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 poster generation with optional offset time in seconds. The flussonic-ffmpeg package must be installed.