Override SRT Subtitle Styles in FFmpeg Using force_style

This article explains how to use the force_style option within the FFmpeg subtitles filter to customize and override the styling of SRT subtitle files during video processing. You will learn the correct command-line syntax, key style parameters based on the SubStation Alpha (ASS) format, and practical examples to burn customized subtitles directly into your videos.

Understanding force_style

The subtitles filter in FFmpeg uses the SubStation Alpha (ASS) rendering engine (libass) to burn subtitles into a video. Because the SubRip (SRT) format contains very little styling information, FFmpeg allows you to pass ASS styling parameters using the force_style option.

The basic syntax for applying this option is:

ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Parameter1=Value1,Parameter2=Value2'" output.mp4

Note: The entire filter string must be enclosed in double quotes, and the force_style values must be enclosed in single quotes.

Common Style Parameters

Below are the most common ASS style parameters you can use with force_style to customize your SRT subtitles:

Understanding the ASS Color Format

Colors in force_style do not use standard HEX codes (#RRGGBB). Instead, they use a hexadecimal format in reverse order: &H[Alpha][Blue][Green][Red].

Color Examples: * White (Opaque): &H00FFFFFF * Yellow (Opaque): &H0000FFFF * Red (Opaque): &H000000FF * Semi-transparent Black (for backgrounds): &H80000000

Practical Examples

Example 1: Basic Yellow Font with Outline

To change the subtitle font to Arial, increase the size to 20, make the color yellow, and add a black outline:

ffmpeg -i input.mp4 -vf "subtitles=filename.srt:force_style='FontName=Arial,FontSize=20,PrimaryColour=&H0000FFFF,OutlineColour=&H00000000,Outline=2'" output.mp4

Example 2: Subtitles at the Top of the Screen

To reposition the subtitles to the top-center of the screen, use the Alignment=6 parameter:

ffmpeg -i input.mp4 -vf "subtitles=filename.srt:force_style='FontName=Helvetica,FontSize=18,Alignment=6'" output.mp4

Example 3: Adding a Background Box

To place a semi-transparent black background strip behind white subtitles (useful for readability), you must set the BorderStyle parameter to 4 (which enables the background box option):

ffmpeg -i input.mp4 -vf "subtitles=filename.srt:force_style='FontName=Arial,FontSize=16,PrimaryColour=&H00FFFFFF,BorderStyle=4,BackColour=&H80000000'" output.mp4

Troubleshooting Escape Characters

If you are running these commands on Windows PowerShell or certain Linux shells, you may need to escape the special characters (such as commas, colons, or backslashes) to prevent the shell from misinterpreting the filter syntax.

If you encounter syntax errors, try escaping the single quotes or wrapping the filter argument like this:

-vf "subtitles='filename.srt':force_style='FontName=Arial,FontSize=20'"