How to Burn SRT Subtitles into Video with FFmpeg

This guide explains how to permanently burn SRT subtitle files into a video using the FFmpeg subtitles filter. You will learn the basic command-line syntax, how to handle file paths, customize subtitle styles, and optimize your encoding settings for a fast, high-quality output that plays on any device.

The Basic Command

To burn subtitles into a video, you must use FFmpeg’s video filter (-vf) flag with the subtitles filter. This process requires re-encoding the video channel, but you can copy the audio channel without changes to save time and preserve quality.

Use the following basic syntax:

ffmpeg -i input.mp4 -vf "subtitles=subs.srt" output.mp4

In this command: * -i input.mp4 specifies your source video file. * -vf "subtitles=subs.srt" applies the subtitle filter using your SRT file. * output.mp4 is the name of the newly generated video file with hardcoded subtitles.

Handling File Paths and Escaping

If your subtitle file is in a different directory or contains spaces and special characters, you must format the file path carefully. FFmpeg uses the colon (:) as a separator in filters, which can cause errors on Windows systems containing drive letters (e.g., C:\).

To avoid errors, use forward slashes and escape the colon like this:

ffmpeg -i input.mp4 -vf "subtitles='C\\:/path/to/subtitles.srt'" output.mp4

For macOS and Linux, wrap the path in single quotes inside the double-quoted filter argument:

ffmpeg -i input.mp4 -vf "subtitles='/path/to/subtitles.srt'" output.mp4

Styling Your Subtitles

The subtitles filter uses the libass library under the hood. You can customize the look of your subtitles—such as the font, size, and colors—by using the force_style option.

Here is an example that changes the font to Arial, increases the font size, and changes the text color to yellow:

ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Fontname=Arial,Fontsize=18,PrimaryColour=&H0000FFFF'" output.mp4

Optimizing the Encoding Settings

By default, FFmpeg will choose automatic encoding settings. To ensure high video quality and fast processing, manually set the video codec to H.264 (-c:v libx264), choose a quality level (-crf), and copy the audio track without re-encoding (-c:a copy):

ffmpeg -i input.mp4 -vf "subtitles=subs.srt" -c:v libx264 -crf 23 -c:a copy output.mp4