Burning and Embedding Subtitles — SRT, ASS, Hard Subs and Soft Subs

There are two main methods for adding subtitles to video: hard subs (burn-in) and soft subs (embedding). This article explains how each works and how to use them with FFmpeg.


Differences Between Hard Subs and Soft Subs

MethodOverviewPrimary Use Cases
Hard sub (burn-in)Subtitle text is drawn directly onto the video pixels. Becomes part of the video and cannot be removed laterWhen subtitles must be permanently fixed, or when they need to display regardless of the playback environment
Soft sub (embedding)Subtitles are stored as a separate track in the container (such as MKV). Can be toggled on/off or switched between languages laterMultilingual support, cases where editing flexibility should be preserved

Hard subs require re-encoding and take longer to process, but are guaranteed to display in any player. Soft subs often only require a copy operation and are faster, but are limited to compatible players.


Hard Subs (Burn-in)

Burning SRT Subtitles — subtitles Filter

The subtitles filter uses libass internally to render subtitle files onto the video. Verified with FFmpeg 6.1.

ffmpeg -i input.mp4 -vf subtitles=subtitle.srt output.mp4

.srt files are not in KNOWN_EXTS, so they are shown as a text block. Replace subtitle.srt with the actual file path when running.

To adjust font size or position:

ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='FontSize=24,Alignment=2'" output.mp4

You can override settings using ASS style format in force_style (FontSize, PrimaryColour, Alignment, etc.).

Burning ASS Subtitles — ass Filter

ASS (Advanced SubStation Alpha) is a subtitle format that supports advanced formatting including fonts, colors, and animations. While the subtitles filter can also read ASS files, the ass filter reproduces styles more faithfully.

ffmpeg -i input.mp4 -vf ass=subtitle.ass output.mp4

subtitles=subtitle.ass and ass=subtitle.ass produce nearly identical output, but the ass filter uses an ASS-specific initialization path. For files with complex styles, the ass filter is recommended.

Font Specification (ASS)

Specify Fontname in the [V4+ Styles] section of the ASS file. If you are using a font not installed on the system, you can specify a font directory with the fontsdir option.

ffmpeg -i input.mp4 -vf "ass=subtitle.ass:fontsdir=/path/to/fonts" output.mp4

Soft Subs (Embedding)

Embedding a Subtitle Track into MKV

The MKV container supports multiple subtitle tracks. Here is the basic command for adding an SRT subtitle while copying the video and audio:

ffmpeg -i input.mp4 -i subtitle.srt -c copy -c:s srt output.mkv

To embed multiple language subtitles:

ffmpeg -i input.mp4 -i sub_ja.srt -i sub_en.srt \
  -c copy -c:s srt \
  -metadata:s:s:0 language=jpn \
  -metadata:s:s:1 language=eng \
  output.mkv

Copying Subtitle Streams (Existing Tracks)

To convert an MKV file that already has subtitle tracks while preserving them, use -c:s copy.

ffmpeg -i input.mkv -c:v libx264 -c:a aac -c:s copy output.mkv

Since the input file for CI testing does not have subtitle tracks, this command is shown as a text block.


Converting Subtitles from MKV to MP4

MP4 uses mov_text (SRT-based) as its subtitle format. To convert subtitle tracks from MKV to MP4:

ffmpeg -i input.mkv -c:v copy -c:a copy -c:s mov_text output.mp4

Notes:


Checking and Extracting Subtitle Tracks

To check the embedded subtitle tracks, use ffprobe (no output file needed):

ffprobe -v error -show_streams -select_streams s input.mkv

To extract subtitles as an external file:

ffmpeg -i input.mkv -c:s srt extracted_subtitle.srt

Summary

Use CaseRecommended MethodKey Command Options
Fixed subtitles, display in any environmentHard sub-vf subtitles= or -vf ass=
Toggle-able subtitlesSoft sub (MKV)Embed with -c:s srt
Preserve existing tracks as-isCopy-c:s copy
MKV → MP4 conversionmov_text-c:s mov_text

Related Articles:


Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner)
Primary sources: ffmpeg.org/ffmpeg-filters.html / ffmpeg.org/ffmpeg.html / trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo