Captions and Subtitles: Build a File and Check the Reading Speed
Build an SRT caption file from timed lines, check reading speed, line length and overlaps, and review automatic captions.
In this lesson you will
- Explain why captions matter
- Read the structure of an SRT file
- Check reading speed, length and overlap
- Review automatic captions with care
About 28 minutes
Sound off, eyes on
Abena watches Kofi’s video on a bus with her phone muted. She cannot hear a word, and she gives up after twenty seconds. Another friend, who is deaf, tells Kofi that the automatic captions on one of his videos turned “pinching” into “pitching” and “basil” into “bazel”. Captions matter to everyone who cannot or will not listen: viewers who are deaf or hard of hearing, people in noisy or quiet places, and people watching in a second language. They are also one of the more practical things a beginner can do to make a video easier to use.
Captions on YouTube
At the time of writing, YouTube creates automatic captions for many videos, and its help pages encourage creators to review and edit them, because they can get words wrong, especially with accents, noise or specialist words. You can also add your own, in YouTube Studio under Subtitles. You can type them, paste a transcript and let the site line it up with the speech, or upload a caption file, with or without timing. Supported file types include common ones like SRT and WebVTT; check the Help page for the full list.
What is inside a caption file
An SRT file is plain text, made of numbered blocks. Each block has an index, a time range written as hours, minutes, seconds and milliseconds, an arrow, and the text. A blank line separates blocks. The program builds such a file from five timed lines of Kofi’s script and prints the start of it.
import re
lines = [
(0.0, 3.2, "Your basil keeps dying on the windowsill,"),
(3.2, 6.0, "and it is almost never the water."),
(6.0, 7.0, "In this video I will show you three signs to check before you throw the pot away."),
(7.0, 12.5, "First, look at the leaves."),
(12.4, 15.0, "If the lower leaves turn pale and drop, the roots are sitting in water."),
]
def stamp(t):
ms = int(round(t * 1000))
return "%02d:%02d:%02d,%03d" % (ms // 3600000, ms // 60000 % 60, ms // 1000 % 60, ms % 1000)
srt = []
for i, (a, b, text) in enumerate(lines, 1):
srt.append(str(i) + chr(10) + stamp(a) + " --> " + stamp(b) + chr(10) + text)
file = (chr(10) * 2).join(srt)
print("\n".join(file.split(chr(10))[:7]))
print("cues:", len(re.findall(r"-->", file)))
MAX_CPS = 17
MAX_CHARS = 42
for i, (a, b, text) in enumerate(lines, 1):
cps = len(text) / (b - a)
problems = []
if cps > MAX_CPS:
problems.append("too fast " + str(round(cps)) + " cps")
if len(text) > MAX_CHARS:
problems.append("long line " + str(len(text)))
if i > 1 and a < lines[i - 2][1]:
problems.append("overlaps cue " + str(i - 1))
print("cue " + str(i) + ": " + ("ok" if not problems else ", ".join(problems)))
1
00:00:00,000 --> 00:00:03,200
Your basil keeps dying on the windowsill,
2
00:00:03,200 --> 00:00:06,000
and it is almost never the water.
cues: 5
cue 1: ok
cue 2: ok
cue 3: too fast 81 cps, long line 81
cue 4: ok
cue 5: too fast 27 cps, long line 71, overlaps cue 4
The first lines show the format exactly as a player reads it. The file holds 5 cues. Below it, the program runs three checks on each cue. The first is reading speed, in characters per second. Viewers need time to read, and captions that flash past are hard to follow. The second is the length of the line. The third is whether a cue overlaps the one before it. The limits are 17 characters a second and 42 characters a line. These are common style choices of caption writers, and not rules of YouTube, so they are labelled as assumptions.
Cues 1, 2 and 4 pass. Cue 3 is a trap: a long sentence of 81 characters squeezed into one second gives a speed of 81 characters a second, far too fast, and a line too long for a phone screen. The fix is to split the sentence into two or three cues and give each a fair share of the time. Cue 5 is worse: it runs at 27 characters a second, is 71 characters long, and starts at 12.4 seconds, before cue 4 has ended at 12.5. Two captions at once is a sign of a timing slip.
Habits for good captions
- Review automatic captions. Fix names, specialist words and punctuation. Many errors are in the words that matter most.
- Break at natural places. Split at the end of a phrase, not in the middle of one.
- Keep lines short. One or two short lines at a time read best on a phone.
- Include meaningful sounds when they matter, such as laughter or a doorbell, if captions are for viewers who cannot hear.
- Ask a helper. A person with the Subtitle Editor role can work on subtitles without access to the rest of the channel, as lesson 18 shows.
Captions also help your own work. A transcript is a tool for writing a blog post or description from the video, for finding the moment where you said something, and for translation. If your audience speaks other languages, you can add subtitles in them. Machine translation can get you started, but have a fluent person check anything that matters.
Trusting automatic captions without reading them. A wrong word in a caption can change the meaning, and viewers who rely on captions cannot tell.
The script lines and timings are made up. The 17 characters a second and 42 characters a line are common style choices used in the lesson, not YouTube rules. File types and menus change, so check YouTube Help.
Practice for this lesson
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
Why review automatic captions?
- They are always perfect
- They cannot be edited
- They hide the video
- They can get words wrong, especially names and unusual words
Wrong words can change the meaning.
What does an SRT cue contain?
- An index, a time range and the text
- A thumbnail and a title
- A chapter and a playlist
- A password
Blocks are separated by a blank line.
Why was cue 3 a problem?
- It was too short to read
- It had no text
- A long sentence squeezed into one second reads too fast
- It started at zero
It needed splitting into more cues with fair time.
Are the 17 and 42 limits YouTube rules?
- Yes, YouTube enforces them
- Only on Shorts
- Only on live streams
- No, they are common style choices used in the lesson
They are labelled as assumptions.
Who benefits from captions?
- Only the creator
- Deaf viewers, people in noisy places and second-language viewers
- Only people with fast internet
- Nobody
Captions make a video easier to use for many people.
Summary
- Captions help many viewers, not only those who cannot hear.
- An SRT cue has an index, a time range and text.
- Check speed, line length and overlaps; assumptions are labelled.
- Always review automatic captions.
Questions
Should I upload my own caption file?
It is worth it for important videos, or when automatic captions are poor. You can also edit the automatic ones in the editor. Choose whichever is faster for you, then review the result.
Do captions help with search?
They give the site text to work with, and a transcript helps people, but the site does not publish a formula. Make captions for viewers first, and treat any search benefit as a bonus.
How should I handle several languages?
Add subtitles for the languages your audience uses. Machine translation is a starting point, so have a fluent speaker check key videos, and label the language correctly.
