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.tsLook 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.srtCommand Breakdown:
-txt_page 888: Specifies the teletext page to decode. Change888to the correct page number if your broadcaster uses a different one.-txt_format text: Forces FFmpeg to output the teletext as plain text rather than graphical bitmaps.-i input.ts: Sets your source broadcast TS file.-map 0:s:0: Selects the first subtitle stream (s:0) from the first input file (0). If you have multiple subtitle streams and want a specific one, you can map it directly using the index found in Step 1 (e.g.,-map 0:2).output.srt: The desired name for your converted SubRip subtitle file.
Troubleshooting Missing Subtitles
If the resulting SRT file is empty, check the following:
- Incorrect Page Number: The subtitles might not be
on page 888. You can check the broadcast information online or try
common alternatives like
777or150. - Multiple Subtitle Streams: If there are multiple
dvb_teletextstreams, ensure your-mapoption is targeting the correct index (e.g.,-map 0:3instead of-map 0:s:0).