Flussonic Media Server Documentation

Live Streaming

Flussonic Media Server can retransmit streaming video into multiple output formats on the fly with just-in-time packaging. For example, you can ingest an MPEG-TS stream, deliver it simultaneously to thousands of subscribers in DASH or HLS format, and at the same time publish the stream via RTMP on YouTube.

Flussonic Media Server supports three types of streams:

  • static — streams that are being broadcasted all the time.
  • ondemand — streams that are requested by users (on demand).
  • live — user-published streams. See Publishing for details.


Static streams

Static streams are launched upon a start of the server. Flussonic continuously monitors static streams.

If for some reason (transcoder went off, antenna broke down) a data source goes down, Flussonic Media Server will constantly keep trying tо reconnect to the stream until success or shutdown.

Usually, IPTV channels or IP camera feeds are being configured as a static stream.

Flussonic Media Server supports many types of data sources, which must be configured with URLs.

The format of a stream definition in the /etc/flussonic/flussonic.conf file is:

stream ort {
  url udp://;

In this example:

  • ort is the name that must be used to request the stream from Flussonic Media Server.
  • udp:// is the the data source URL.

Important. The name of a stream should contain only Latin characters, digits, dots (.), dashes (-), and underscores (_). If the name contains any other characters, DVR and live streams might work incorrectly.

To add a stream via the web interface:

Go to the Media tab.


Click add next to Streams.


Then enter the name of the stream and the data source URL. Click create and Flussonic will add the stream to the list.

By default, new streams are static. To change the stream type to on demand, click static next to the stream name.

After the stream is added, you can go to the stream settings page and check the ingest status:


On-demand streams

If the stream is not needed all the time but only upon user's request, you can configure Flussonic Media Server to turn it off when it is not being used and turn it back on when it is requested.

To specify this kind of behavior, change the stream type to ondemand:

ondemand ipcam {
  url rtsp://localhost:554/source;

Important. If Media Server ingests the ondemand source stream using RTMP, RTSP, or HTTP MPEG-TS protocols, there will be some complications with outputting HDS or HLS streams. This is because those streaming protocols require 10-30 second buffering. The player will not start playback until its buffer is filled, so the first user who initiated playback would need to wait until the system is ready. The only data source that doesn't have this problem is another Flussonic server with HLS protocol. Flussonic Media Server uses its own extensions that allows for instant playback on iPhone.

You can specify the stream's lifetime after a client has disconnected:

ondemand ipcam {
  url rtsp://localhost:554/source;
  retry_limit 10;
  client_timeout 20;

The config line above has the following meaning: make no more than 10 attempts to reconnect with a data source if the connection is lost; when the last client leaves, run keep fetching the stream for no longer than 20 seconds.

Stream playback

How to playback streams, learn in Video playback.

Multi-bitrate streams

To merge two independent sources of the same content to create a multi-bitrate stream, use the option mbr=1.

Learn more in the section about multi-bitrate streams from two sources.

Stream screenshots in JPEG

Flussonic Media Server can generate JPEG thumbnails of a streaming video. To use this feature, add the thumbnails option in the stream settings:

stream example {
  url fake://fake;

Alternatively, to reduce CPU usage, you can specify an URL where Flussonic Media Server can get JPEG thumbnails. Many IP cameras have a special URL with screenshots:

stream example {
  url rtsp://localhost:554/source;
  thumbnails http://localhost:5000/snapshot;

You can find the screenshot URL in the documentation for you camera model.

The latest screenshot of a stream is available at http://flussonic:8080/ort/preview.jpg

An MJPEG screenshot of a stream is available at http://flussonic:8080/ort/preview.mjpeg

See also:

Substituting a stream with a file

If a stream becomes unavailable, Flussonic can substitute it with a fallback video from a video file that you specify using backup <VOD location>. This works for any live streams, including published ones.

stream example {
  url tshttp://;
  backup vod/bunny.mp4;

You need to specify the path to the fallback file relative to the VOD-location, for example vod/backup.mp4. Do not use absolute paths for video files.

Note If the original stream has no audio (for example, a stream from an IP camera), the substitute file must have no audio as well.

By default, the fallback file is not recorded to the archive and is not transcoded. However, you can configure it.

How 'backup' is different from 'url file://'

Unlike source switching with the source url file://<VOD location>, when a fallback file is used, Flussonic technically does not switch to another source. This is especially useful for published streams to prevent numerous closings of a socket with a publishing client.

The fallback file specified in backup <VOD location> is not transcoded and not written to DVR, unless you configure otherwise. The file source url file://<VOD location> is always written to DVR.

When use backup instead of url file://:

  • In case of poor connection with the client that publishes video, Flussonic continues to receive frames without interrupting the connection with the client. This allows the client to continue the publishing session without having to start it over each time the source was switched. When the published stream disappears, viewers see the fallback file and understand that the broadcast is not over yet.

  • When all sources are unstable and Flussonic switches between them too often, it is better to show a fallback file. If you use a file as one of the sources, viewers will see any video only after timeouts pass for each of the troubled sources.

  • If you write the main stream to DVR and do not want to write the file too in order to prevent the file from appearing in the archived video.

  • Using options like timeout for the main stream and the fallback file, you can manage which source to show during a publication session.

Fallback file options

The fallback file takes the following options:

backup vod/backup-file.mp4 timeout=2 dvr=true transcode=true

  • dvr=true — if the main stream has a configured DVR, then the fallback stream will be recorded to the archive too:

    stream example {
        url udp://;
        backup vod/bunny.mp4 dvr=true;
        dvr /storage;

  • timeout=10 — the time (in seconds) for Flussonic to switch to the fallback source if the main source stops sending frames. The important thing here is that the source remains active (connected), allowing for a client-publisher to stay on the socket.

    If you do not specify timeout specifically for a fallback source, then in the absence of frames, source_timeout of the main source will be used.

    By using timeout andsource_timeout together, you can:

    • Set a longer timeout so that mobile clients manage to start streaming without being disconnected
    • At the same time, switch to the fallback source as soon as possible.

    For example, a WebRTC client app will stay connected for the specified time when the source stops sending frames. The fallback file is played during this time.


    stream example {
        url publish:// source_timeout=20;
        url fake://fake;
        backup vod/bunny.mp4 timeout=1;

    In this example:

    Before the publication begins, the fake stream is played. Then the client app connects to Flussonic to stream video to it. If, after the connection was established, no frames arrived from the client during 20 seconds, then the client is forcibly disconnected and the demo source starts playing.

    After the start of publication, if for 1 second there are no frames from the published stream, the file backup-file.mp4 starts to play. However, the publication source is not disconnected yet.

    When the source resumes sending frames, the stream switches to the publisher client and the published video is played. However, if the source does not resume sending frames during 20 seconds, then the publisher client is forcibly disconnected and the demo source starts playing.

  • transcode=true — see Transcoding the Fallback File further on this page.

Transcoding the fallback file (v20.03)

  • transcode=true — if the main stream is transcoded, then the fallback file will be transcoded too with the same parameters as the main stream.

    stream backup_transcode {
        url udp://;
        source_timeout 5;
        backup vod/bunny.mp4 transcode=true;
        transcoder vb=1000k ab=64k;

    This allows you to change transcoding parameters without the need to transcode the fallback file with new parameters. This also makes it unnecessary to prepare several fallback files with different bitrates.


Sometimes the names of streams on a remote server are not known in advance, and you need to receives all the streames from that server. In situations like this use a special stream type (rewrite):

rewrite nsk/* {
  url rtsp://localhost:555/%s;
rewrite ams/* {
  url hls://localhost:8081/%s/index.m3u8;

Here, the rewrite directive is combined with an asterisk character (*) at the end of a stream name. This means that the substring that precedes the asterisk will replace "%s" in the URL.

Recording video streams (DVR)

Flussonic Media Server has a built-in state-of-the-art stream recording system.

The stream archiver can record video, provide access to a particular video interval, export parts of the archive as MP4 files, clean up old archive files, and maintain ample free space on the storage disk.

To turn on the archiver, specify the dvr option in a stream settings:

stream foxlive {
  url tshttp://trancoder-5:9000/;
  dvr /storage 90% 5d;

For details, see archive management.

Time zone adjustment (Timeshift)

Flussonic Media Server can play the archive record of a stream with a fixed delay.

Note that Flussonic Media Server maintains the exact delay, so if for some reason the archive has gaps, end users will be getting no video for the duration of a gap.

The timeshift feature has its own data source schema — timeshift://:

stream channel {
  url tshttp://trancoder-5:9000/;
  dvr /storage 90% 5d;
stream channel-2h {
  url timeshift://channel/7200;

The delay is specified in seconds.

Stream delivery over UDP multicast

Flussonic Media Server can rebroadcast a stream from a data source over the local network.

Flussonic Media Server demonstrates next-to-ideal jitter values when streaming multicast UDP over the network.

stream ort {
  url tshttp://localhost:8080/origin/mpegts;

Stream settings for IP surveillance cameras

It is possible to configure Flussonic Media Server to request a stream from camera via UDP only. This might be useful when dealing with cameras that have issues with streaming over TCP.

stream cam1 {
  url rtsp://localhost:553/bunny.mp4;
  rtp udp;

Important! The HEVC (H.265) video codec is supported only in Microsoft Edge (version 16 and higher) and Safari (version 11 and higher) on desktops, and in Safari and Chrome for iOS (version 11.0 and higher) on mobile devices. All other browsers cannot play H.265 video streams. More on this in Playing H265.

If there is no need to retrieve audio from a camera (for example if the audio is encoded in G.726), you can configure Flussonic Media Server to ingest only one track. The number of the track must be specified in the stream settings:

stream cam1 {
  url rtsp://localhost:553/bunny.mp4;
  tracks 1;

In order to transcode an audio stream from G.711a or G.711u into the AAC codec, use the protocol rtsp2:

stream cam1 {
  url rtsp2://localhost:553/bunny.mp4;

Turning on audio-only HLS

When approving apps for publishing in AppStore, Apple may require the stream to have an audio-only version. To satisfy this requirement, add add_audio_only directive to the configuration:

stream cam1 {
  url fake://fake;

With this directive, if the stream contains both audio and video, Flussonic will generate multibitrate playlist with two profiles - one with audio only and another with audio and video tracks.

Capturing stream from another Flussonic Media Server

The details of transferring video between Flussonic Media Server servers are discussed in Flussonic video stream clusterization.

DRM in live

The details are discussed in the DRM article.

Silence detection

Flussonic can detect low sound level (no sound) in sources of input streams and notify about it. See Silence detection for details.

Stream and group settings

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


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


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 CA US UK; The list of two-character codes of countries where the access is allowed (for code reference see the MaxMind database).


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 source1 source2; A list of data source URLs. More info about switching sources.


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 /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 /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 multicast_loop;

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;. To set constant bitrate (CBR) use: udp;, where 2000 is the bitrate in kbit/sec.


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


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 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 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 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 secret; The password that will be passed via query string (http or rtmp) for publication in a stream or group.


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


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. You can manage the backup file with additional options described in [Substituting a stream with a file](#backup)

url publish://

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


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 1000; Sets the limit on the number of sessions for the stream.


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


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 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 1000; Sets the bitrate limit for the stream that is being published.


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 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 16# prefix.

For UDP2 (push udp2://), there is [its own way to list PIDs](/doc/play/multicast-send#udp2).


meta program_id "10"; This parameter sets the program identifier in the output MPEG-TS stream.


provider Flussonic; This parameter sets the program provider title in the output MPEG-TS stream.


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 4; Specifies the number of segments in HLS and HDS playlists.


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


disabled; Disables the stream.