Streaming over UDP
MWriter example configuration string:
format='dvb' protocol='udp://' video::codec='mpeg2video' video::b='5M' audio::codec='aac'DVB-compatible MPEG-TS over RTP
The MFormats release notes and MPlatform release notes list DVB-compatible MPEG-TS streaming over RTP as added in SDK version 2.12.0.14909.
Select format='dvb' together with protocol='rtp://'. This mode applies DVB MPEG-TS settings and bitrate smoothing while transmitting MPEG-TS inside RTP packets.
format='dvb' protocol='rtp://' muxrate='7M' video::codec='mpeg2video' video::b='5M' audio::codec='aac' audio::b='128K'Pass the destination separately from the configuration string. For example, a multicast destination is:
rtp://239.1.2.3:12345A unicast destination can also be used. Replace the address and port with those required by your receiver.
This configuration differs from format='rtp_mpegts', the ordinary MPEG-TS over RTP mode described in RTP Streaming. Use the explicit format='dvb' protocol='rtp://' combination for the DVB settings and bitrate smoothing described here.
MPlatform: connect a source to MWriter
Configure an existing MWriter instance with WriterNameSet, then connect it to your prepared source with ObjectStart. In this example, pSource is the source object supplying the media.
string destination = "rtp://239.1.2.3:12345";
string configuration = "format='dvb' protocol='rtp://' muxrate='7M' video::codec='mpeg2video' video::b='5M' audio::codec='aac' audio::b='128K'";
m_objWriter.WriterNameSet(destination, configuration);
m_objWriter.ObjectStart(pSource);MWriter receives media through the connected source. Close the writer with ObjectClose when streaming is finished.
MFormats: submit frames to MFWriter
Configure an existing MFWriter instance with WriterSet. Your application then obtains frames from its source and submits each frame with ReceiverFramePut.
string destination = "rtp://239.1.2.3:12345";
string configuration = "format='dvb' protocol='rtp://' muxrate='7M' video::codec='mpeg2video' video::b='5M' audio::codec='aac' audio::b='128K'";
m_objWriter.WriterSet(destination, 1, configuration);
// In your frame loop, submit each source frame:
m_objWriter.ReceiverFramePut(pFrame, 0, "");Continue submitting frames for the required streaming duration. Release each frame after processing and close the writer with WriterClose when finished.
Bitrate and network timing
Specify muxrate with enough room for the video, audio and MPEG-TS overhead. The original UDP example uses this estimate:
muxrate = (video_bitrate + audio_bitrate)*1.25The MPEG-TS stream is padded with null packets to reach the configured transport-stream rate. For example:
format='dvb' protocol='udp://' muxrate='7M' video::codec='mpeg2video' video::b='5M' audio::codec='aac'For RTP output, muxrate measures the MPEG-TS payload rate. It excludes the RTP header. RTP, UDP, IP and link-layer overhead increase the total network bitrate, so muxrate='7M' does not mean a total network bitrate of exactly 7 Mbit/s.
Keep the connection between the encoder and receiver stable and reliable. Network delivery problems can cause PCR and other timing errors at the receiver.
Program Clock Reference (PCR) provides timing information that the receiver uses to synchronize the stream. Its required repetition interval depends on the applicable standard and stream configuration. See ETSI TS 101 154 for further information.
For example, when an encoder is in network A and its receiver is in network B, assess timing at the receiver as well as at the encoder. A correctly generated stream still needs reliable delivery between the two networks.
DVB streaming attributes
The following table preserves the settings and default values originally documented for UDP streaming. Defaults depend on the SDK version and selected transport; check your writer configuration before relying on them. In particular, these historical UDP defaults are not the defaults for the RTP mode.
| Name | Originally documented UDP default | Description |
|---|---|---|
| embed_cc | false | Enable embedding Closed Captions (ATSC) into an elementary video stream. |
| embed_scte35 | false | Enable embedding SCTE-35 triggers into the MPEG transport stream. |
| service_name | MPService001 | Set Service Name. |
| service_provider | Medialooks | Set Service Provider. |
| transport_stream_id | 1 | Set the transport_stream_id field. |
| original_network_id | 1 | Set the original_network_id field. |
| muxrate | 1 | Set the MPEG-TS transport-stream bitrate, including media, transport-stream overhead and null-packet padding. For RTP output, this is the MPEG-TS payload rate and excludes the RTP header. Set an explicit bitrate when a constant rate is required. |
| service_id | 1 | Set the service_id field. |
| service_type | digital_tv | Set Service type. Possible values: digital_tv, mpeg2_digital_hdtv, advanced_codec_digital_sdtv, advanced_codec_digital_hdtv, hevc_digital_hdtv. |
| pmt_start_pid | 129 | Set the first PID of the PMT. Possible values: 16 to 7936. |
| start_pid | 1024 | Set the first PID. Possible values: 256 to 3840. |
| pes_payload_size | 2930 | Minimum PES packet payload in bytes. |
| mpegts_flags |
MPEG-TS muxing flags. Possible values include:
|
|
| start_timecode | auto | Set the start timecode for encoding. Possible values: auto, disabled, local_time, or a custom string such as "10:00:00:00". |
| resend_headers | 0 | Reemit PAT/PMT before writing the next packet. For the RTP mode, use the resend_headers flag in mpegts_flags. |
| tables_version | 0 | Set PAT, PMT and SDT version. |
| rc_buffers | 4 | Rate-Control buffers. |
| pcr_period | 20 | Override the PCR retransmission time in milliseconds. |
| pat_period | 0.1 | PAT/PMT retransmission time limit in seconds. |
| sdt_period | 0.5 | SDT retransmission time limit in seconds; -1 disables transmission. |
| nit_period | 3 | NIT retransmission time limit in seconds; -1 disables transmission. |
| tdt_period | 10 | TDT retransmission time limit in seconds; -1 disables transmission. |
| eit_period | 0.5 | EIT present/following retransmission time limit in seconds; -1 disables transmission. |
| start_pcr | 0 | Set the start PCR value in seconds. |
| muxer.buffer_min | 0 | Set the minimum muxer buffer value. |
| muxer.buffer_max | 0 | Set the maximum muxer buffer value. |
Still have questions?
Tell us what didn’t work or what you’d like clarified.