Skip to content

How to make a DVB-compatible stream with constant bitrate

Flussonic Media Server allows you to create DVB-compatible streams with constant bitrate (CBR). Actually, it is impossible to encode a video stream with constant bitrate due to different size of different types of frames. However, DVB standard for television requires a constant bitrate, and also the transmission channels have their requirements. Flussonic solves a number of problems to make a video stream compatible with such requirements.

The Flussonic encoder uses a combination of techniques to make all frames fit the allowed size; and if frames occupy less bytes than required it fills the frames with data up to the required size. In this way, Flussonic parses a stream to every single frame and produces fully DVB compliant streams.

The resulting stream can be used as one of the programs in an MPTS or sent as SPTS multicast.

You can make a CBR stream in two ways:

  1. Specify the bitrate directly in the parameters of the push directive when sending a multicast.
  2. Fine-tune the transcoder using additional parameters to ensure compatibility with DVB.

Feel free to use these methods together or separately testing the optimal combination for your conditions.

Setting the bitrate in push parameters

You can send a multicast with constant bitrate in the UI by setting the Average bitrate and Bitrate parameters, or in the config file using the vb and bitrate options:

stream tvchannel {
  input udp://239.171.0.1:1234;
  push udp://239.172.0.1:1234 bitrate=3200 vb=2720;
}

The bitrate and vb are optional parameters. If you don't specify them, Flussonic will calculate a suitable bitrate automatically and send a stream with the calculated constant video bitrate. You may want to specify them in order to get a constant bitrate immediately when starting a stream, then Flussonic will check the optimality of the specified values. If you specify non-optimal bitrate andvb, Flussonic will adjust them for the real video stream itself.

The option vb (video bitrate) is the average bitrate per second that you can send of a video stream, including all the headers and encapsulation in the transport stream. So, for example, the value of vb=2720 approximately corresponds to the bitrate 2600 specified in the transcoder settings.

Transcoder configuration for DVB-compatible stream

Use the rc_method=cbr transcoder option to make the constant bitrate stream. Read more about this and other below options in the transcoder options reference.

To make sure your stream is DVB compatible, you may need to use additional parameters to transcode the video track. Below is a typical transcoder configuration for an SD MPEG-TS stream.

stream sports {
    input fake://fake;
    transcoder external=true gop=28 hw=cpu seamless=false vb=1100k bframes=3 vcodec=h264 b-pyramid=strict bufsize=950000 maxrate=1150000 x264opts=videoformat=component:no-scenecut:force-cfr:weightb=0 level=3 open_gop=true preset=fast refs=4 size=1280x720:scale deinterlace=true ab=64k acodec=mp2a;
}

Warning

Note that you should transcode on CPU hw=cpu. No other hardware does not support the below options.

  • b-pyramid=strict allows B-frames to refer to other B-frames, thereby increasing the efficiency of using 2 or more B-frames. Helps achieve a smooth playback of DVB streams if you use the CPU-based transcoder with interlace=true. This option sets the half-frame sequence in the interlaced video to top_first.

    Supported values: * none forbids the use of B-frames as reference. * strict allows 1 reference B-frame per minigop (complies with the Blu-ray standard). * normal allows multiple use of reference B-fremes per minigop. Do not use for Blu-ray.

    Use with bframes more than 2.

  • open_gop=true provides better quality at a lower bitrate by allowing B-frames to refer to I and P frames beyond GOP boundaries, i.e. disables IDR. Do not use with playback via segment protocols like HLS, DASH, etc.

  • bufsize=950000 and maxrate=1150000 allow you to control the bitrate of the video track. Set maxrate exploratorily according to the specified values of vb and bufsize using the formula bufsize = maxrate*(multiplier from 1 to 2).
  • x264opts=no-scenecut:force-cfr:weightb=0:

    • no-scenecut allows the encoder to optionally insert an I-frame into the stream, to prevent degradation of the stream quality if there is an abrupt scene change that would require a full reference frame.
    • force-cfr enables generation of own x264 timecodes. When using this option, it is recommended to set a fixed FPS value.
    • weightb=0 disables B-frame weighted prediction to get rid of the influence of this parameter.