Flussonic Media Server documentation

UDP Multicast with Constant Bitrate

Flussonic Media Server 20.07 has a completely re-worked system of sending multicast with a constant bitrate. We have added two important improvements:

Before

Previously Flussonic already allowed sending a stream to UDP multicast with a constant bitrate, but this applied to the entire stream and not to individual tracks in it (PIDs).

This is how the configuration for sending a stream to multicast looked in earlier Flussonic versions:

stream tvchannel {
  url udp://239.0.0.1:1234;
  push udp://239.1.0.1:1234?cbr=4000&pcr=20;
}

The resulting bitrate is visualized on the following graphs:

CBR MPTS

CBR MPTS

As you can see, the total chart is quite stable, but individual PIDs jump significantly.

The old system had drawbacks:

  • If one audio PID is cut out of such a stream, most likely it will cease to be CBR and the accuracy of PCR stamping will be definitely broken in it.
  • It has a very large traffic of null packets, more than is really required.
  • When reading such a stream, part of client devices will freeze, because it does not withstand the full buffer of the receiver. The following graph shows that the decoder buffer, which is controlled by DTS and PCR, is constantly emptied:

CBR MPTS

Now

In Flussonic 20.07 sending a stream to multicast is configured as follows:

stream tvchannel {
  url udp://239.0.0.1:1234;
  push udp2://239.2.0.1:1234 bitrate=3200 vb=2720;
}

Important! You'll need to specify vb (video bitrate) as accurately as possible. This is the average per second bitrate 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.

A reference example of the transcoder configuration:

stream tvchannel {
  url udp://239.0.0.1:1234;
  transcoder vb=2600k bf=3 open_gop=true rc_method=cbr vui_video_params=0:0:5:5:5 fps=25 g=28 interlace=tff_separated level=3 refs=4 sar=16:11 size=1048x576:scale external=false hw=qsv ab=192k acodec=mp2a;
  push udp2://239.2.0.1:1234 bitrate=3200 vb=2720;
}

Such a stream is represented as follows on the graphs of the DVB analyzer:

CBR MPTS

CBR MPTS

Most importantly, the buffer graph looks perfect:

CBR MPTS

What is this buffer? It is CPB, coded picture buffer, that is, this is a frame buffer. It is replenished when frames come from the transport stream and is deleted when PCR >= DTS occurs. That is, each frame has a DTS and this frame will be kept in the buffer until the time comes to send it to the decoder. The time comes when the corresponding PCR arrives.

Also pay attention to the good quality of packets distribution:

CBR MPTS

The more evenly the distribution, the more stable the PCR and the overall bitrate will be when one of the PIDs is removed from the stream.

That is not all. We have achieved the challenging goal — creating an output MPTS stream (multiprogram transport stream).

Creating an output MPTS stream

For sending streams to MPTS the transponder directive is used:

stream channel1 {
  url udp://239.0.0.1:1234;
}
stream channel2 {
  url udp://239.0.0.2:1234;
}
transponder tp1 {
  bitrate 6400;
  ts_stream_id 2;
  provider Flussonic;
  push udp://239.1.0.1:1234 multicast_loop;
  push file://dumpts.ts;
  program 1010 {
    source channel1;
    title Channel1;
    vb 2720;
    pid 1010 pmt;
    pid 1011 v1 pcr;
    pid 1012 a1;
    pid 1013 t1;
  }
  program 1020 {
    source channel2;
    title Channel2;
    vb 2720;
    pid 1010 pmt;
    pid 1021 v1 pcr;
    pid 1022 a1;
    pid 1023 t1;
  }
}

The result is represented as follows on the graphs of the DVB analyzer:

CBR MPTS

CBR MPTS

CBR MPTS

This stream can be safely fed to the modulator and sent to the cable network, broadcast or satellite. Flussonic has a ready multiplexer for transport streams.

The packaging of EPG (EIT), HbbTV and other modern things MPEG-TS needs are planned in future versions.