Convert SRT to DVB Subtitles in TS with FFmpeg

Multiplexing external SubRip (SRT) subtitles into an MPEG Transport Stream (TS) as DVB subtitles is a standard requirement for digital broadcasting and cable television workflows. This guide provides a straightforward, step-by-step tutorial on how to use FFmpeg to convert text-based SRT subtitle files into graphical DVB subtitle streams and multiplex them directly into a TS container alongside your video and audio.

The Basic FFmpeg Command

Because DVB subtitles (dvbsub) are image-based (bitmap) subtitles, FFmpeg must render the text-based SRT subtitles into images during the multiplexing process.

To convert and multiplex your files, use the following basic command:

ffmpeg -i input.mp4 -i input.srt -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s dvbsub output.ts

Command Breakdown

When rendering text subtitles into graphical DVB bitmaps, FFmpeg needs to know the correct video resolution to scale and position the subtitles properly. If the subtitle rendering scale looks incorrect, you should explicitly define the canvas size to match your video’s resolution (e.g., 1920x1080 for Full HD):

ffmpeg -i input.mp4 -i input.srt -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s dvbsub -canvas_size 1920x1080 output.ts

Setting the Language Metadata

To ensure media players and set-top boxes recognize the language of the DVB subtitle track, you should set the appropriate ISO 639 language code (e.g., eng for English, spa for Spanish):

ffmpeg -i input.mp4 -i input.srt -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s dvbsub -metadata:s:s:0 language=eng output.ts

In this command, -metadata:s:s:0 language=eng targets the first subtitle stream (s:s:0) and tags it as English.