Extract Specific Teletext Subtitle Page Using FFmpeg

Extracting teletext subtitles from video streams is a common task, but media files often contain multiple teletext pages corresponding to different languages or services. This article provides a quick, step-by-step guide on how to use FFmpeg to target and extract a specific teletext page number, converting it into a standard subtitle format like SRT.

1. Identify the Teletext Stream

Before extracting, you need to find the stream index of the teletext data. Use ffprobe to inspect your input file:

ffprobe input.ts

Look for a stream labeled subtitles with the codec dvb_teletext or teletext. Note its index (e.g., 0:s:0 or 0:3).

2. The Extraction Command

To select a specific teletext page, use the -txt_page option. This option tells the FFmpeg teletext decoder which page number to parse (page 888 is the most common page for default subtitles in many regions).

Run the following command to extract the subtitles:

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

Command Breakdown:

3. Handling Multiple Subtitle Streams

If your file contains multiple subtitle streams and FFmpeg is not selecting the correct one automatically, use the -map option to specify the exact stream index you identified with ffprobe:

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

In this command, -map 0:s:0 explicitly tells FFmpeg to use the first subtitle stream of the first input file.