TTrimpx

Captions Guide

Add Subtitles to a Video With FFmpeg

Once you have a subtitle file, FFmpeg can convert it, attach it to a video as a switchable track, or pull it back out.

How we checked these commands: every command on this page was run with FFmpeg 8.1.2 on macOS on 24 October 2026, on short generated test clips, and the output was inspected with ffprobe (resolution, frame rate, duration, streams). Results on your files can differ if your FFmpeg build or input files are different.

Why add captions

Captions make a video usable for viewers who are deaf or hard of hearing, for people watching with the sound off, and for viewers who follow a language more easily in writing.

Getting a subtitle file

You need a timed subtitle file first, usually SRT (SubRip). You can type one by hand, export one from your video editor, or create one with a speech-to-text tool and then correct it. We haven't tested a transcription tool for this page, so we don't give transcription commands here. An SRT file looks like this:

1
00:00:00,500 --> 00:00:02,000
Hello and welcome.

2
00:00:02,200 --> 00:00:03,800
This line is a test caption.

Convert SRT to WebVTT (.vtt)

ffmpeg -i input.srt input.vtt

WebVTT is the caption format used with the HTML5 <track> element. In our test, the output started with WEBVTT and kept both cues at the same times. WebVTT writes them as 00:00.500 --> 00:02.000, with a dot instead of SRT's comma.

Add a subtitle track that viewers can turn on and off

For MP4, the subtitle has to be stored as mov_text:

ffmpeg -i input.mp4 -i input.srt -map 0 -map 1 -c copy -c:s mov_text -metadata:s:s:0 language=eng output-softsubs.mp4

For MKV, the SRT can be stored as it is:

ffmpeg -i input.mp4 -i input.srt -map 0 -map 1 -c copy output-softsubs.mkv

-c copy means the video and audio are not re-encoded. In our test, the MP4 got a third stream (mov_text, tagged eng) and the MKV got a subrip stream, with the video and audio unchanged. Whether the subtitles show up depends on the player. Most desktop players have a subtitle menu.

Extract an embedded subtitle track to SRT

ffmpeg -i output-softsubs.mp4 -map 0:s:0 extracted.srt

0:s:0 means the first subtitle track. In our test, the extracted SRT matched the original text and timings.

Burned-in subtitles

Burning subtitles into the picture uses FFmpeg's subtitles filter. That filter only exists if your FFmpeg build includes libass, and the build we tested with did not have it. We haven't verified a burn-in command, so we don't publish one here. See the subtitles filter documentation.

Uploading captions to YouTube

For YouTube, you usually don't need to attach subtitles to the video at all. Upload the caption file separately in YouTube Studio. YouTube Help lists SubRip (.srt) as a basic supported format, but only plain UTF-8 files without styling. It lists WebVTT (.vtt) as an advanced format with limited styling support. See Supported subtitle and closed caption files (checked 24 October 2026).

Subtitle formats at a glance

SRTPlain text with numbered cues; times use a comma (00:00:02,000).
WebVTT (.vtt)Starts with WEBVTT; times use a dot; used with the HTML5 <track> element.
ASS/SSASupports fonts, colours and positioning; often used for styled subtitles.

Related guides

Related Trimpx Resources