How to Burn WebVTT Subtitles into Video with FFmpeg
This guide explains how to permanently burn WebVTT (.vtt) subtitle
files into a video using the FFmpeg subtitles filter.
Hardcoding subtitles—also known as burning them in—merges the subtitle
text directly into the video frames, ensuring they render correctly on
any media player or device without requiring external subtitle files.
You will learn the basic command syntax, how to handle file path
escaping, and how to customize the subtitle appearance.
The Basic Command
To burn WebVTT subtitles into a video, you use the video filter
(-vf) option followed by the subtitles filter
and the path to your WebVTT file.
Here is the standard command:
ffmpeg -i input.mp4 -vf "subtitles=subtitles.vtt" output.mp4Command Breakdown:
-i input.mp4: Specifies the input video file.-vf "subtitles=subtitles.vtt": Applies the video filter that overlays thesubtitles.vttfile onto the video.output.mp4: The resulting video file with the burned-in subtitles.
Handling Special Characters and Windows File Paths
The FFmpeg filter engine requires special escaping for backslashes, colons, and spaces in file paths. If your subtitle file path contains these characters, you must wrap the path in single quotes and escape the colons and backslashes.
For Windows Paths:
If your subtitle file is located at
C:\Folder\subtitles.vtt, format the command like this:
ffmpeg -i input.mp4 -vf "subtitles='C\:\\Folder\\subtitles.vtt'" output.mp4Note the double backslashes (\\) and the escaped
colon (\:).
For Paths with Spaces:
If your filename has spaces, wrap the path in single quotes inside the double-quoted filter string:
ffmpeg -i input.mp4 -vf "subtitles='my subtitles.vtt'" output.mp4Customizing Subtitle Appearance
You can customize the font style, size, and colors of the burned-in
subtitles using the force_style parameter. This parameter
uses ASS (Advanced SubStation Alpha) style properties.
For example, to change the font size to 20, set the primary color to yellow, and add a black outline:
ffmpeg -i input.mp4 -vf "subtitles=subtitles.vtt:force_style='Fontname=Arial,Fontsize=20,PrimaryColour=&H0000FFFF,OutlineColour=&H00000000,BorderStyle=1,Outline=2'" output.mp4Common force_style
Properties:
Fontname: The system name of the font (e.g., Arial, Verdana).Fontsize: The size of the text.PrimaryColour: The text color in hexadecimal format (&Hfollowed by Alpha-Blue-Green-Red).&H0000FFFFis yellow,&H00FFFFFFis white.BackColour: The color of the shadow/background box.Alignment: Determines the subtitle position (e.g.,2for bottom-center,6for top-center).