OP-47 (SMPTE RDD 8) carries Teletext, mostly subtitles, in ANC packets of an HD SDI signal (DID 0x43, SDID 0x02 or 0x03). The same packets are stored in MXF files in the SMPTE ST 436 track. The SDK decodes OP-47 into Teletext pages and gives you the text of the selected page.
OP-47 is decoded from:
- MXF files with an ST 436 track, read by MFReader or MFile;
- Blackmagic SDI inputs (MFLive, MLive) with ANC capture enabled.
The original packets stay on the frame as ANC.Line.N, so they can be passed on to an SDI output or recorded to
MXF (see ANC packets: the ANC.Line.N format). The SDK does not encode OP-47 from text.
For DVB Teletext in transport streams, see Displaying DVB subtitles and Teletext.
How decoding works
A Teletext service is a set of pages numbered from 100 to 8FF (hexadecimal), for example 888 for subtitles. The pages are transmitted one after another, so the decoder collects them over many frames. A page that you request may need several seconds to arrive. The decoder keeps the latest version of each page and puts the state of the selected page on every frame.
Settings
Set them on the source before opening the file or starting the capture. They can be changed later; frames already in the reader buffer keep their old values.
| Property | Default | Meaning |
|---|---|---|
op47.decode |
true | Decodes pages and text. false leaves only the raw ANC.Line.N packets. |
teletext_page |
0 | Page to select, in hexadecimal (for example 888). 0: the first subtitle page that arrives. |
op47.subtitles |
false | Also produces subtitle events in SUB_TEXT and SUB_XML. |
op47.anc_stream |
-1 | Files only: the index of the ANC stream to decode (as in info::data.N::idx). -1: the first ANC stream that has pages. |
op47.experimental_snapshots |
false | Adds binary page data (OP47_PAGE, OP47_CATALOG). The layout is not a stable interface; use the strings. |
Where to set them:
| Object | Example |
|---|---|
| MFReader |
reader.ReaderOpen(path, "teletext_page=888") or reader.PropsSet("teletext_page", "888")
|
| MFLive | live.PropsSet("teletext_page", "888") |
| MFile | file.PropsSet("file::teletext_page", "888") |
| MLive | live.PropsSet("object::teletext_page", "888") |
A Blackmagic input also needs ANC capture: vanc.capture_anc=true (object::vanc.capture_anc on MLive).
Frame strings
Read them with MFStrGet. A string can be missing until the decoder has seen a page; an empty text is also a valid result.
| Key | Content |
|---|---|
OP47_PAGE_LIST |
Pages found so far, hexadecimal, comma-separated and sorted, for example 801,802,888. |
OP47_PAGE_NUMBER |
The selected page. It can show a requested page before the page arrives. |
OP47_TEXT |
Visible text of the page without its header, rows separated by line feeds. Trailing spaces and empty rows are removed; hidden characters and graphics are left out. |
OP47_LANGUAGE |
ISO 639 language code of the page, if the source declares it (see below). Often empty. |
OP47_CHARSET_CANDIDATES |
Languages that use the character set of the page, for example Swedish, Finnish, Hungarian. This is not the language of the page. |
OP47_ANC_STREAM |
Files only: the index of the decoded ANC stream. |
OP47_REVISION |
Counter that grows when the selected page changes. |
OP47_UPDATED |
true on the frame where the page or the selection changed. |
OP47_CLEARED |
true when the page was erased or is not available. New text can arrive on the same frame, so check OP47_TEXT too. |
With op47.subtitles=true, the frames where a subtitle appears, changes or disappears also carry:
-
SUB_TEXT– the subtitle text, empty when the subtitle disappears; -
SUB_XML– the same event as XML withstart_timein seconds, position and, if known,lang. A hide event hashide_text="true".
These are events: they are on the frame where something changes, not on every frame.
Page language
A Teletext character set is shared by several languages, so the decoder cannot know the language from the text.
OP47_LANGUAGE is filled only when the metadata of the ANC stream in the file declares it, in one of these forms:
teletext_page_languages="888=eng;801=deu"
teletext_page="888" language="eng"
Languages of the file or of the audio tracks are not used.
Example: MFormats, file
MFReaderClass reader = new MFReaderClass();
reader.ReaderOpen(@"C:\media\program.mxf", "teletext_page=888");
for (int i = 0; i < 3000; i++)
{
reader.SourceFrameGet(-1, out MFFrame frame, "");
if (frame == null)
break;
frame.MFStrGet("OP47_UPDATED", out string updated);
if (updated == "true")
{
frame.MFStrGet("OP47_PAGE_NUMBER", out string page);
frame.MFStrGet("OP47_TEXT", out string text);
Console.WriteLine($"[{page}] {text}");
}
Marshal.ReleaseComObject(frame);
}
reader.ReaderClose();
Marshal.ReleaseComObject(reader);
Example: MFormats, Blackmagic input
MFLiveClass live = new MFLiveClass();
live.PropsSet("vanc.capture_anc", "true");
live.PropsSet("teletext_page", "888");
live.DeviceSet(eMFDeviceType.eMFDT_Video, deviceIndex, "");
live.SourceFrameGet(-1, out MFFrame frame, "");
frame.MFStrGet("OP47_TEXT", out string text);
Marshal.ReleaseComObject(frame);
Example: MPlatform
// MFile
m_objFile.PropsSet("file::teletext_page", "888");
m_objFile.PropsSet("object::on_frame.data", "true");
m_objFile.OnFrameSafe += OnOp47Frame;
m_objFile.FileNameSet(@"C:\media\program.mxf", "");
m_objFile.FilePlayStart();
// MLive with a Blackmagic input
m_objLive.PropsSet("object::vanc.capture_anc", "true");
m_objLive.PropsSet("object::teletext_page", "888");
m_objLive.PropsSet("object::on_frame.data", "true");
m_objLive.OnFrameSafe += OnOp47Frame;
void OnOp47Frame(string channelId, object pFrame)
{
try
{
((IMFFrame)pFrame).MFStrGet("OP47_TEXT", out string text);
// Copy the text to the application; do long work outside this handler
}
finally
{
Marshal.ReleaseComObject(pFrame);
}
}
Showing the page
MCCDisplay can draw the selected page over the video: ccDisplay.PropsSet("cc_type", "teletext"). See
Previewing captions and subtitles with MCCDisplay.
Troubleshooting
-
No pages: check that the file has an ST 436 track, or that
vanc.capture_ancis enabled on the Blackmagic input.ANC.Line.Nstrings alone do not prove that the packets are OP-47. -
The page has no text: look at
OP47_PAGE_LISTand give the requested page time to arrive. - Empty language: expected when the stream does not declare page languages.
- Several subpages: the decoder keeps only the latest subpage of each page.
-
Other inputs: OP-47 is decoded only on Blackmagic inputs. AJA, DELTACAST and Bluefish444 inputs deliver the raw packets in
ANC.Line.N. - After a seek, collected pages are cleared. On capture, pages are cleared when the signal is lost.
Decoded Teletext requires a license with the Closed Captions option.
Still have questions?
Tell us what didn’t work or what you’d like clarified.