Flussonic Media Server documentation

Dynafile

Flussonic Media Server can transcode VOD content on the fly.

You can also use the transcoder to overlay a unique, per-user watermark on top of the video stream. This feature can be used to, for example, determine the source of a content leak.

Configuration Anchor Anchor x2

The plugin is disabled by default, and must be activated through the configuration file. Open /etc/flussonic/flussonic.conf and add the entry:

plugin dynafile {
  cache /tmp/dynacache 2G;
  transcoder vb=2048k size=1280x720 vb=600k size=360x-1 hw=nvenc;
}

In the above configuration, all VOD files will be transcoded into two profiles, using NVENC hardware acceleration. Note that a cache directory must be specified with the cache directive. Learn more about transcoder options here.

Important! The dynafile plugin transcodes video files in every VOD location. You cannot configure transcoding for specific directories.

To view the video through the plugin, you need to add /dynafile/ to the URL:

  • http://flussonic-ip/vod/bunny.mp4/embed.html — viewing a VOD file directly, without on-the-fly transcoding.
  • http://flussonic-ip/dynafile/vod/bunny.mp4/embed.html — viewing a VOD through the dynafile plugin.

Overlay watermark Anchor Anchor x2

Flussonic Media Server can impose a unique, per-user watermark (logo) on a video stream. To do this, an authorization backend must be configured to output PNG images in base64 format.

Below is a lua-backend script that will request a logo from an external system and give it to the transcoder:

prepare = function(key)

  name = string.gsub(req.name, "vod/", "")
  qs = {ip = req.ip, token = req.token, name = name, resolution = key}
  url = "http://example.com/getWatermark?"..http.qs_encode(qs)
  response = http.get(url, 10000)

  if not (response.code == 200) then
    return false,{code = response.code}
  end

  png = base64.decode(response.body)
  -- path = "/tmp/"..crypto.sha1(key..name..request.token)..".png"
  return png
end

extra = {}

string.gsub(req.sizes, "([^,]+)", function(w) extra[w] = prepare(w) end)

flussonic.log(table.tostring(req))
return true,{extra = extra}

Save this file to /etc/flussonic/dynafile.lua and configure Flussonic Media Server to use the new authorization backend:

file vod {
  path /storage/vod;
  cache /tmp/cache 10G;
  auth /etc/flussonic/dynafile.lua;
}
plugin dynafile {
  cache /tmp/dynacache 2G;
  transcoder vb=2048k size=1280x720 vb=600k size=360x-1 hw=nvenc;
}

Caution Anchor Anchor x2

Using the dynafile plugin is far more computationally intensive than serving already-transcoded content. It is impossible to predict how resource-hungry the process will be.