FAILURE MAP
← Case archive

FA-78276 / Subtitle cue timing / Open access

Recommended cue duration on frame grid: frame ceiling · case 01

Recommended durations fall short of the computed minimum by part of a frame.

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

ROOT CAUSE

The duration is floored to whole frames.

VERIFIED REPAIR

Round up to whole frames.

Unsuccessful approach: Adding one half and rounding uses half-to-even, so exact odd frame counts gain an extra frame.

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.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: frame ceiling', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: frame ceiling', ['Two\nlines here', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('partial repair variant: frame ceiling', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['Hello world', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000])], [('regression: frame ceiling', ['ok', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair probe: frame ceiling', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('partial repair variant: frame ceiling', ['A much longer subtitle line to read', [30, 1], [300, 50, 1200, 1500]], [45, 1500]), ('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', ['   ', [24, 1], [700, 100, 1000, 2000]], [24, 1000]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502]), ('regression variant: frame ceiling', ['Hello world', [30000, 1001], [0, 70, 800, 7000]], [24, 801]), ('partial repair probe: frame ceiling', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['ok', [25, 1], [700, 100, 1000, 2000]], [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', ['A much longer subtitle line to read', [24, 1], [700, 100, 1000, 2000]], [48, 2000]), ('normal control', ['', [24, 1], [700, 100, 1000, 2000]], [24, 1000])], [('regression: frame ceiling', ['Hi', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hi', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('partial repair variant: frame ceiling', ['', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['Hi', [25, 1], [0, 70, 800, 7000]], [20, 800]), ('normal control', ['', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['   ', [24000, 1001], [0, 70, 800, 7000]], [20, 835]), ('regression variant: frame ceiling', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209]), ('partial repair probe: frame ceiling', ['ok', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['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', ['A much longer subtitle line to read', [24, 1], [300, 50, 1200, 1500]], [36, 1500]), ('normal control', ['', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['', [30, 1], [500, 60, 1000, 6000]], [30, 1000])]]
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: frame ceiling[25, 835][26, 868]Failed
regression variant: frame ceiling[35, 1168][36, 1202]Failed
partial repair probe: frame ceiling[51, 1700][51, 1700]Passed
partial repair variant: frame ceiling[33, 1100][33, 1100]Passed
boundary control[50, 2000][50, 2000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1000][30, 1000]Passed

SHA-256 / eb0b299c948c4857b95a72a056c31331b4b91fc11ef45faee9a5a0c23cb758e3

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(' ','').replace('\n',''))
    d=base+n*per
    d=max(lo,min(hi,d))
    num,den=fps
    fr=round(d*num/(1000*den)+0.5)
    return [fr,-((-fr*1000*den)//num)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame ceiling', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: frame ceiling', ['Two\nlines here', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('partial repair variant: frame ceiling', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['Hello world', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000])], [('regression: frame ceiling', ['ok', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair probe: frame ceiling', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('partial repair variant: frame ceiling', ['A much longer subtitle line to read', [30, 1], [300, 50, 1200, 1500]], [45, 1500]), ('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', ['   ', [24, 1], [700, 100, 1000, 2000]], [24, 1000]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502]), ('regression variant: frame ceiling', ['Hello world', [30000, 1001], [0, 70, 800, 7000]], [24, 801]), ('partial repair probe: frame ceiling', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['ok', [25, 1], [700, 100, 1000, 2000]], [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', ['A much longer subtitle line to read', [24, 1], [700, 100, 1000, 2000]], [48, 2000]), ('normal control', ['', [24, 1], [700, 100, 1000, 2000]], [24, 1000])], [('regression: frame ceiling', ['Hi', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hi', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('partial repair variant: frame ceiling', ['', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['Hi', [25, 1], [0, 70, 800, 7000]], [20, 800]), ('normal control', ['', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['   ', [24000, 1001], [0, 70, 800, 7000]], [20, 835]), ('regression variant: frame ceiling', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209]), ('partial repair probe: frame ceiling', ['ok', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['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', ['A much longer subtitle line to read', [24, 1], [300, 50, 1200, 1500]], [36, 1500]), ('normal control', ['', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['', [30, 1], [500, 60, 1000, 6000]], [30, 1000])]]
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: frame ceiling[26, 868][26, 868]Passed
regression variant: frame ceiling[36, 1202][36, 1202]Passed
partial repair probe: frame ceiling[52, 1734][51, 1700]Failed
partial repair variant: frame ceiling[34, 1134][33, 1100]Failed
boundary control[50, 2000][50, 2000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1000][30, 1000]Passed

SHA-256 / dee4a727342e2698e95981d23e21359353f41b306c7f1d36987a44f10aef8df4

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: frame ceiling', ['Two\nlines here', [30000, 1001], [0, 70, 800, 7000]], [26, 868]), ('regression variant: frame ceiling', ['Two\nlines here', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hello world', [30, 1], [700, 100, 1000, 2000]], [51, 1700]), ('partial repair variant: frame ceiling', ['Hello world', [30, 1], [500, 60, 1000, 6000]], [33, 1100]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['Two\nlines here', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['Hello world', [25, 1], [300, 50, 1200, 1500]], [30, 1200]), ('normal control', ['ok', [30, 1], [700, 100, 1000, 2000]], [30, 1000])], [('regression: frame ceiling', ['ok', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['Two\nlines here', [24000, 1001], [700, 100, 1000, 2000]], [46, 1919]), ('partial repair probe: frame ceiling', ['Two\nlines here', [30, 1], [700, 100, 1000, 2000]], [57, 1900]), ('partial repair variant: frame ceiling', ['A much longer subtitle line to read', [30, 1], [300, 50, 1200, 1500]], [45, 1500]), ('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', ['   ', [24, 1], [700, 100, 1000, 2000]], [24, 1000]), ('normal control', ['ok', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['A much longer subtitle line to read', [24000, 1001], [300, 50, 1200, 1500]], [36, 1502]), ('regression variant: frame ceiling', ['Hello world', [30000, 1001], [0, 70, 800, 7000]], [24, 801]), ('partial repair probe: frame ceiling', ['   ', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['ok', [25, 1], [700, 100, 1000, 2000]], [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', ['A much longer subtitle line to read', [24, 1], [700, 100, 1000, 2000]], [48, 2000]), ('normal control', ['', [24, 1], [700, 100, 1000, 2000]], [24, 1000])], [('regression: frame ceiling', ['Hi', [24, 1], [0, 70, 800, 7000]], [20, 834]), ('regression variant: frame ceiling', ['ok', [30000, 1001], [300, 50, 1200, 1500]], [36, 1202]), ('partial repair probe: frame ceiling', ['Hi', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('partial repair variant: frame ceiling', ['', [25, 1], [700, 100, 1000, 2000]], [25, 1000]), ('boundary control', ['A much longer subtitle line to read', [25, 1], [500, 60, 1000, 2000]], [50, 2000]), ('normal control', ['   ', [24, 1], [500, 60, 1000, 6000]], [24, 1000]), ('normal control', ['Hi', [25, 1], [0, 70, 800, 7000]], [20, 800]), ('normal control', ['', [24, 1], [500, 60, 1000, 6000]], [24, 1000])], [('regression: frame ceiling', ['   ', [24000, 1001], [0, 70, 800, 7000]], [20, 835]), ('regression variant: frame ceiling', ['', [24, 1], [300, 50, 1200, 1500]], [29, 1209]), ('partial repair probe: frame ceiling', ['ok', [25, 1], [500, 60, 1000, 6000]], [25, 1000]), ('partial repair variant: frame ceiling', ['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', ['A much longer subtitle line to read', [24, 1], [300, 50, 1200, 1500]], [36, 1500]), ('normal control', ['', [30, 1], [700, 100, 1000, 2000]], [30, 1000]), ('normal control', ['', [30, 1], [500, 60, 1000, 6000]], [30, 1000])]]
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: frame ceiling[26, 868][26, 868]Passed
regression variant: frame ceiling[36, 1202][36, 1202]Passed
partial repair probe: frame ceiling[51, 1700][51, 1700]Passed
partial repair variant: frame ceiling[33, 1100][33, 1100]Passed
boundary control[50, 2000][50, 2000]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1200][30, 1200]Passed
normal control[30, 1000][30, 1000]Passed

SHA-256 / 0d81b67c8c187e804f5691928864539b4d448e22a5c1b3fcf965bc759513d606

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.982477+00:00.

Case digest / 3d1a5d80a7dae0c84853feb50a8e1a74d514641391edec66c47515dbd2655058