Subtitle Translation Is More Than Sentence Order: Timing and Blank Lines Also Need Checking

When parsing SRT subtitles, checking only the number of text line breaks cannot detect inverted or overlapping timelines. This article uses the Python standard library to demonstrate how to verify timestamp monotonicity and minimum intervals, and provides a practical checklist for translation acceptance combined with OmniDoc.

Key points of this article

  • Subtitle translation acceptance cannot rely solely on line-break counts; the timeline must also be checked.
  • This example only supports the common SRT format of sequence number plus time range, and does not handle style or positioning extensions.
  • The sample protocol requires that subtitle sequence numbers be consecutive, time intervals do not overlap, and the end time be later than the start time.
  • Structural checks can catch errors early, but they cannot replace display and synchronization acceptance in the target player.
  • The code does not measure reading speed, nor can it identify speakers on screen; these items require manual review.

After a subtitle translation is finished, many people only check whether the sentences read smoothly. But if timecodes are squeezed onto the same line, the time order is reversed, or blank lines between blocks are lost, the player cannot read the subtitles correctly. This article is written for translators and post-production staff who need to deliver SRT subtitles. It explains how to check timecodes and blank lines before and after translation, and offers reusable inspection methods.

SRT sequence numbers, time ranges, text lines, and blank lines separating blocks each serve a purpose. When checking a file, you should preserve these structural layers separately, rather than judging quality solely by the total number of line breaks in the whole file.

Note: This article uses synthetic samples to demonstrate processing methods. Before processing important files, keep the original documents, and review them against the boundaries and acceptance items described in the text.

How should subtitle translations be checked and accepted? A one-sentence conclusion.

First ensure the SRT structure is complete, then actually play it in the target player to check display, line breaks, and timing synchronization.

Your situationRecommended PracticesCause
Subtitle text has been translated; formatting issues need to be checked quickly.First, use a script to check the sequence numbers, time ranges, and blank linesStructural checks can catch some errors in advance.
Need to check timestamp order or overlapParse the time and compare adjacent blocks' timesChecking only the number of line breaks cannot detect inverted or overlapping timelines.
Subtitles need to be delivered to the player.Check the display and synchronization segment by segment in the target playerThe code can't measure reading speed, and it also doesn't know who the speaker is in the frame.
Subtitle translations get longer (e.g., for some languages)Focus on checking line breaks and whether the display overflows.Longer text is more likely to affect the display result.

Define the accepted SRT format first

The method below only supports the common sequence-number plus HH:MM:SS,mmm --> HH:MM:SS,mmm format, with at least one line of body text in each block. It does not handle style extensions, subtitle positioning information, or other subtitle formats.

The synthesis protocol requires that sequence numbers be consecutive and that time periods do not overlap. If a real project allows overlaps, this rule would need to be adjusted separately.

Separate format parsing from time comparison

Parse the format first, then compare the times. The parsing part is only responsible for splitting the text into blocks, sequence numbers, start and end times, and body text. The time comparison part is only responsible for checking order and gaps. Keeping the two parts separate makes it easier to locate problems when something goes wrong.

import re

STAMP = r"[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}"
def millis(text):
    h, m, rest = text.split(":")
    s, ms = rest.split(",")
    if int(m) >= 60 or int(s) >= 60:
        raise ValueError("invalid minute or second")
    return ((int(h) * 60 + int(m)) * 60 + int(s)) * 1000 + int(ms)

def parse_srt(text):
    blocks = re.split(r"\n[ \t]*\n", text.replace("\r\n", "\n").strip())
    result, previous_end = [], 0
    for index, block in enumerate(blocks, 1):
        lines = block.splitlines()
        if len(lines) < 3 or lines[0] != str(index):
            raise ValueError("sequence or body missing")
        match = re.fullmatch(f"({STAMP}) --> ({STAMP})", lines[1])
        if not match:
            raise ValueError("invalid timestamp line")
        start, end = map(millis, match.groups())
        if start < previous_end or end <= start:
            raise ValueError("overlap or reversed interval")
        result.append((start, end, lines[2:]))
        previous_end = end
    return result

sample = "1\n00:00:01,000 --> 00:00:02,000\nHello\nWorld\n\n2\n00:00:02,500 --> 00:00:03,000\nNext"
parsed = parse_srt(sample)
assert parsed[0] == (1000, 2000, ["Hello", "World"])
assert len(parsed) == 2
try:
    parse_srt(sample.replace("00:00:02,500", "00:00:01,500"))
except ValueError:
    pass
else:
    raise AssertionError("overlap accepted by strict example contract")

Time comparison uses integer milliseconds and represents only a relative timeline. It does not treat subtitle times as wall-clock times on a particular day. For related types, see Python Date and Time Types.

Comparing Protected Sections Before and After Translation

During translation, the structural parts should remain unchanged, while the body text requires human proofreading. The table below lists the expectations for each item, as well as what automated checks cannot replace.

ProjectExpectationIrreplaceable Inspection
Sequence Number and Block CountRetain as per project conventionDid it really miss a translation?
Time rangeUnchanged when unauthorizedDialogue and visuals in sync
Body lineReadable and without mixing in the timelineReading Speed and Language Naturalness
Blank-line separatedPreserve block boundariesPlayer actual compatibility

Still to play after the structure passes

The script passes, but this only confirms that the structure conforms to the agreed format; it does not mean the subtitles display well in the player. The code did not measure reading speed, and it has no way of knowing who is speaking on screen.

When delivering the final version, check display, line breaks, and synchronization in the target player, especially for languages whose subtitles run longer. Structural checks can catch some errors in advance, but they cannot replace playback acceptance testing.

Handing the Formatting Constraints Over to the Translation Workflow

When evaluating related document translation with OmniDoc (product entry), first confirm whether the current entry point supports the required subtitle format, and clearly specify that timestamps need to be preserved. This article does not claim, on that basis, that the platform provides any particular subtitle interface.

The reusable idea is an acceptance approach where "the structure stays unchanged and the body text can be reviewed": timeline and blank lines remain as they are, translations are modified only within the body lines, and the result is finally checked with a player.

📊 Core Comparison

Inspection methodWhat can be discovered?What can't it replace?
Structure check (script)Formatting issues, timestamp order, and overlapsReading speed, language naturalness
Playback acceptance (target player)Display, Line Wrapping, and Synchronization IssuesEfficiency of batch-checking for formatting errors

🎯 Which approach suits you?

If you need to check the timestamp order

Use a script to parse the timestamps, then compare the start and end times of adjacent blocks to check whether they are inverted or overlapping.

If your subtitles are going to be delivered for playback

After the structural check passes, you still need to play it segment by segment in the target player to confirm display, line breaks, and synchronization.

If your translation becomes noticeably longer

Check the body text for line breaks and display overflow, and manually review the reading speed.

❓ Frequently Asked Questions (FAQ)

1. Does it only check whether the number of line breaks is sufficient?

Not enough. Checking only the number of line breaks cannot detect a reversed or overlapping timeline.

2. Does this method support all subtitle formats?

No. It only handles the common format of sequence numbers plus time ranges, and does not handle style extensions, positioning information, or other subtitle formats.

3. Once the script check passes, can it be delivered directly?

Not recommended. A structural check cannot measure reading speed and has no awareness of the on-screen speakers, so the result must still be verified in the target player before formal delivery.

4. Why use integer milliseconds for time comparison?

Integer milliseconds represent only positions on a relative timeline; subtitle times are not treated as wall-clock time on any particular day.

📝 Summary

Subtitle translation acceptance must check both structure and playback effect. First, use a script to safeguard timestamps and blank lines; then use a player to check display and synchronization. Delivery is considered complete only when both steps are done.

Try it now: upload a document and translation starts right away, with the original layout preserved.

Updated 2026-11-29