Medialooks Video SDK can insert Electronic Program Guide (EPG) data into the Event Information Table (EIT) of a DVB MPEG transport stream. Use Present/Following (P/F) for the current and next programs shown in the receiver's Now/Next view. Use Schedule for the program lineup shown in the guide.
Your application supplies the events. You can set them when opening MWriter in MPlatform or MFWriter in MFormats and update them while the writer is running.
Configure DVB output
Select format='dvb' and set eit_period to a non-negative value to enable EIT. This option sets the Present/Following retransmission interval in seconds. A value of -1 disables EIT transmission.
string destination = "udp://239.1.2.3:12345";
string configuration =
"format='dvb' protocol='udp://' service_id='101' eit_period='0.5' " +
"muxrate='7M' video::codec='mpeg2video' video::b='5M' " +
"audio::codec='aac' audio::b='128K'";Pass the destination separately from the configuration. For RTP, use protocol='rtp://' and an rtp:// destination. For SRT, select SRT Streaming (DVB-Compatible Mode), which uses format='dvb' protocol='srt://', and supply an srt:// destination. See DVB compatible streaming and SRT streaming.
Set Present/Following when opening the writer
For a single-service output, append metadata::eit.present.* for the current program and metadata::eit.following.* for the next program. This example puts a 30-minute news program on air and lists a film immediately after it. Use the actual broadcast start times in your application.
const string utcFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'";
var culture = System.Globalization.CultureInfo.InvariantCulture;
DateTime startUtc = DateTime.UtcNow;
string newsStart = startUtc.ToString(utcFormat, culture);
string filmStart = startUtc.AddMinutes(30).ToString(utcFormat, culture);
configuration +=
" metadata::eit.present.event_id='100'" +
" metadata::eit.present.start_time='" + newsStart + "'" +
" metadata::eit.present.duration='1800'" +
" metadata::eit.present.language='eng'" +
" metadata::eit.present.name='News'" +
" metadata::eit.following.event_id='101'" +
" metadata::eit.following.start_time='" + filmStart + "'" +
" metadata::eit.following.duration='5400'" +
" metadata::eit.following.language='eng'" +
" metadata::eit.following.name='Film'";For an MPEG-TS output with explicitly configured programs, supply initial events in each program's program::eit.* metadata. DVB over RTP uses a single service and takes its initial events from the global metadata::eit.* fields.
Update Now/Next during playout
Set a frame string named DVB_EIT with IMFFrame.MFStrSet. Begin the value with eit.update='1' and use the event keys without the metadata:: prefix. In MFormats, set the string before submitting the frame to ReceiverFramePut. In MPlatform, set it on a source video OnFrame event.
When the film starts, move it to Present and keep its event ID. This example leaves Following empty. If another program is queued, include its eit.following.* fields in the same update.
string actualFilmStart = DateTime.UtcNow.ToString(utcFormat, culture);
string update =
"eit.update='1' eit.service_id='101' " +
"eit.present.event_id='101' eit.present.start_time='" + actualFilmStart + "' " +
"eit.present.duration='5400' eit.present.language='eng' " +
"eit.present.name='Film'";
frame.MFStrSet("DVB_EIT", update);- Each P/F update replaces both slots for the selected service. An omitted slot is cleared.
- To clear both slots, send
eit.update='1' eit.service_id='101'with no event fields. -
eit.service_idis optional for a single-service output and required when the output contains multiple services. - Once the writer accepts an update, it retransmits the pair until the next update. Rejected updates leave the previous events in place and media continues writing.
- Send a new pair when playout switches programs. The SDK does not advance the Now/Next slots based on the event start times.
Follow the C# Playlist Sample
In the MPlatform SDK installation, see Samples Advanced\C#\Playlist Sample\Form1.cs. The sample uses PlaylistPosGet to find the current and next items, reads their trimmed durations, and rebuilds the P/F pair when playback switches items or the playlist changes.
The sample sets object::on_frame.sync and object::on_frame.data to true, then attaches DVB_EIT in OnFrameSafe. It periodically attaches the same update again in case an earlier frame did not reach the muxer. Repeating identical event data does not increment the EIT version.
Publish a program schedule
To supply a schedule before opening the writer, use metadata::eit.schedule.count and indexed event fields such as metadata::eit.schedule.0.event_id. To replace the schedule during writing, use eit.schedule.count and the indexed fields in a DVB_EIT frame string.
The following MFormats example publishes two programs starting tomorrow at 18:00 and 18:30 UTC. It uses the same writer configuration as above. The optional setting eit_schedule_period='10' sets the target time for a full schedule cycle to 10 seconds, which is also the default.
DateTime lineupStart = DateTime.UtcNow.Date.AddDays(1).AddHours(18);
string scheduledNews = lineupStart.ToString(utcFormat, culture);
string scheduledFilm = lineupStart.AddMinutes(30).ToString(utcFormat, culture);
frame.MFStrSet("DVB_EIT",
"eit.update='1' eit.service_id='101' eit.schedule.count='2' " +
"eit.schedule.0.event_id='100' eit.schedule.0.start_time='" + scheduledNews + "' " +
"eit.schedule.0.duration='1800' eit.schedule.0.language='eng' " +
"eit.schedule.0.name='News' " +
"eit.schedule.1.event_id='101' eit.schedule.1.start_time='" + scheduledFilm + "' " +
"eit.schedule.1.duration='5400' eit.schedule.1.language='eng' " +
"eit.schedule.1.name='Film'");
mfWriter.ReceiverFramePut(frame, -1, "");- Send the complete replacement list on one frame. Number entries from zero to
count - 1and assign a unique event ID to each entry in the service's schedule. - After accepting the update, the writer repeats the schedule in the stream. A rejected update leaves the previous schedule in place.
- To clear the schedule, send
eit.update='1' eit.service_id='101' eit.schedule.count='0'. - Send Schedule and P/F updates on separate frames. Clearing one leaves the other in place.
| Schedule field | Limit |
|---|---|
start_time |
For initial Schedule metadata and live replacements, the transmission window covers 64 UTC calendar days beginning at today's UTC midnight. Events starting before that midnight are excluded from the transmitted Schedule. A start time at or after UTC midnight 64 days later is rejected. |
eit.schedule.count and indexed events |
Each service's Schedule is grouped into three-hour UTC segments according to event start times. Each segment can contain at most eight sections of up to 4096 bytes each, including section headers and CRC. These format limits still apply within the configured event-count limit. |
Event fields
| Field | Value |
|---|---|
event_id |
Required integer from 0 to 65535. |
start_time |
Required UTC date and time in YYYY-MM-DDTHH:MM:SSZ format. |
duration |
Required duration in whole seconds, from 0 to 359999. |
language |
Optional three-letter ISO 639-2 code, such as eng. Defaults to und. |
name and text
|
Optional title and short description. Both must fit in one DVB short event descriptor. |
running_status |
Optional. P/F accepts 0–5 and defaults to 4 for Present and 1 for Following. Schedule accepts 0 or 5 and defaults to 0. |
When constructing the parameter string from program titles or descriptions, XML-escape each value before adding the surrounding quotes. In C#, use System.Security.SecurityElement.Escape.
Verify the EPG in the output
Inspect PID 0x0012 in a transport stream analyzer. Table ID 0x4E carries Present/Following for the current transport stream. Table IDs 0x50 through 0x5F carry its Schedule. Check the service ID, event IDs, titles, and UTC start times. After a live update, allow time for the table to cycle and check that the event list reflects the replacement.
If the writer is running in SRT listener mode, use TSDuck as the caller. Replace 192.0.2.10:5000 with the writer's reachable address and port. See the TSDuck User Guide.
tsp -I srt --caller 192.0.2.10:5000 -P tables --pid 0x12 --all-once -O drop| Output field | Check |
|---|---|
Schedule version_number
|
Compare versions for the same service and Schedule table ID. A change to a subtable's transmitted contents or layout advances its version modulo 32. With an unchanged UTC-day layout, an identical replacement preserves the version. A UTC date rollover can change the layout without an application update. |
SDT EIT_schedule_flag
|
With EIT enabled, check that the flag is 1 while Schedule sections are available and becomes 0 after clearing Schedule with eit.schedule.count='0'. A transition between these states also advances the SDT version. Allow time to observe the updated SDT. Clearing Schedule leaves Present/Following independent. |
| Service and transport identifiers | Check that the EIT service ID matches the configured service and that its transport-stream and original-network identifiers match the output. Check the corresponding service entry in SDT as well. |
| Section numbering and length | Capture a complete Schedule cycle and check section and segment numbering, advertised last-section and last-table values, and each reassembled section's declared length. Schedule EIT sections must not exceed 4096 bytes including headers and CRC. |
| Section CRC | Use the transport-stream analyzer to validate the CRC of each complete reassembled EIT and SDT section, including sections observed after replacement or clearing. |
Still have questions?
Tell us what didn’t work or what you’d like clarified.