Flussonic Media Server Documentation

UDP Multicast with Constant Bitrate

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

  • Flussonic can keep a constant bitrate in the output video stream
  • Flussonic can prepare the MPTS output (multi-program transport stream).

Flussonic version 20.09 supports advanced MPTS settings:

Work and configuration of UDP multicast: before and now

Before

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

Note. The transcoding options interlace and rc_method are described in transcoder settings reference.

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;
    pid 1010 pmt;
    pid 1011 v1 pcr;
    pid 1012 a1  bitrate=150;
    pid 1013 t1;
  }
  program 1020 {
    source channel2;
    title Channel2;
    pid 1010 pmt;
    pid 1021 v1 pcr;
    pid 1022 a1 bitrate=128;
    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.

Choosing output tracks

Tracks in the transponder settings are specified as follows:

  program 1020 {
    source channel2;
    title Channel2;
    pid 1010 pmt;
    pid 1021 v1 pcr;
    pid 1022 a1;
    pid 1023 t1;
  }

An ingested stream might contain a lot of tracks with subtitles, audio, video and so on, and you will probably not need all of them in an output MPTS stream.

You can specify which track to include into output MPTS by assigning it to a PID. Now only tracks with an assigned PID will be sent to transponder or pushed to UPD2.

If no tracks were specified, all of them will go to output MPTS with automatically assigned PIDs. But if at least one track was specified, then other tracks will not be includede in the output.

This eliminates the need to create an additional stream to ingest only the tracks you want and then push this stream to MPTS.

Settings bitrates of tracks

We recommend specifying bitrates in transponder as follows:

  program 1020 {
    source channel2;
    title Channel2;
    pid 1010 pmt;
    pid 1021 v1 pcr;
    pid 1022 a1 bitrate=150;
  }

This allows you to adjust bitrates to better utilize bandwidth, by changing bitrates right during MPTS broadcast.

Advanced settings of MPTS (Flussonic 20.09)

SI table options

Flussonic 20.09 allows you to generate more complicated NIT containing LCN (logical channel number), T2 delivery system descriptor, and more options. Some of the options are included also in SDT.

Flussonic implements the configuration options in accordance with NorDig Unified Requirements for Integrated Receiver Decoders version 3.1.1 of NorDig.

You can add the following advanced options to the transponder:

  • network 13582 original=8833 name="Example network"; — delivery network. The same original (original network) is used for NIT and SDT.

  • ts_descriptor 0x04 04012283; — the tag and the HEX data of a descriptor. Any descriptor can be specified using this option. ts_descriptor for NIT ts_loop. In the example, the T2 delivery system descriptor is specified. Added to NIT and SDT.

  • ts_stream_id 2; — Added to NIT and SDT.

  • service_type — used like program P { service_type 0x16;} If the program has source specified, but service_type is not specified, then Flussonic tries to guess service_type by the received media_info.

  • timeout service_type 10; — if the source has not recovered during 10 seconds, then Flussonic excludes this program from broadcast. The default timeout is 15 seconds.

  • program P { lcn 7 [visible=false];} — logical channel number.

Versions of PSI tables

PSI tables have a version_number field. When you make a change to a table, the current version_number value in it should be incremented. This will signal the receiving devices (TV sets) to re-read the TS content. Flussonic supports specifying the version number in the transponder settings. This way, devices can apply or prepare for changes in the stream.

  • version psi VERSION_NUMBER — global version for all PSI tables.

  • version sdt VERSION_NUMBER — the version of a specific SI table, for example, SDT.

TOT (time offset table)

Flussonic generates the PSI table TOT (time offset table). It makes sense to specify TOT settings only in the main transponder, and not in other transponders (other).

Add the following options to the main MPTS stream configuration:

time_offset FRA:1 time_of_change=2018-03-23T03:00:00Z local_time_offset=+0100 next_time_offset=+0100;

Option meaning can be found in the specification

Example

The example of transponder configuration with advanced options:

transponder ts-tp {
  push udp://239.1.2.4:1234 multicast_loop;
  push file://tmp/ts-tp.ts pkt_limit=300000;
  bitrate 27000;
  provider Flussonic;
  network 123123 original=12345 name="Example network 1";
  ts_stream_id 2;
  ts_descriptor 0x7f 040012340325; # T2_delivery_system_descriptor
  version psi 4;  # default
  version sdt 9;
  time_offset RUS:7 time_of_change=2018-03-23T03:00:00Z local_time_offset=+0600 next_time_offset=+0600;

  interval pcr 30;
  timeout service_type 10;

  program 1020 {
    source clock;
    title Channel1;
    lcn 2;
    pid 1120 pmt;
    pid 1121 v1 pcr bitrate=500;
    pid 1122 a1 bitrate=150;
  }
  program 1030 {
    title Channel2;
    lcn 3 visible=false;
    service_type digital_tv_mpeg2_hd;
  }
  program 1040 {
    title Channel4;
    lcn 4;
  }

  other @02;
}

transponder 02 {
  bitrate 0;
  network 123123 original=12345 name="Another network";
  ts_stream_id 1;
  ts_descriptor 0x7f 040033123325;
  program 1010 {
    lcn 1;
    service_type digital_tv_mpeg2_hd;
  }
  program 1070 {
    lcn 7;
    service_type 0x20;
  }
}

Adding links to other transponders

For the TV service, it is necessary that all channels included in the service are known to be displayed on client devices. Each transmitted transponder (MPTS stream), which contains only a part of the channels, must contain information about all the other channels transmitted from the satellite at other frequencies.

For example, 10 channels are transmitted on one frequency (MPTS stream, or in a transponder), and there are 40 frequencies in total, therefore, there are 400 channels, and information about them must be transmitted in each MPTS stream. To achieve this, add to each MPTS stream links to the configurations of other MPTS streams that are part of your service.

To add one such link, specify the name of another MPTS stream in the other option.

transponder ts-tp {
  push udp://239.1.2.4:1234 multicast_loop;
  push file://tmp/ts-tp.ts pkt_limit=300000;
  bitrate 27000;
  provider Flussonic;
  network 13582 original=8833 name="Example network 1";

  program 1020 {
    source clock;
    title Channel1;
    lcn 2;
    pid 1120 pmt;
    pid 1121 v1 pcr bitrate=500;
    pid 1122 a1 bitrate=150;
  }


  other @02;
}

transponder 02 {
  bitrate 0;
  network 13582 original=8839 name="Another network";
  ts_stream_id 1;
  ts_descriptor 0x7f 040022830325;
  program 1010 {
    lcn 1;
    service_type digital_tv_mpeg2_hd;
  }

}

The transponder specified in other is carried in NIT and SDT.