Use this guide to choose a subtitle workflow in the MPlatform or MFormats SDK. Start with the source of your captions: an ASS or SRT file, text produced while the output is running, or a subtitle track already in a transport stream.
Choose a workflow
| I want to | Start here |
|---|---|
| Encode an existing ASS or SRT track into a transport stream | Insert ASS or SRT subtitles into MPEG-TS. Includes the Conversion sample. |
| Insert text while an output is running | Insert DVB subtitles or DVB Teletext during live output. Includes the Generation sample. |
| Open a transport stream and display or verify a subtitle track | Display DVB subtitles and DVB Teletext from MPEG-TS. |
| Write WebVTT subtitle segments for HLS | Write WebVTT subtitles for HLS. |
Installed x64 samples
The Conversion sample loads timed subtitle files for playlist items. The Generation sample sends events from a queue or the live JSON editor. Importing text into the Generation sample populates the queue; the writer still receives subtitle events on frames.
| SDK | Conversion source folder | Generation source folder |
|---|---|---|
| MPlatform | C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples Basic\C#\Subtitle Conversion Sample |
C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples Basic\C#\Subtitle Generation Sample |
| MFormats | C:\Program Files (x86)\Medialooks\MFormats SDK\Samples\C#\Sample Subtitle Conversion |
C:\Program Files (x86)\Medialooks\MFormats SDK\Samples\C#\Sample Subtitle Generation |
See the Conversion quick start and the Generation quick start for screenshots and steps.
Output subtitle types
| Writer codec | Kind | Output |
|---|---|---|
subtitle::codec='dvbsub' |
Bitmap DVB subtitles | MPEG-TS (format='mpegts'): a file, UDP or SRT |
subtitle::codec='dvbtxt' |
DVB Teletext (text) | MPEG-TS (format='mpegts'): a file, UDP or SRT |
subtitle::codec='webvtt' |
WebVTT (text) | HLS (format='hls') |
One output can have several subtitle tracks, for example a DVB Teletext track and a bitmap DVB subtitle track. The tracks of the writer are written with the prefixes subtitle::, subtitle.1::, subtitle.2:: and so on.
Stream ID, PID, and track index
-
Stream ID routes a subtitle source to a writer track. Match
external_subtitle.stream_idor JSONstream_idto the writer track'sstream_id. -
PID is the packet identifier in the MPEG transport stream. Set it with the writer's
subtitle::pidoption. The sample screenshots use 117 for both fields, but they have different roles. -
Track index selects the configuration slot. The first writer track uses
subtitle::, the nextsubtitle.1::. For live JSON, use the corresponding frame propertysubtitle_jsonorsubtitle_json.1.
Requirements
- The output is an MPEG transport stream (
format='mpegts', a file, UDP or SRT) for DVB subtitles and DVB Teletext, and HLS (format='hls') for WebVTT. - Inserting live subtitles with the frame property
subtitle_jsonneeds a 64-bit application. - The writer examples use the
libopenh264video codec and theaacaudio codec; any other codec supported by the writer can be used. - Subtitle insertion may require the Closed Caption plugin license.
Properties at a glance
Use this table to find the reader, frame, or writer option for your workflow. Follow the linked guide for the full configuration.
| Where | Property | What it does | Article |
|---|---|---|---|
Reader (MFile, MFReader) |
file::info::subtitle_tracks, file::info::subtitle.N::*
|
The number of the subtitle tracks of the source and the information about each of them | Displaying subtitles |
| Reader | file::subtitle_track |
The subtitle track that is shown | Displaying subtitles |
| Reader |
teletext_page, teletext.force_ffmpeg
|
The Teletext subtitle page of the source and the FFmpeg Teletext path | Displaying subtitles |
| Reader |
external_subtitle, external_subtitle.stream_id (and .N) |
Attach an ASS or SRT file as a subtitle track and give it a stream ID | ASS and SRT insertion |
| Reader | experimental.out_subtitle_packets |
Pass the subtitle packets to the writer (2) instead of drawing them on the picture |
ASS and SRT insertion |
| Frame |
subtitle_json (and subtitle_json.N) |
A live subtitle event as JSON, attached to a frame with MFStrSet
|
Live insertion |
Writer (MWriter, MFWriter) |
subtitle::codec |
dvbsub, dvbtxt or webvtt
|
ASS and SRT insertion |
| Writer |
subtitle::stream_id, subtitle::pid, subtitle::metadata::language
|
The stream ID that connects the track with its source, the PID in the transport stream and the language | ASS and SRT insertion |
| Writer |
subtitle::font, subtitle::font_size, subtitle::outline and others |
The formatting of the subtitle text | ASS and SRT insertion |
| Writer |
subtitle::page_number, subtitle::teletext_*, subtitle::data_identifier
|
The Teletext page, the character sets, the rows and the data identifier | ASS and SRT insertion |
| Writer |
subtitle::subtitling_type, subtitle::default_font, subtitle::canvas_*
|
The settings of the bitmap DVB subtitles | ASS and SRT insertion |
Every subtitle track has a number. The first track uses the property names as above, the next ones use the index in the name: external_subtitle.1, subtitle.1::codec, subtitle_json.1.
Related guides
Still have questions?
Tell us what didn’t work or what you’d like clarified.