List Fonts Available to FFmpeg Drawtext

This article explains how to identify and list the system fonts available to FFmpeg’s drawtext filter when utilizing the Fontconfig library. You will learn the exact command-line tools required to query your system’s font database and how to reference these fonts correctly in your FFmpeg video processing workflows.

Understanding Fontconfig in FFmpeg

The FFmpeg drawtext filter allows you to overlay text onto videos. To select a font, you can either provide a direct path to a font file using the fontfile parameter, or use the font parameter to search for a system font via Fontconfig.

For Fontconfig to work, your FFmpeg build must be compiled with the --enable-libfontconfig flag. When enabled, FFmpeg queries the system’s Fontconfig cache to locate fonts by their family name.

How to List Available Fonts

Because FFmpeg relies on the system’s Fontconfig library, you use system command-line utilities rather than FFmpeg itself to list the available fonts. The primary tool for this is fc-list.

1. List All Available Fonts

To output every font family and style recognized by Fontconfig on your system, open your terminal and run:

fc-list

The raw output of fc-list can be overwhelming. To get a clean, sorted, and unique list of available font family names, use the following command:

fc-list : family | sort -u

3. Search for a Specific Font

If you want to check if a specific font (for example, “Arial” or “Sans”) is available, pipe the output into grep:

fc-list : family | grep -i "arial"

How to Use the Font in FFmpeg

Once you have identified the exact font family name from the steps above, you can apply it directly in your FFmpeg command using the font parameter.

Here is an example of how to burn text into a video using the “Arial” font:

ffmpeg -i input.mp4 -vf "drawtext=font='Arial':text='Hello World':fontcolor=white:fontsize=24:x=10:y=10" -codec:a copy output.mp4

By using the font parameter instead of fontfile, Fontconfig automatically resolves the correct path to the font file on your system, making your FFmpeg scripts highly portable across different machines.