Extract DVB Subtitles from TS to PNG with FFmpeg

This article provides a quick, step-by-step guide on how to extract image-based DVB subtitles from an MPEG-TS (.ts) video file and save them as individual PNG image files using FFmpeg. Since DVB subtitles are inherently stored as bitmaps rather than text, converting them directly to PNG frames is the most accurate way to preserve their original formatting, positioning, and transparency.

Step 1: Identify the Subtitle Stream Index

Before extracting, you need to find which stream within the TS file contains the DVB subtitles. Run the following ffprobe command in your terminal:

ffprobe input.ts

Look through the output metadata for a stream labeled Subtitle: dvb_subtitle. Take note of its stream identifier (for example, 0:3 or 0:s:0).

Step 2: Extract the Subtitles to PNG Images

Once you have identified the subtitle stream index, use ffmpeg to extract the subtitle frames. Run the following command, replacing 0:s:0 with your specific subtitle stream index if it differs:

ffmpeg -i input.ts -map 0:s:0 sub_%04d.png

Understanding the Command Parameters