Flussonic Media Server documentation

Transcoder

Transcoding is an extremely resource-intensive CPU-based process and includes the following steps: decoding of the source stream, processing and coding of the raw stream according to the specified parameters. Transcoding is necessary when you want:
  • change the codec
  • change the image size
  • change the bitrate of the stream
  • create ulti-bitrate stream
  • add logo

Flussonic has a built-in transcoder.

Installation Anchor Anchor x2

To install the transcoder, you need to install flussonic-ffmpeg package from the same repository as flussonic package.
apt-get -y install flussonic-ffmpeg

Configuration Anchor Anchor x2

The transcoder is enabled as follows:
stream ort {
  url  udp://239.0.0.1:5000;
  transcoder vb=2048k preset=fast ab=128k;
}

Example of creating a multi-bitrate stream:

stream ort {
  url udp://239.0.0.1:5000;
  transcoder vb=2048k preset=fast vb=700k size=720x576 preset=fast vb=300k size=320x240 preset=fast ab=128k;
}

Video options:

  • vb - video bitrate. The value must always end with k. Each vb option creates a new video track in the output stream. Example: vb=2048k.
  • preset - same as encoder preset in ffmpeg. Example: preset=fast. Accepts the following values: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. Default value is medium.
  • size - video size. Example: size=720x400.
  • fps - frame rate. Example: fps=25.
  • deinterlace - activate deinterlacing. Example: deinterlace=1.
  • refs - number of reference frames. Example: refs=6.
  • bframes - disable b-frames. This may be necessary, for example, when broadcasting to RTSP. Example: bframes=0
  • logo - add logo.
  • crop - crop video. Available only with hardware transcoding: hw=nvenc. Usage: crop = x: y: width: height, wherex: y is the coordinates of the upper-left corner of the output video within the input video, width and height set the size of the output video.
  • vcodec - video codec. Can be set to hevc or mp2v. Default value is h264. hevc codec is not available with hw=qsv. mp2v codec is not available with hardware transcoding.
  • hw - enable hardware transcoding.
  • aspect - modify video aspect ratio, for example aspect=12:5. Aspect ratio modification is not compartible with hw=qsv option at this moment.
  • any ffmpeg options for video. For example -profile:v high -level 4.1 in Flussonic config would look as follows: profile=high level=4.1.

Audio options:

  • ab - audio bitrate. Only specified once, even if there are several audio tracks. The value must always end with k. Example: ab=128k.
  • ar - sample rate. Example: ar=44100.
  • acodec - audio codec. Accepts the following values: ac3, mp2a. By default all audio tracks are encoded with AAC.

The following protocols are currently supported: RTMP, RTSP, MPEG-TS (HTTP and UDP).

HLS protocol is partially supported - some sources may fail to be transcoded. Efficiency of transcoding of an HLS source should be tested for each individual source.

Important! Transcoding video is a resource-intensive task. Depending on the configuration, the number of channels per server may vary between 5 and 20.

Add logo Anchor Anchor x2

Flussonic can add a logo to the video:

stream ort {
  url  udp://239.0.0.1:5000;
  transcoder vb=2048k preset=fast logo=/path/to/file.png@10:10 ab=128k;
}

10:10 are coordinates of the top left corner of the screen. To place a logo in another part of the screen a slightly more complex formula should be written. For example, to place logo in the center:

stream ort {
  url  udp://239.0.0.1:5000;
  transcoder vb=2048k preset=fast logo=/path/to/file.png@(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 ab=128k;
}

To place logo in the bottom left corver:

stream ort {
  url  udp://239.0.0.1:5000;
  transcoder vb=2048k preset=fast logo=/path/to/file.png@10:(main_h-overlay_h-10) ab=128k;
}

Hardware transcoding Anchor Anchor x2

Documented here.