Skip to main content
SubRip (.srt files)

Learn how to use SRT files to add captions to your videos.

Ilya Krukowski avatar
Written by Ilya Krukowski
Updated this week

In this article, you'll learn how to work with the SRT file format, which is commonly used to store captions for videos.

Introduction to SRT files

SubRip Subtitle (SRT) files, identifiable by the .srt extension, are a popular type of subtitle file format. These files allow you to add captions to video content after production, making your videos more accessible to a wider audience. SRT files are easy to understand and use because they are structured in plain text, making them readable by both humans and software.

An SRT file consists of a series of subtitle text blocks separated by blank lines. Each subtitle block includes a sequential number, starting from 1, along with the corresponding timing information. This structure ensures that the subtitles appear at the right time during video playback.

By using SRT files, you can enhance your videos with captions that help viewers follow along with the audio, especially in noisy environments or for those who are hard of hearing. Whether you're creating content for social media, educational purposes, or entertainment, SRT files are a simple yet powerful tool to improve your video's accessibility and engagement.

SRT file structure

An SRT file contains subtitles in a specific format, making it easy to add captions to videos. Here's how an SRT file is structured:

  1. Numeric counter: Each subtitle sequence is identified by a numeric counter, starting from 1. This counter helps keep track of the order of subtitles. When importing an SRT file, this counter is dismissed and then restored during exporting.

  2. Timecode: Each subtitle has a timecode that specifies when it should appear and disappear on the screen. The format is hours:minutes,milliseconds (00:00:00,000). The timecode ensures that captions sync accurately with the video and is used as a key on platforms like Lokalise. During exporting, the keys are sorted by timecodes.

  3. Subtitle text: The actual text of the subtitle, which can span one or multiple lines. This text is saved as a translation value on localization platforms. The text can include basic HTML-like tags for formatting (e.g., <b> for bold, <i> for italics).

  4. Blank line: A blank line separates each subtitle block, indicating the end of the current subtitle and the start of the next.

Here's an example of an SRT file:

1
00:02:17,440 --> 00:02:20,375
Senator, we're making
our <b>final</b> approach into {u}Coruscant{/u}.

2
00:02:20,476 --> 00:02:22,501
{b}Very good, {i}Lieutenant{/i}{/b}.

3
00:02:24,948 --> 00:02:26,247 X1:201 X2:516 Y1:397 Y2:423
<font color="#fbff1c">Whose side is time on?</font>

4
00:02:36,389 --> 00:02:39,290 X1:203 X2:511 Y1:359 Y2:431
v

5
00:02:41,000 --> 00:02:43,295
[speaks Icelandic]

6
00:02:45,000 --> 00:02:48,295
[man 3] <i>♪The admiral
begins his expedition♪</i>

Please note that the SRT format does not support placeholders, plurals, or gender-specific translations. It is a simple, plain text format designed to be universally readable and easy to work with across various video and audio file formats. For more information on limitations, see the section below.

By understanding the structure of SRT files, you can effectively create and edit subtitles to enhance your videos with clear and synchronized captions. This improves the viewing experience for all audiences, including those who rely on closed captions for accessibility.

Formatting

The SRT file format supports basic text formatting derived from HTML, making it easy to customize the appearance of your subtitles and captions.

Here are some common formatting options:

  • Bold <b>…</b> or {b}…{/b}.

  • Italic <i>…</i> or {i}…{/i}.

  • Underline <u>…</u> or {u}…{/u}.

  • Font color<font color="color name or #color_code">…</font>.

  • Line positionX1:… X2:… Y1:… Y2:… (coordinates for text placement after the timestamp).

Nested tags are supported, allowing for multiple formatting options within the same line. While some implementations of SRT prefer whole-line formatting only, the formatting can be stored "as-is" in the file. This flexibility makes SRT files versatile for different audiences and video content types.

Encoding

Learn more about character encodings and their differences in our blog post.

There is no strict character encoding standard for SRT files. They can be encoded in various formats, including:

  • Windows-1252

  • Windows-1251

  • Unicode

  • UTF-8

  • UTF-16 (with or without Byte Order Mark, BOM)

This lack of standardization means you should ensure your SRT files are encoded correctly to avoid issues with displaying captions. UTF-8 is commonly used because of its compatibility and support for a wide range of characters.

Working with SRT files on Lokalise

Importing SRT files

To upload an SRT file to Lokalise, follow these steps:

  1. Open your Lokalise project.

  2. Navigate to the Upload page.

  3. Start the uploading process as usual by selecting one or more SRT files from your PC or copy-pasting their content directly.

  4. Adjust the filename or the detected language.

Lokalise will accept any file with a valid .srt extension but will not perform deep validation of the file's content. If the SRT file contains invalid formatting, the corresponding translation keys and values won't be created in your project. This means you should ensure your SRT file is correctly formatted before uploading to avoid issues.

After the file is imported, you can perform translations in the project editor. This allows you to manage and edit subtitles and captions efficiently. You can adjust the timing, text, and formatting of the subtitles directly within Lokalise, ensuring your video content is accessible to a wider audience:

Exporting SRT files

To export your subtitles back in the .srt format from Lokalise, follow these steps:

  1. Go to the Download page in your Lokalise project.

  2. From the File format dropdown, select SubRip:

You can adjust other export options as needed, but keep in mind that SRT files do not support placeholders or plurals. This means the Plural format and Placeholder format options will not be available. Additionally, the Order keys by option will be disabled since SRT keys are always sorted by their timecodes.

Once you have configured the options, click Build and download to export the translation bundle. This will provide you with a properly formatted SRT file containing your translated subtitles and captions, ready to be used with your video content.

Limitations of SRT files

While SRT files are widely used and easy to work with, they do have some limitations:

  1. No support for advanced formatting:
    SRT files support basic HTML-like formatting (bold, italic, underline, font color), but they do not support advanced formatting options such as different font sizes, styles, or background colors.

  2. Limited positioning options:
    They offer basic positioning through coordinates (X1, X2, Y1, Y2), but lack the advanced positioning controls available in other subtitle formats like WebVTT or ASS (Advanced SubStation Alpha).

  3. No audio support:
    SRT files are purely text-based and do not support embedding or linking to audio files. They are meant solely for subtitles and captions without any multimedia elements.

  4. No styling or theming:
    Unlike some other subtitle formats, SRT files do not support styling or theming. You cannot define styles for different types of text (e.g., different colors for different speakers).

  5. No metadata:
    SRT files do not include metadata fields for information such as language, author, or description. This can make it harder to manage and organize subtitles in large projects.

  6. No support for placeholders, plurals, or gender-specific translations:
    SRT files do not support placeholders, plurals, or gender-specific translations, limiting their use in dynamic or highly localized content.

Did this answer your question?