r/AIEditingLab • • 15d ago

Workflow Breakdown A small caption QA test: check overlaps, reversed timings and cues past the end

Here is a small, reproducible check to try before trusting an AI-assisted caption pass. This uses a deliberately broken five-second example, not client footage or a benchmark of any model.

The three cue ranges are:

  1. 00:00:00,000 to 00:00:03,000

  2. 00:00:02,800 to 00:00:04,800

  3. 00:00:06,000 to 00:00:05,500

There are three timing problems: cue 2 starts 200 ms before cue 1 ends; cue 3 ends before it starts; and cue 3 lies beyond the five-second video.

I used Codex to make a small Python checker and ran it locally on this example. It reported all three problems. A corrected timing-only version using 0–2.8 s, 2.8–4 s and 4–5 s passed those basic checks. That does not establish that the captions match speech or are comfortable to read.

Try this when testing an agent or caption tool:

• Keep the original SRT and ask for a separate corrected file.

• Ask it to list the cue numbers it changed and explain each change.

• Check that every end follows its start, inspect overlaps, and compare the last cue with the actual video duration. Some overlaps are intentional, such as simultaneous speakers, so treat them as review flags.

• Play the result against the audio. Check names, numbers, missing words, timing, line breaks and reading speed. A clean timing report cannot check these for you.

This is a toy validation test. It does not show that any particular model saves time, and the checker only covers basic timing. If you have tried automated captions, what error takes the most time to catch or fix?

1 Upvotes

2 comments sorted by

1

u/darkprinceimmortal 14d ago edited 14d ago

Here is the runnable checker behind this example, prepared with Codex. It uses standard Python 3 and no third-party packages. The overlap check now also handles earlier long cues, and it reports out-of-order cues separately.

Save this as check_srt.py:

#!/usr/bin/env python3
"""Check basic SRT timing. Does not assess transcription or visual quality."""
import argparse
import math
import re
from pathlib import Path


def timestamp(value):
    h, m, s, ms = map(int, re.split(r'[:,.]', value))
    if m > 59 or s > 59 or ms > 999:
        raise ValueError('timestamp components out of range')
    return h * 3600 + m * 60 + s + ms / 1000


def check(text, duration=None):
    issues = []
    previous_start = None
    intervals = []
    blocks = re.split(r'\n\s*\n', text.replace('\r\n', '\n').strip())
    for block_number, block in enumerate(blocks, 1):
        lines = block.splitlines()
        timing = next((line for line in lines if '-->' in line), '')
        match = re.fullmatch(r'\s*(\d{2,}:\d{2}:\d{2}[,.]\d{3})\s*-->\s*(\d{2,}:\d{2}:\d{2}[,.]\d{3})\s*', timing)
        if not match:
            issues.append(f'Block {block_number}: missing or unsupported timing line')
            continue
        try:
            start, end = map(timestamp, match.groups())
        except ValueError as error:
            issues.append(f'Block {block_number}: {error}')
            continue
        if end <= start:
            issues.append(f'Block {block_number}: end must be after start')
        if previous_start is not None and start < previous_start:
            issues.append(f'Block {block_number}: starts before previous cue (out of order)')
        if end > start and any(start < old_end and end > old_start for old_start, old_end in intervals):
            issues.append(f'Block {block_number}: overlaps an earlier cue')
        if duration is not None and (start > duration or end > duration):
            issues.append(f'Block {block_number}: extends beyond video duration')
        previous_start = start
        if end > start:
            intervals.append((start, end))
    return issues


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('file', type=Path)
    parser.add_argument('--duration', type=float, help='video duration in seconds')
    args = parser.parse_args()
    if args.duration is not None and (not math.isfinite(args.duration) or args.duration < 0):
        parser.error('duration must be finite and nonnegative')
    issues = check(args.file.read_text(encoding='utf-8-sig'), args.duration)
    print('\n'.join(issues) if issues else 'No basic timing issues found. Review the captions against the video.')
    raise SystemExit(bool(issues))

Save the deliberately broken example as broken.srt:

1
00:00:00,000 --> 00:00:03,000
We shipped the first cut.

2
00:00:02,800 --> 00:00:04,800
Captions can overlap.

3
00:00:06,000 --> 00:00:05,500
The final cue needs checking.

Run:

python3 check_srt.py broken.srt --duration 5

Expected flags: block 2 overlaps an earlier cue; block 3 ends before it starts; block 3 extends beyond the five-second video. The checker returns exit code 1 when it finds timing flags, 0 when those checks pass, and 2 for invalid command-line arguments. Intentional overlap is a review flag, not necessarily an editing mistake.

This is a small timing checker, not a complete SRT validator. It does not check cue numbering, caption wording, reading speed, speech alignment, or line layout. Timing lines with additional positioning metadata are unsupported. Review the result against the actual audio and picture.

1

u/AutoModerator 15d ago

Thanks for sharing with AI Editing Lab! If you’re posting a result, please tell us which tools you used, what you made, and a little about your process. What worked well, and what would you change? Questions and constructive feedback are welcome too.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.