Extract Teletext Subtitles by Page with FFmpeg

Extracting teletext subtitles from broadcast streams often requires targeting a specific page number, such as standard subtitle pages 888 or 777. This guide demonstrates how to use FFmpeg with the -txt_page option to extract teletext data from a designated page and convert it into modern, text-based subtitle files such as SubRip (.srt).

Identifying the Teletext Stream

Before extracting, identify the teletext stream index in your media file using ffprobe:

ffprobe -hide_banner input.ts

Look for a stream labeled as dvb_teletext. Note its stream identifier (for example, 0:s:0 or 0:2).

Extracting a Specific Teletext Page

FFmpeg uses the libzvbi decoder to process teletext streams. To specify the teletext page number, declare the -txt_page option before the input file argument (-i).

To extract teletext page 888 into an SRT file:

ffmpeg -txt_page 888 -i input.ts output.srt

Mapping Specific Streams

If the source container contains multiple subtitle or data tracks, explicitly map the teletext stream to prevent conflicts:

ffmpeg -txt_page 888 -i input.ts -map 0:s:0 output.srt

In this command:

  • -txt_page 888 tells the teletext decoder to process only page 888.
  • -map 0:s:0 selects the first subtitle stream from the input file.
  • output.srt converts the extracted bitmap or teletext characters into standard text-based subtitles.

Formatting Options

By default, FFmpeg extracts teletext using basic formatting. You can adjust the presentation with the -txt_format option:

  • Text only (clean text without colors/positions):

    ffmpeg -txt_page 888 -txt_format text -i input.ts output.srt
  • Preserve styling (colors and alignment via ASS format):

    ffmpeg -txt_page 888 -txt_format ass -i input.ts output.ass

Key Considerations

  • The -txt_page parameter must be placed prior to -i because it acts as an input option configuring the teletext demuxer/decoder.
  • Standard subtitle pages vary by country and broadcaster; typical pages include 888 (UK/International), 777 (Germany/Netherlands), or 150/199 (Nordic regions).