Extract Teletext Subtitles to SRT Using FFmpeg

Extracting teletext subtitles from a broadcast Transport Stream (TS) file and converting them to the widely supported SRT format is a simple process when using FFmpeg. This guide will show you how to identify the correct subtitle stream inside your TS file, select the appropriate teletext page (usually page 888), and run the FFmpeg command to export clean, text-based SRT subtitles.

Step 1: Identify the Teletext Stream

Before extracting, you need to find which stream inside the TS file contains the teletext data. Run the following command using ffprobe (which comes bundled with FFmpeg) to inspect your file:

ffprobe input.ts

Look through the output for a subtitle stream labeled dvb_teletext. It will look something like this:

Stream #0:2[0x102](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)

In this example, the subtitle stream is at index 0:2 (the third stream of the first input file).

Step 2: Extract and Convert to SRT

Once you have identified the stream, you can extract it. Most broadcasters put subtitles on teletext page 888 (or sometimes 777). You must instruct FFmpeg to decode this specific page and output it as text.

Run the following command:

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

Command Breakdown:

Troubleshooting Missing Subtitles

If the resulting SRT file is empty, check the following:

  1. Incorrect Page Number: The subtitles might not be on page 888. You can check the broadcast information online or try common alternatives like 777 or 150.
  2. Multiple Subtitle Streams: If there are multiple dvb_teletext streams, ensure your -map option is targeting the correct index (e.g., -map 0:3 instead of -map 0:s:0).