How to Use the ASS Filter in FFmpeg
This article explains how to use the ass video filter in
FFmpeg to hardcode (burn) Advanced SubStation Alpha (.ass) subtitles
directly into a video file. You will learn the required FFmpeg setup,
the basic command syntax, and how to handle common pathing and
formatting issues to ensure your stylized subtitles render correctly on
the output video.
To use the ass filter, your version of FFmpeg must be
compiled with the --enable-libass configuration flag. You
can verify this by running ffmpeg -version in your terminal
and checking the configuration output for libass.
Basic Command Syntax
The simplest way to burn ASS subtitles into a video is by using the
video filter (-vf) flag followed by the ass
filter name and the path to your subtitle file. Here is the standard
command structure:
ffmpeg -i input.mp4 -vf "ass=subtitles.ass" output.mp4In this command: * -i input.mp4 specifies your source
video. * -vf "ass=subtitles.ass" applies the subtitle
filter using the specified .ass file. *
output.mp4 is the final video file with the subtitles
permanently burned in.
Handling File Paths and Escaping
If your subtitle file path contains spaces, special characters, or backslashes (especially on Windows), you must escape the path properly. FFmpeg requires backslashes to be escaped, and the entire filter argument should be enclosed in quotes.
For Windows paths, use forward slashes or escape the backslashes like this:
ffmpeg -i input.mp4 -vf "ass='C\:/path/to/subtitles.ass'" output.mp4Alternatively, you can double-escape the backslashes:
ffmpeg -i input.mp4 -vf "ass='C\\:\\\\path\\\\to\\\\subtitles.ass'" output.mp4Font Troubleshooting
The ass filter relies on fontconfig to
locate the fonts styled in your .ass file. If your
subtitles render with default fallback fonts instead of your custom
styles, ensure that: 1. The custom fonts are installed on your system.
2. FFmpeg can access your system’s font folder (on Windows, this is
usually automatic, but on macOS/Linux, you may need to update your
fonts.conf file or set the FONTCONFIG_FILE
environment variable).