FAILURE MAP
← Case archive

FA-78266 / Subtitle cue timing / Open access

Recommended cue duration on frame grid: character counting · case 01

Multi-word subtitles get recommended durations that are too long.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Spaces and line breaks are counted as reading characters.

VERIFIED REPAIR

Exclude spaces and line breaks from the character count.

Unsuccessful approach: Excluding spaces but not line breaks still inflates two-line cues.

Case contract

rules [base,per_char,min,max]. Count characters other than spaces and line breaks; duration = base + count*per_char, clamped to [min,max]; then rounded up to whole frames at fps [N,D]. Return [frames, ceil(frames*1000*D/N)].

Why this case matters

Subtitle timing defects shift, hide or overlap captions that viewers depend on for comprehension and accessibility.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, fps, rules):
    base,per,lo,hi=rules
    n=len(text)
    d=base+n*per
    d=max(lo,min(hi,d))
    num,den=fps
    fr=-((-d*num)//(1000*den))
    return [fr,-((-fr*1000*den)//num)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: character counting', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: character counting', ['A much longer subtitle line to read', [24, 1], [0, 70, 800, 7000]], [49, 2042]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [500, 60, 1000, 6000]], [37, 1235]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502])], [('regression: character counting', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('regression variant: character counting', ['Hello world', [24000, 1001], [500, 60, 1000, 6000]], [27, 1127]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair variant: character counting', ['Two\nlines here', [24, 1], [700, 100, 1000, 2000]], [46, 1917]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['A much longer subtitle line to read', [30, 1], [700, 100, 1000, 2000]], [60, 2000])], [('regression: character counting', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('regression variant: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair probe: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair variant: character counting', ['Two\nlines here', [25, 1], [700, 100, 1000, 2000]], [48, 1920]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Hello world', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('normal control', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209])], [('regression: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('regression variant: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [500, 60, 1000, 6000]], [30, 1250]), ('partial repair variant: character counting', ['Two\nlines here', [30, 1], [0, 70, 800, 7000]], [26, 867]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [30, 1], [300, 50, 1200, 1500]], [36, 1200]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000])], [('regression: character counting', ['Hello world', [30000, 1001], [500, 60, 1000, 6000]], [33, 1102]), ('regression variant: character counting', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [500, 60, 1000, 6000]], [30, 1252]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [700, 100, 1000, 2000]], [57, 1902]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['ok', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['   ', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['Two\nlines here', [30, 1], [300, 50, 1200, 1500]], [36, 1200])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: character counting[30, 1001][26, 868]Failed
regression variant: character counting[59, 2459][49, 2042]Failed
partial repair probe: character counting[48, 2002][46, 1919]Failed
partial repair variant: character counting[41, 1369][37, 1235]Failed
boundary control[25, 1000][25, 1000]Passed
boundary control[50, 2000][50, 2000]Passed
normal control[25, 1000][25, 1000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[36, 1502][36, 1502]Passed

SHA-256 / 6339139465b8317a54e5ac5b1c27dbcaece5f93da21945565815ce2ee85cfb0b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, fps, rules):
    base,per,lo,hi=rules
    n=len(text.replace(' ',''))
    d=base+n*per
    d=max(lo,min(hi,d))
    num,den=fps
    fr=-((-d*num)//(1000*den))
    return [fr,-((-fr*1000*den)//num)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: character counting', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: character counting', ['A much longer subtitle line to read', [24, 1], [0, 70, 800, 7000]], [49, 2042]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [500, 60, 1000, 6000]], [37, 1235]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502])], [('regression: character counting', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('regression variant: character counting', ['Hello world', [24000, 1001], [500, 60, 1000, 6000]], [27, 1127]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair variant: character counting', ['Two\nlines here', [24, 1], [700, 100, 1000, 2000]], [46, 1917]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['A much longer subtitle line to read', [30, 1], [700, 100, 1000, 2000]], [60, 2000])], [('regression: character counting', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('regression variant: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair probe: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair variant: character counting', ['Two\nlines here', [25, 1], [700, 100, 1000, 2000]], [48, 1920]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Hello world', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('normal control', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209])], [('regression: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('regression variant: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [500, 60, 1000, 6000]], [30, 1250]), ('partial repair variant: character counting', ['Two\nlines here', [30, 1], [0, 70, 800, 7000]], [26, 867]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [30, 1], [300, 50, 1200, 1500]], [36, 1200]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000])], [('regression: character counting', ['Hello world', [30000, 1001], [500, 60, 1000, 6000]], [33, 1102]), ('regression variant: character counting', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [500, 60, 1000, 6000]], [30, 1252]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [700, 100, 1000, 2000]], [57, 1902]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['ok', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['   ', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['Two\nlines here', [30, 1], [300, 50, 1200, 1500]], [36, 1200])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: character counting[28, 935][26, 868]Failed
regression variant: character counting[49, 2042][49, 2042]Passed
partial repair probe: character counting[48, 2002][46, 1919]Failed
partial repair variant: character counting[39, 1302][37, 1235]Failed
boundary control[25, 1000][25, 1000]Passed
boundary control[50, 2000][50, 2000]Passed
normal control[25, 1000][25, 1000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[36, 1502][36, 1502]Passed

SHA-256 / 6efcbb1fc709542717e6bc78698d02b6bacbf449109bcdc224a18aff771be5f6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, fps, rules):
    base,per,lo,hi=rules
    n=len(text.replace(' ','').replace('\n',''))
    d=base+n*per
    d=max(lo,min(hi,d))
    num,den=fps
    fr=-((-d*num)//(1000*den))
    return [fr,-((-fr*1000*den)//num)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: character counting', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: character counting', ['A much longer subtitle line to read', [24, 1], [0, 70, 800, 7000]], [49, 2042]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [500, 60, 1000, 6000]], [37, 1235]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502])], [('regression: character counting', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('regression variant: character counting', ['Hello world', [24000, 1001], [500, 60, 1000, 6000]], [27, 1127]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair variant: character counting', ['Two\nlines here', [24, 1], [700, 100, 1000, 2000]], [46, 1917]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['A much longer subtitle line to read', [30, 1], [700, 100, 1000, 2000]], [60, 2000])], [('regression: character counting', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('regression variant: character counting', ['Two\nlines here', [24, 1], [0, 70, 800, 7000]], [21, 875]), ('partial repair probe: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair variant: character counting', ['Two\nlines here', [25, 1], [700, 100, 1000, 2000]], [48, 1920]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Hello world', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('normal control', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209])], [('regression: character counting', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('regression variant: character counting', ['Two\nlines here', [25, 1], [0, 70, 800, 7000]], [21, 840]), ('partial repair probe: character counting', ['Two\nlines here', [24, 1], [500, 60, 1000, 6000]], [30, 1250]), ('partial repair variant: character counting', ['Two\nlines here', [30, 1], [0, 70, 800, 7000]], [26, 867]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('normal control', ['Hi', [30, 1], [300, 50, 1200, 1500]], [36, 1200]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000])], [('regression: character counting', ['Hello world', [30000, 1001], [500, 60, 1000, 6000]], [33, 1102]), ('regression variant: character counting', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('partial repair probe: character counting', ['Two\nlines here', [24000, 1001], [500, 60, 1000, 6000]], [30, 1252]), ('partial repair variant: character counting', ['Two\nlines here', [30000, 1001], [700, 100, 1000, 2000]], [57, 1902]), ('boundary control', ['Hi', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['ok', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['   ', [30, 1], [0, 70, 800, 7000]], [24, 800]), ('normal control', ['Two\nlines here', [30, 1], [300, 50, 1200, 1500]], [36, 1200])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: character counting[26, 868][26, 868]Passed
regression variant: character counting[49, 2042][49, 2042]Passed
partial repair probe: character counting[46, 1919][46, 1919]Passed
partial repair variant: character counting[37, 1235][37, 1235]Passed
boundary control[25, 1000][25, 1000]Passed
boundary control[50, 2000][50, 2000]Passed
normal control[25, 1000][25, 1000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[36, 1502][36, 1502]Passed

SHA-256 / 172659a44deaac11978a6c74bc146eea1441f6127ee41b83bf3b560a26f81063

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to any subtitle standard. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:33.736816+00:00.

Case digest / d36398774df020cd6294cdf0cb58d123f1376de9a3e73ba7d233c42db680243d