Flussonic Media Server documentation

Dynafile

Flussonic Media Server can transcode VOD content on fast. We do not recommend using this feature, because this is a very expensive operation and it is impossible to predict the load on the processor. It is more correct to prepare the content in advance and hand out without a transcoder.

You can use a transcoder to impose a unique watermark for each viewer. For example, to determine through whom the content leakage has left.

Configuration Anchor Anchor x2

The plugin is activated via the configuration file. Open /etc/flussonic/flussonic.conf and add:

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

In this example, we will code in two qualities and use hardware acceleration. You must specify a directory for caching.

Important! The dynafile plugin activates transcoding at once for all VOD locations. You can not enable transcoding for only one directory.

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

  • http://flussonic-ip/vod/bunny.mp4/embed.html — viewing directly, without a transcoder.
  • http://flussonic-ip/dynafile/vod/bunny.mp4/embed.html — viewing through the transcoder.

Overlay watermark Anchor Anchor x2

Flussonic Media Server can impose a unique watermark (logo) for each viewer. To do this, configure the authorization backend to return the PNG image in base64 format.

Below is the lua-backend code that will query 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:

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;
}