The SubRip (SRT) format has become the de facto standard for subtitles. Its straightforward structure makes it both human-readable and easy to process programmatically, leading to near-universal support across players, editors, and platforms.
A Brief History
The story of SRT begins in 1999 with a simple but powerful idea: extracting subtitles from DVDs. The original SubRip software used optical character recognition (OCR) to convert DVD subtitles into editable text files. What started as a format for extracted subtitles quickly evolved into something bigger.
Why did it become so popular? The format's simplicity played a huge role. At a time when subtitles were becoming increasingly complex, SRT focused on the essentials: timing and text. This simplicity, combined with its plain text nature, made it perfect for both manual editing and automated processing.
Anatomy of an SRT File
Let's look at a typical SRT file:
1
00:00:01,000 --> 00:00:04,000
In a world where time is money,
efficiency is everything.
2
00:00:04,500 --> 00:00:07,000
Our next-generation AI system
brings unprecedented speed.
3
00:00:07,100 --> 00:00:09,000
As shown above, each subtitle entry consists of:
- An ordered sequence number (1, 2, 3, etc.)
- Timing information as timespans (start --> end)
- One or more lines of text
- An empty line, if another entry follows
Basic Structure
The format is strict but straightforward:
- Each subtitle entry must be separated by a blank line
- Timespans contain exactly two timecodes, separated by a long arrow
-->
.
Note that this arrow does not contain any special characters, only dashes and a greater-than sign.
Timecodes are formatted as HH:MM:SS,UUU
where:
HH
: hours (00-99)MM
: minutes (00-59)SS
: seconds (00-59)UUU
: milliseconds (000-999)
For example: 01:23:45,678
Text Formatting
SRT supports basic text formatting, though support varies widely:
Standard HTML-style Tags
<b>Bold text</b>
<i>Italic text</i>
Some players also support nested tags:
However, for better compatibility, it's best to avoid nested formatting, and only use tags at the start and end of a line. Many players (especially older Smart TVs, set-top boxes, and mobile apps) even ignore these tags completely. For maximum compatibility, make sure to only use plain text, without additional formatting.
Position and Alignment
Some players support SSA/ASS-derived positioning tags such as {\an8}
- however, this is quite rare since these positioning tags are non-standard for the SRT format itself. VLC Media Player, for example, supports them, but many other players will display them as literal text. Test thoroughly on your target platforms before using these tags.
Working with SRT Files
Improving Readability
While not strict requirements, following these guidelines often improves readability:
- A maximum of two lines per subtitle is usually optimal
- Around 40 characters per line works well for most languages
- Aim for 20-25 characters per second for comfortable reading
- Break lines at natural speech pauses or punctuation
- Consider a minimum duration of 1 second for short phrases
- Longer subtitles might need up to 7 seconds
Technical Recommendations
For the most robust subtitle files:
- Use UTF-8 encoding to handle all languages reliably and avoid platform-specific quirks
- Make sure to test any formatting tags on your target platforms, or leave them out entirely
- Leave small gaps between subtitles (2-3 frames) for smoother playback
Tools and Validation
While any text editor can open SRT files, specialized tools make creation and validation easier.
Professional subtitle editors:
- Aegisub: Cross-platform, excellent for timing and styling
- Subtitle Edit: Windows-based, powerful batch processing
Media players for testing:
- VLC: Universal format support, good for compatibility testing
- MPC-HC: Windows, precise frame-by-frame timing control
Let's look at some common mistakes:
1
00:00:01.000 --> 00:00:04.000
First subtitle
2
00:00:04,000 --> 00:00:08,000
This file is invalid because:
- It has a decimal point instead of a comma in the first timing entry
- It has a missing blank line between the two entries
The very last line also contains a non-standard tag, which is not supported by most players, but may be supported by some.
Here's a fixed version, guaranteed to be compatible with all players:
1
00:00:01,000 --> 00:00:04,000
First subtitle
2
00:00:04,000 --> 00:00:08,000
What's Next?
Understanding SRT files is just the beginning. In our next article, we'll tackle character encoding - a common source of subtitle problems that can make your perfectly formatted SRT file show up as gibberish.
Have your text editor ready - we're going to dive into the world of UTF-8, Unicode, and legacy encodings.