Lower Thirds & Titles

Example Subtitle Files You Can Copy: SRT, VTT and ASS

Example Subtitle Files You Can Copy: SRT, VTT and ASS
Image: Vipid

An example subtitle needs only three things: a cue number, a time range and a line of text. Every other format in this article grows out of that three-line block. SRT, the plainest of them, has no formal specification, so players follow convention instead of a rulebook. WebVTT is a W3C format that the W3C Timed Text Working Group is still working on in 2026, and ASS adds fonts, colours and positioning on top.

Below you get copy-ready samples in all three, timed against the same 24-second clip so you can compare them line by line. You also get a lint script, FFmpeg commands that burn the captions into the picture or embed them as a switchable track, and a set of deliberately broken files with the damage each one does. If you want the background on what the format is first, the SRT subtitles guide covers it. This page is the sample library.

Plan on about 40 minutes. You will finish with one folder holding an SRT file, a WebVTT file, a styled ASS file, a validator, a build script and four finished videos. Every code block can be pasted as is.

The smallest example subtitle that works

Here is the whole thing. Save it as sample.srt and any player on earth will show the line.

1
00:00:01,000 --> 00:00:03,500
This is an example subtitle.

Read it as a cue: in at one second, hold for two and a half seconds, out at 3.5 seconds. The cue number sits on the first line. The time line follows, then the text, then one blank line before the next cue. That blank line is the only separator the format has, which is why a stray empty line inside a cue splits it in two.

The table below breaks a block into its parts and lists what usually goes wrong with each.

PartExampleRuleWhat breaks it
Cue number1Counts up from 1, one number per blockSkipped or repeated numbers trip strict parsers
Time line00:00:01,000 --> 00:00:03,500HH:MM:SS,mmm, a comma before the milliseconds, a spaced arrowA period instead of a comma
TextThis is an example subtitle.One or two lines of plain textA blank line inside the text ends the cue early
Separator(empty line)Exactly one blank line between cuesA missing blank line merges two cues
EncodingUTF-8Save without a byte-order markLegacy code pages turn accents into garbage

Current guides describe SRT as a convention, not a formally standardized format, and the original SubRip program that gave the format its name last shipped in 2018. That history explains the quirks. Each player parses a slightly different dialect, so the safest example subtitle file is the plainest one you can write.

Prerequisites and versions

You need four things installed, and none of them costs anything.

Illustrative: Laptop screen showing source code in a dark-themed code editor, with a mug and notebook beside it
Photo: Daniil Komov / Pexels
  • libass 0.17.5 or newer if you build your own. The libass release notes say 0.17.5, published June 24, 2026, fixes two security flaws. One of them involves arbitrary code execution through crafted subtitle files. Update the library before you burn in an ASS file from someone you do not know.
  • Python 3.8 or later. The lint script uses f-strings and the standard library, nothing more.
  • A UTF-8 text editor. VS Code, Notepad++, Kate or Sublime all work. Avoid word processors, which add smart quotes and hidden characters.

Two optional extras help. VLC or mpv plays all three formats, which lets you check a file before you render. Subtitle Edit, a free subtitle editor that reportedly reached version 5.4.0 on November 6, 2026, opens SRT, WebVTT and ASS and is handy for retiming by eye.

Check your setup first.

ffmpeg -version | head -n 1
ffmpeg -hide_banner -filters | grep -E " (subtitles|ass) "
python3 --version

The output should look like this. Your version string and build flags will differ by platform.

ffmpeg version 9.1 Copyright (c) 2000-2026 the FFmpeg developers
 ... ass               V->V       Render ASS subtitles onto input video using the libass library.
 ... subtitles         V->V       Render text subtitles onto input video using the libass library.
Python 3.12.3

If the filter lines are missing, your FFmpeg has no libass. Stop here and swap the build before going on, because every burn-in step below depends on it. The troubleshooting section has the exact error you will see otherwise.

Frame by frame: set up the project folder and a test clip

The build has 13 steps. Steps 1 and 2 give you a place to work and something to caption.

Step 1: Create the folder

mkdir -p subtitle-project/subs subtitle-project/out
cd subtitle-project

Keep the subtitle files in subs/ and every render in out/. The split matters later, because the build script overwrites out/ freely and never touches subs/.

Step 2: Render a 24-second test clip

You do not need real footage to test captions. FFmpeg can synthesize a dark navy 1080p frame and a quiet 220 Hz tone.

ffmpeg -y -f lavfi -i "color=c=0x1b2a41:s=1920x1080:r=30:d=24" \
  -f lavfi -i "sine=frequency=220:sample_rate=48000:d=24" \
  -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest test.mp4

The first input is the picture, 1920×1080 at 30 fps for 24 seconds. The second is the audio at 48 kHz. The -pix_fmt yuv420p flag keeps the file playable in browsers and phones. Without it, some FFmpeg builds write a pixel format that Safari and many TVs refuse.

Confirm the clip with ffprobe.

ffprobe -v error -select_streams v:0 \
  -show_entries stream=codec_name,width,height,r_frame_rate,duration \
  -of default=nw=1 test.mp4

Expected output:

codec_name=h264
width=1920
height=1080
r_frame_rate=30/1
duration=24.000000

A flat colour is a gentle background. Real footage is harsher, with bright skies and busy textures behind the text. Once the pipeline works, swap test.mp4 for a shot with a light background and check whether the outline still holds up.

Frame by frame: write the SRT, cue by cue

Two steps here. The first writes the plain cues, the second adds the conventions viewers expect for speakers, sounds and music.

Step 3: Write four plain cues

Create subs/sample.srt and start with cues 1 to 4. Cue 1 is the example subtitle from earlier. Cue 2 shows a two-line cue. Cue 3 shows two speakers. Cue 4 shows a sound description.

1
00:00:01,000 --> 00:00:03,500
This is an example subtitle.

2
00:00:04,000 --> 00:00:07,000
Two lines are fine,
as long as each stays short.

3
00:00:07,500 --> 00:00:09,500
- Did you export it?
- Not yet.

4
00:00:10,000 --> 00:00:11,800
[door closes]

Look at the timing, not just the text. Each cue holds for 1.8 to 3 seconds, and 500 ms of empty screen sits between cues. That gap lets the eye register a change. You can shrink it to two frames (67 ms at 30 fps) when dialogue is fast, but never let one cue end after the next begins.

Step 4: Add italics, music and a number

Append four more cues to the same file. The result is the complete sample.srt used for the rest of the project.

1
00:00:01,000 --> 00:00:03,500
This is an example subtitle.

2
00:00:04,000 --> 00:00:07,000
Two lines are fine,
as long as each stays short.

3
00:00:07,500 --> 00:00:09,500
- Did you export it?
- Not yet.

4
00:00:10,000 --> 00:00:11,800
[door closes]

5
00:00:12,300 --> 00:00:14,800
<i>Is the render finished?</i>

6
00:00:15,000 --> 00:00:17,500
♪ Intro theme plays ♪

7
00:00:18,000 --> 00:00:21,000
Rendered 720 frames in 24 seconds.

8
00:00:21,500 --> 00:00:23,500
Thanks for watching.

Three details deserve a note. Cue 5 wraps the line in <i> tags, the usual way to mark a voice from off screen. Cue 6 uses the music note character, so the file must be saved as UTF-8 or the symbol will turn into question marks. Cue 7 uses a real figure (720 frames in 24 seconds at 30 fps), a small reminder to keep numbers honest because viewers do the arithmetic.

SRT examples for common situations

Most search traffic for an example subtitle comes from people who need one specific pattern, not a tutorial. The table gives the pattern, a line you can paste, and the catch.

Illustrative: Close-up of a video editing timeline on a monitor with blue and yellow clip tracks and audio waveforms
Photo: Vito Gorican / Pexels
SituationExample textCatch
Two speakers in one cue- Did you export it? then - Not yet.One dash per speaker, one speaker per line
Voice from off screen<i>Is the render finished?</i>Italic tags are widely read but not universal
Sound effect[door closes]Square brackets set it apart from speech
Music♪ Intro theme plays ♪Needs UTF-8 for the note character
Speaker labelMAYA: We ship on Friday.Use only when the speaker is not visible
Interrupted lineWe were going to--Two hyphens, no space before them
Trailing thoughtWell...Three dots, not the single ellipsis glyph, for the widest font support
Number and unit4K at 30 fpsKeep the unit on the same line as the figure
Long sentenceSplit across two cuesEnd the first cue on a natural pause

Splitting a long sentence is the pattern people get wrong most often. Break at a clause, not mid-phrase, and let the second cue carry on without repeating words.

9
00:00:24,000 --> 00:00:27,000
When you burn captions into the picture,

10
00:00:27,200 --> 00:00:30,500
they can no longer be switched off.

The first cue ends on a comma, the natural place to breathe. Each half stays under 42 characters, and the 200 ms gap between them is short enough to read as one thought. A reader never hits a line that ends on a word like the or of.

For text that is already on screen, such as a name strap or a street sign, add captions only when the on-screen text is not legible at phone size. Otherwise you double up the information and clutter the frame. Name straps belong in a styled format like ASS, covered below, and the lower thirds and titles section of the blog goes deeper on timing them.

Frame by frame: lint the file with a short script

A subtitle file can look fine and still fail on upload. A short script catches the structural mistakes before a platform or an encoder does.

Step 5: Save and run the validator

Save this as check_subs.py in the project root.

#!/usr/bin/env python3
"""Lint an SRT file: structure, timing, line length, reading speed."""
import argparse
import re
import sys

MAX_CHARS = 42
MAX_LINES = 2
MAX_CPS = 17.0
MIN_DUR = 5 / 6
MAX_DUR = 7.0

TIME = re.compile(r"^(\d{2}):(\d{2}):(\d{2}),(\d{3}) --> (\d{2}):(\d{2}):(\d{2}),(\d{3})$")


def secs(h, m, s, ms):
    return int(h) * 3600 + int(m) * 60 + int(s) + int(ms) / 1000


def check(path, max_chars=MAX_CHARS):
    problems = []
    raw = open(path, "rb").read()
    if raw.startswith(b"\xef\xbb\xbf"):
        problems.append((0, "file starts with a UTF-8 BOM"))
    text = raw.decode("utf-8-sig").replace("\r\n", "\n").strip("\n")
    blocks = re.split(r"\n{2,}", text)
    prev_end = 0.0
    for n, block in enumerate(blocks, start=1):
        lines = block.split("\n")
        if len(lines) < 3:
            problems.append((n, "block needs an index, a time line and text"))
            continue
        if lines[0].strip() != str(n):
            problems.append((n, f"index is {lines[0].strip()!r}, expected {n}"))
        m = TIME.match(lines[1].strip())
        if not m:
            problems.append((n, f"bad time line: {lines[1]!r}"))
            continue
        g = m.groups()
        start, end = secs(*g[:4]), secs(*g[4:])
        dur = end - start
        if end <= start:
            problems.append((n, "end is not after start"))
            continue
        if start < prev_end:
            problems.append((n, "overlaps the previous cue"))
        prev_end = end
        body = lines[2:]
        if len(body) > MAX_LINES:
            problems.append((n, f"{len(body)} lines, limit is {MAX_LINES}"))
        visible = [re.sub(r"<[^>]+>", "", ln) for ln in body]
        for ln in visible:
            if len(ln) > max_chars:
                problems.append((n, f"line is {len(ln)} characters: {ln[:30]}..."))
        chars = len(" ".join(visible))
        cps = chars / dur
        if cps > MAX_CPS:
            problems.append((n, f"reads at {cps:.1f} characters per second"))
        if dur < MIN_DUR:
            problems.append((n, f"on screen for {dur:.2f}s, minimum {MIN_DUR:.2f}s"))
        if dur > MAX_DUR:
            problems.append((n, f"on screen for {dur:.2f}s, maximum {MAX_DUR:.0f}s"))
    return len(blocks), problems


if __name__ == "__main__":
    ap = argparse.ArgumentParser()
    ap.add_argument("file")
    ap.add_argument("--max-chars", type=int, default=MAX_CHARS)
    args = ap.parse_args()
    count, problems = check(args.file, args.max_chars)
    print(f"{args.file}: {count} cues")
    for n, msg in problems:
        print(f"  cue {n}: {msg}")
    print("OK" if not problems else f"{len(problems)} problem(s)")
    sys.exit(1 if problems else 0)

The limits at the top are starting values, not law: 42 characters per line, two lines per cue, 17 characters per second, and a cue duration between five-sixths of a second (20 frames at 24 fps) and 7 seconds. Broadcasters and streaming services publish their own limits, so replace these numbers with the ones in your delivery spec. The script strips HTML-style tags before it counts characters, because viewers never see them.

Run it on the sample.

python3 check_subs.py subs/sample.srt
subs/sample.srt: 8 cues
OK
python3 check_subs.py subs/sample.srt --max-chars 25
subs/sample.srt: 8 cues
  cue 1: line is 28 characters: This is an example subtitle....
  cue 2: line is 28 characters: as long as each stays short....
  cue 7: line is 34 characters: Rendered 720 frames in 24 seco...
3 problem(s)

The script exits with code 1 when it finds a problem and 0 when it does not, so you can drop it into a build script or a pre-commit hook. Because subtitles are plain text, they diff cleanly in Git, which makes retiming mistakes easy to spot in review.

Frame by frame: convert the same file to WebVTT

WebVTT looks like SRT with a header, but a few differences matter. Browsers read it natively through the HTML <track> element, so it is the format for captions on your own web pages and players. According to the HTML standard, that integration still stands.

Step 6: Convert with FFmpeg

ffmpeg -y -i subs/sample.srt subs/sample.vtt

If you would rather skip FFmpeg, this ten-line script does the same job for plain files. Save it as srt2vtt.py.

#!/usr/bin/env python3
import re
import sys

src, dst = sys.argv[1], sys.argv[2]
text = open(src, encoding="utf-8-sig").read().replace("\r\n", "\n")
text = re.sub(r"(\d{2}:\d{2}:\d{2}),(\d{3})", r"\1.\2", text)
with open(dst, "w", encoding="utf-8") as f:
    f.write("WEBVTT\n\n" + text.strip() + "\n")

Run python3 srt2vtt.py subs/sample.srt subs/sample.vtt. Both routes give you the same file. It opens with a WEBVTT header line, and every comma in a timestamp has become a period.

WEBVTT

1
00:00:01.000 --> 00:00:03.500
This is an example subtitle.

2
00:00:04.000 --> 00:00:07.000
Two lines are fine,
as long as each stays short.

Step 7: Add cue settings, a speaker tag and a style block

Here is where WebVTT pulls ahead of SRT. You can position a cue, name the voice and style classes without leaving the file. Save this as subs/styled.vtt.

WEBVTT

STYLE
::cue {
  color: white;
  background: rgba(0, 0, 0, 0.6);
}
::cue(.sfx) {
  color: yellow;
  font-style: italic;
}

NOTE Cue 1 sits near the top of the frame.

intro
00:00:01.000 --> 00:00:03.500 line:10% position:50% align:center
This is an example subtitle.

00:00:04.000 --> 00:00:07.000
<v Maya>Two lines are fine,
as long as each stays short.

00:00:10.000 --> 00:00:11.800
<c.sfx>[door closes]</c>

The STYLE block must come before the first cue, and no blank line may appear inside it. The word intro on its own line is a cue identifier, which is optional and replaces the numbers SRT demands. Settings such as line, position and align follow the timestamps on the same line. The <v Maya> tag names the speaker, and <c.sfx> applies the class defined in the style block.

Browser support for the CSS properties inside ::cue is narrower than it looks, and W3C discussions in 2026 reportedly cover additional ::cue properties. Treat any fancy styling as a bonus and keep the file readable without it. Also remember that W3C minutes from October 30, 2026 reportedly record a resolution to let the specification accept new features, so check the current draft before relying on anything exotic.

The table compares the three formats side by side.

FeatureSRTWebVTTASS
First lineCue numberWEBVTT[Script Info]
Millisecond separatorCommaPeriodPeriod (centiseconds, H:MM:SS.cc)
Cue numberRequiredOptional identifierNone
PositioningNone in the base formatline, position, align, size\an, \pos, per-style margins
Fonts and colourLoose HTML tags, patchy supportCSS in ::cueFull style table
Typical homeEditors, platforms, playersWeb pages and HTML5 playersFansubs, anime, burned-in styling
Formal statusConvention, no specW3C draft, still maintainedDe facto, v4.00+

Frame by frame: style an ASS file as a lower-third caption

ASS, short for Advanced SubStation Alpha, is the format to reach for when you need a name strap, a coloured cue or a caption at an exact pixel position. It is the successor to SSA and is identified by the v4.00+ script type and the [V4+ Styles] section. The original SubStation Alpha program is long abandoned, but the format lives on through renderers such as libass, which the project says FFmpeg, mpv and VLC all use.

Illustrative: A hand on the fader of a lit video production switcher, with blurred monitors behind it in a studio
Photo: Isaiah Ekele / Pexels

Step 8: Write the file

Save this as subs/lowerthird.ass. It carries the same eight cues as the SRT, plus a name strap that fades in at one second.

[Script Info]
Title: Example subtitle with a lower-third strap
ScriptType: v4.00+
PlayResX: 1920
PlayResY: 1080
WrapStyle: 0
ScaledBorderAndShadow: yes

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,64,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,3,1,2,160,160,70,1
Style: Strap,Arial,48,&H00FFFFFF,&H000000FF,&H60201A14,&H00000000,1,0,0,0,100,100,0,0,3,14,0,1,120,120,280,1
Style: Top,Arial,56,&H0000FFFF,&H000000FF,&H00000000,&H00000000,0,1,0,0,100,100,0,0,1,3,1,8,160,160,70,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.00,0:00:03.50,Default,,0,0,0,,This is an example subtitle.
Dialogue: 0,0:00:04.00,0:00:07.00,Default,,0,0,0,,Two lines are fine,\Nas long as each stays short.
Dialogue: 0,0:00:07.50,0:00:09.50,Default,,0,0,0,,- Did you export it?\N- Not yet.
Dialogue: 0,0:00:10.00,0:00:11.80,Top,,0,0,0,,[door closes]
Dialogue: 0,0:00:12.30,0:00:14.80,Default,,0,0,0,,{\i1}Is the render finished?{\i0}
Dialogue: 0,0:00:15.00,0:00:17.50,Default,,0,0,0,,{\fad(250,250)}♪ Intro theme plays ♪
Dialogue: 0,0:00:18.00,0:00:21.00,Default,,0,0,0,,Rendered {\c&H00FFFF&}720 frames{\r} in 24 seconds.
Dialogue: 0,0:00:21.50,0:00:23.50,Default,,0,0,0,,Thanks for watching.
Dialogue: 1,0:00:01.00,0:00:07.00,Strap,,0,0,0,,{\fad(300,300)}Maya Torres\NSound designer

A few things to read closely. PlayResX and PlayResY set the coordinate grid, so a font size of 64 means 64 units on a 1080-unit-high canvas. Colours use the order alpha, blue, green, red, which is the reverse of what web designers expect. &H0000FFFF is yellow, not blue. An alpha of 00 is fully opaque, and FF is invisible.

The Alignment field follows the number pad. Values 1 to 3 sit on the bottom row, 4 to 6 in the middle, 7 to 9 along the top. The Default style uses 2, bottom centre. The Strap style uses 1, bottom left, with a border style of 3 and a margin of 280 to sit about a quarter of the way up the frame. In libass, border style 3 draws an opaque box in the outline colour, which is why the strap’s outline colour holds the box fill. Check how your own player draws it, because renderers differ.

Event times use centiseconds, so 0:00:03.50 is 3.5 seconds. Inside the text, \N forces a line break.

Step 9: Use override tags for one-off effects

Curly braces hold override tags that change a single cue. The sample already uses four.

  • {\i1}...{\i0} turns italics on and off.
  • {\fad(250,250)} fades in over 250 ms and out over 250 ms.
  • {\c&H00FFFF&}720 frames{\r} colours two words yellow, then \r resets to the style.
  • {\an8} would move one cue to the top centre without a separate style. The sample uses a named style instead, which is easier to change in one place.

For a vertical 9:16 video, change four things in the header and the style: set PlayResX: 1080 and PlayResY: 1920, raise Fontsize to around 72, trim MarginL and MarginR to 90, and lift MarginV to roughly 480 so the text clears the buttons and captions that apps draw over the bottom of the frame. Those are starting values. Your platform’s safe zone is the real guide.

Vertical files also need shorter cues. A 9:16 frame is 1080 pixels wide against 1920 for landscape, so a 42-character line that sits comfortably on a laptop fills the whole width of a phone. Re-break the lines at around 25 characters, run check_subs.py with --max-chars 25, and expect most cues to grow from two lines to three.

If you only have an SRT and want a styled file fast, let FFmpeg do the conversion.

ffmpeg -y -i subs/sample.srt subs/converted.ass

The generated file has a 384×288 canvas and a basic style, which is why a font size of 16 looks large on a 1080p frame. Edit the header, then restyle.

Frame by frame: burn the subtitles in, or embed them as a track

Burned-in captions, also called open captions, become part of the picture. Viewers cannot switch them off, and no platform can drop them. They also force a re-encode of the video, so expect a quality hit unless you encode at a high quality setting.

Step 10: Burn the SRT with a custom style

ffmpeg -y -i test.mp4 \
  -vf "subtitles=subs/sample.srt:force_style='FontName=Arial,FontSize=18,PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,BorderStyle=1,Outline=2,Shadow=0,Alignment=2,MarginV=40'" \
  -c:v libx264 -crf 18 -preset medium -pix_fmt yuv420p \
  -c:a copy -movflags +faststart out/burned_srt.mp4

The audio is copied untouched with -c:a copy, and only the video is re-encoded. CRF 18 is a high-quality setting for H.264, where lower numbers mean larger files and fewer artefacts. -movflags +faststart moves the index to the front so the file starts playing before it finishes downloading.

Step 11: Burn the ASS file

ffmpeg -y -i test.mp4 \
  -vf "ass=subs/lowerthird.ass" \
  -c:v libx264 -crf 18 -preset medium -pix_fmt yuv420p \
  -c:a copy -movflags +faststart out/burned_ass.mp4

The ass filter reads only ASS files and applies every style in the file. Do not add force_style here, because it would override the styles you wrote. If your fonts are not installed system-wide, point at a folder with subtitles=subs/lowerthird.ass:fontsdir=fonts.

Render settings

These settings are a sensible baseline for your own export of the sample project.

SettingLandscape masterVertical version
Resolution1920×10801080×1920
Frame rate30 fps30 fps
Length24 seconds24 seconds
Container and codecsMP4, H.264 and AACMP4, H.264 and AAC
QualityCRF 18, preset mediumCRF 18, preset medium
Pixel formatyuv420pyuv420p
Caption sizeFontSize=18 for SRT, 64 in ASS72 in ASS
Bottom margin40 (SRT scale) or 70 (ASS)About 480 (ASS)

Intro and title themes come with their own length and frame-rate specs, which is useful when you want captions to match an opener. The Vipid themes page lists resolution, length and frame rate for each one.

Soft subtitles: embed a track and check the streams

Soft subtitles stay a separate track inside the file. Viewers can turn them on and off, switch languages, and the picture is never re-encoded. Platforms and players differ on what they read, so check the target before you commit.

Step 12: Mux the tracks

ffmpeg -y -i test.mp4 -i subs/sample.srt \
  -map 0 -map 1 -c copy -c:s mov_text \
  -metadata:s:s:0 language=eng out/soft_srt.mp4

ffmpeg -y -i test.mp4 -i subs/lowerthird.ass \
  -map 0 -map 1 -c copy \
  -metadata:s:s:0 language=eng out/soft_ass.mkv

MP4 only carries the mov_text subtitle codec, and mov_text keeps text and basic formatting but drops positioning and the ASS style table. Matroska keeps ASS intact, so the second command preserves the strap, the colours and the fade. The language=eng tag matters, because players list tracks by language and an untagged track shows up as unknown.

Check what landed in each file.

ffprobe -v error -select_streams s \
  -show_entries stream=index,codec_name:stream_tags=language \
  -of csv=p=0 out/soft_srt.mp4
2,mov_text,eng

The subtitle sits at stream index 2, after video (0) and audio (1). Run the same command on the MKV and you should see 2,ass,eng.

The complete project, assembled

Step 13: Run the whole build

This script runs the whole pipeline in one go: it builds the clip if it is missing, lints the SRT, converts it to WebVTT, burns both caption styles and muxes both soft tracks. Save it as build.sh and run bash build.sh.

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
mkdir -p out

[ -f test.mp4 ] || ffmpeg -y -loglevel error \
  -f lavfi -i "color=c=0x1b2a41:s=1920x1080:r=30:d=24" \
  -f lavfi -i "sine=frequency=220:sample_rate=48000:d=24" \
  -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest test.mp4

python3 check_subs.py subs/sample.srt

ffmpeg -y -loglevel error -i subs/sample.srt out/sample.vtt

STYLE="FontName=Arial,FontSize=18,PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,BorderStyle=1,Outline=2,Shadow=0,Alignment=2,MarginV=40"
ffmpeg -y -loglevel error -i test.mp4 \
  -vf "subtitles=subs/sample.srt:force_style='$STYLE'" \
  -c:v libx264 -crf 18 -preset medium -pix_fmt yuv420p \
  -c:a copy -movflags +faststart out/burned_srt.mp4

ffmpeg -y -loglevel error -i test.mp4 \
  -vf "ass=subs/lowerthird.ass" \
  -c:v libx264 -crf 18 -preset medium -pix_fmt yuv420p \
  -c:a copy -movflags +faststart out/burned_ass.mp4

ffmpeg -y -loglevel error -i test.mp4 -i subs/sample.srt \
  -map 0 -map 1 -c copy -c:s mov_text \
  -metadata:s:s:0 language=eng out/soft_srt.mp4

ffmpeg -y -loglevel error -i test.mp4 -i subs/lowerthird.ass \
  -map 0 -map 1 -c copy \
  -metadata:s:s:0 language=eng out/soft_ass.mkv

for f in out/soft_srt.mp4 out/soft_ass.mkv; do
  echo "$f"
  ffprobe -v error -select_streams s \
    -show_entries stream=index,codec_name:stream_tags=language \
    -of csv=p=0 "$f"
done

The set -euo pipefail line stops the script at the first failure instead of racing on with a broken file, and the lint step runs before any slow encode. When it finishes, the folder looks like this.

subtitle-project/
  build.sh
  check_subs.py
  srt2vtt.py
  test.mp4
  subs/
    sample.srt
    sample.vtt
    styled.vtt
    lowerthird.ass
  out/
    sample.vtt
    burned_srt.mp4
    burned_ass.mp4
    soft_srt.mp4
    soft_ass.mkv

The last two lines the script prints come from ffprobe:

out/soft_srt.mp4
2,mov_text,eng
out/soft_ass.mkv
2,ass,eng

Open burned_ass.mp4 and check three moments. At 1.0 seconds the strap should fade in at lower left, with the first caption centred below it. At 10.0 seconds the sound cue should appear at the top of the frame in yellow italics. At 18.0 seconds two words should turn yellow and reset on schedule. If you have a title sequence to put in front of the captioned cut, the smoke title sequence theme in the Vipid archive is one ready-made opener to try.

Broken example subtitle files and what each one does

Good samples teach the syntax. Broken ones teach what to look for when an upload fails with a vague error. The file below packs three mistakes into three cues. Save it as subs/broken.srt.

1
00:00:01.000 --> 00:00:03.500
Dots instead of commas.

3
00:00:04,000 --> 00:00:03,000
Wrong index and end before start.

4
00:00:03,500 --> 00:00:09,500
This line is far too long to read comfortably on a phone screen in one go.

Cue 1 uses periods where commas belong. Cue 2 skips a number and ends before it starts. Cue 3 runs a 74-character line across a phone screen. Feed it to the lint script and the damage shows up cue by cue.

subs/broken.srt: 3 cues
  cue 1: bad time line: '00:00:01.000 --> 00:00:03.500'
  cue 2: index is '3', expected 2
  cue 2: end is not after start
  cue 3: index is '4', expected 3
  cue 3: line is 74 characters: This line is far too long to r...
5 problem(s)

A second fixture covers timing. Save this as subs/fast.srt.

1
00:00:01,000 --> 00:00:02,000
This cue carries far too much text for one second.

2
00:00:01,800 --> 00:00:02,400
Overlap and flash.
subs/fast.srt: 2 cues
  cue 1: line is 50 characters: This cue carries far too much ...
  cue 1: reads at 50.0 characters per second
  cue 2: overlaps the previous cue
  cue 2: reads at 30.0 characters per second
  cue 2: on screen for 0.60s, minimum 0.83s
5 problem(s)

Players react differently to each defect, because SRT has no formal specification to arbitrate. The table lists the usual outcomes. Strict parsers reject the file, lenient ones guess, and you cannot tell which kind your audience uses.

DefectExampleTypical resultWhat the lint reports
Period in the time line00:00:01.000Rejected by strict parsers, guessed by lenient onesbad time line
Skipped cue number1, then 3Usually still plays, but some upload tools refuse itindex mismatch
End before start00:00:04,000 --> 00:00:03,000Cue never appearsend is not after start
Overlapping cuesCue starts before the last one endsStacked text or a dropped cueoverlaps the previous cue
Reading speed too high50 characters in one secondValid file, unreadable captionscharacters per second
Flash cueShorter than about 20 framesText blinks pastminimum duration
BOM at the startInvisible bytes before cue 1First cue may fail to parsefile starts with a UTF-8 BOM

Keep both fixtures in a fixtures/ folder and run the lint over them whenever you edit check_subs.py. Each should fail. If one passes, you broke the linter and not the file.

for f in subs/broken.srt subs/fast.srt; do
  python3 check_subs.py "$f" > /dev/null && echo "$f should have failed"
done

Silence means both files failed as expected.

Common pitfalls

  • Periods in an SRT time line. The comma is part of the format. 00:00:01.000 works in some players and fails in others, and a strict upload parser rejects the whole file.
  • Saving in the wrong encoding. UTF-8 is the safest choice for interoperability. A file saved in a legacy code page turns accented letters and the music note into junk, and a BOM at the start can break the first cue number.
  • Blank lines inside a cue. A stray empty line ends the cue and turns the remaining text into a malformed block. Check pasted text from documents and chat apps.
  • Overlapping cues. Two cues on screen at once stack unpredictably, and some players drop the second. Keep end times earlier than the next start.
  • Reading speed ignored. A cue with 50 characters in one second cannot be read, no matter how correct the syntax. Run the lint script and split or extend the cue.
  • Font size units. SRT burn-in scales against a 288-unit canvas, ASS uses your PlayRes grid, and WebVTT uses CSS. The same number of 18 gives three very different results.
  • Colour order in ASS. The order is blue, green, red, so &H0000FF& is red. Web hex values need reversing byte by byte.
  • Trusting styling tags in SRT. Italic and bold tags travel well, font and colour tags do not. If the look matters, use ASS or burn the text in.
  • Burning in when soft would do. Open captions cannot be removed, translated or corrected after export. If a platform accepts a sidecar file, upload one and keep a burned-in version only for social clips.

Troubleshooting

Each item below pairs the symptom you will see with the cause and the fix.

  • No such filter: ‘subtitles’. Your FFmpeg was built without libass. Install a full build or compile with --enable-libass, then re-run the filter check from the prerequisites.
  • Unable to open subs/sample.srt. The path is wrong or the shell mangled it. Use a path relative to where you run the command, and on Windows escape the drive colon, for example subtitles='C\:/work/subs/sample.srt'.
  • Accents or the music note show as question marks. The file is not UTF-8. Resave it as UTF-8, or tell FFmpeg what it is reading with the charenc option on the subtitles filter.
  • Text is far too big or too small. You applied an ASS-scale font size to an SRT, or the reverse. Use the 288-unit rule for SRT and the PlayRes grid for ASS.
  • Boxes instead of letters. The font is missing and libass fell back to one without the glyphs. Install the font or use fontsdir.
  • Your ASS styles vanish. You used force_style or the subtitles filter with overrides on top of an ASS file. Use the ass filter and put the styling in the file itself.
  • The strap box has no colour or the wrong colour. Border style 3 takes its fill from the outline colour in libass. Set OutlineColour to the box colour, and remember the alpha byte comes first.
  • WebVTT does not load in a browser. The first line must be WEBVTT, the server needs to send a text MIME type, and the <track> needs a matching srclang and a default attribute to show without a click.
  • Captions run ahead or behind by a fixed amount. Shift the whole file with ffmpeg -itsoffset 1.5 -i subs/sample.srt shifted.srt, which delays every cue by 1.5 seconds. Use a negative value to pull them earlier.
  • Soft subtitles show in VLC but not on a platform. Strict parsers reject BOMs, skipped numbers and bad time lines. Run check_subs.py and fix what it reports.
  • MP4 lost all styling. mov_text keeps text only. Use MKV for ASS or burn the captions in.

Advanced tips

Once the basic pipeline works, a handful of habits pay off.

Stack two languages. In ASS, define a Top style for the second language and a Default style for the first, then write a pair of events with the same times. Each language keeps its own font and colour, and viewers can read both without a track switch.

Keep an original-size hint. When you burn an SRT into a frame that is not 1080p, add original_size=1920x1080 to the subtitles filter. libass then scales your style as if the frame were that size, which makes font sizes behave the same across renders.

Time to the audio, not the picture. Place the cue in point two to four frames before the first word. People read slightly ahead of speech, and a cue that lands on the first syllable feels late.

Add karaoke timing. The ASS \k tag takes a duration in centiseconds for each syllable, so {\k50}Hel{\k50}lo highlights the first half for half a second, then the second. It suits lyric videos and sing-along clips.

Version your subtitles. They are text, so commit them. A diff shows exactly which cue changed, and a pre-commit hook that runs check_subs.py stops a bad file from reaching the render queue.

Keep libass current. Because libass parses files from outside your control, running 0.17.5 or newer is a cheap guard. Package versions lag, and a distribution listing may still show an older build, so check yours with the package manager.

Split by language and platform. Keep one master SRT per language and generate variants. Vertical clips get a shorter line limit, landscape clips get the default, and the lint script takes the limit as a flag.

Before you render

What is an example subtitle file?

It is a small text file that pairs timestamps with text. In SRT each block holds a cue number, a time range and one or two lines of text, with a blank line between blocks.

What is the difference between SRT and WebVTT?

SRT starts with a cue number and writes milliseconds after a comma. WebVTT starts with a WEBVTT line, uses a period, and adds cue settings, speaker tags and CSS styling. Browsers read WebVTT natively, while SRT is the format most editors and platforms accept.

Can I write a subtitle file in Notepad?

Yes. Any plain text editor works, as long as you save as UTF-8 and use the .srt, .vtt or .ass extension. Make sure the editor does not hide a .txt extension on the end.

How long should each subtitle stay on screen?

A common minimum is about five-sixths of a second, and a common maximum is 7 seconds, which is what the lint script in this article uses. Check your delivery spec, because broadcasters and streaming services set their own limits.

Should I burn subtitles into the video or upload a file?

Upload a file when the platform accepts one, because viewers can toggle it, and you can fix typos without re-exporting. Burn them in for short social clips, or when you need exact styling that a platform’s caption renderer cannot match.

Which format keeps fonts, colours and positions?

ASS. WebVTT can style captions through CSS in browsers, but support varies. SRT has no reliable styling, and MP4’s mov_text track drops ASS styles.

Which FFmpeg version should I use?

Any current build with libass enabled. FFmpeg 9.1 is the latest stable release as of November 27, 2026. What matters more than the version number is that ffmpeg -filters lists subtitles and ass.

More from the Vipid blog

Make it with Vipid

Ines Calder

Titles & Motion Editor · Vipid Team

Ines Calder is the Titles & Motion Editor at Vipid, covering lower thirds, title sequences, kinetic typography and logo animation across After Effects, Premiere Pro, DaVinci Resolve and Final Cut Pro. She writes her guides in frames and safe areas so they hold up on a phone as well as a TV, and every template she lists carries its editor version, plugin needs and licence.

All articles by Ines Calder ›   How we check tools ›

Keep reading

Font For Subtitle
Lower Thirds & Titles

Font For Subtitle

Ines Calder·24 Nov 2026
How to Add Captions to a TikTok Video
Lower Thirds & Titles

How to Add Captions to a TikTok Video

Ines Calder·19 Nov 2026
Lower Thirds Examples [2026]: 6 Styles, 5 Editors
Lower Thirds & Titles

Lower Thirds Examples [2026]: 6 Styles, 5 Editors

Ines Calder·18 Nov 2026

Blog

Intros & Templates
Titles & Motion
Streaming
Editing & Export
AI Video

Vipid

About Vipid
Themes
News archive 2011–2016
Vipid Team

Editorial

Editorial policy
How we check tools
Corrections

Legal

Privacy policy
Terms of service
Making video intros since 2010.
The Vipid blog covers the tools behind them.