FA-77951 / Subtitle cue timing / Open access
Cue snapping to video frame grid: overlap push test · case 01
Consecutive snapped cues share frames and flicker on screen together.
ROOT CAUSE
The overlap test compares the new end frame with the previous end instead of the new start frame.
THE FAILURE
The overlap test compares the new end frame with the previous end instead of the new start frame.
Unsuccessful approach: Only pushing partial overlaps ignores a cue whose frames lie entirely inside the previous cue.
Case contract
For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*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(cues, fps):
num,den=(fps.split('/')+['1'])[:2]
num,den=int(num),int(den)
out=[]
prev_end=None
for start,end in cues:
a=(start*num)//(1000*den)
b=-((-end*num)//(1000*den))
if b<=a:
b=a+1
if prev_end is not None and b<prev_end:
a=prev_end
b=max(b,a+1)
prev_end=b
out.append([a,b]+[(x*1000*den)//num for x in (a,b)])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overlap push test', [[[10, 20], [15, 30]], '24'], [[0, 1, 0, 41], [1, 2, 41, 83]]), ('regression variant: overlap push test', [[[1168, 1173], [1155, 1189]], '24000/1001'], [[28, 29, 1167, 1209], [29, 30, 1209, 1251]]), ('partial repair probe: overlap push test', [[[5038, 5072], [5088, 5089], [2570, 2575]], '30000/1001'], [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]]), ('partial repair variant: overlap push test', [[[3000, 3020], [1966, 1986], [2476, 2517]], '30'], [[90, 91, 3000, 3033], [91, 92, 3033, 3066], [92, 93, 3066, 3100]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('normal control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[3001, 3042]], '24000/1001'], [[71, 73, 2961, 3044]]), ('normal control', [[[1501, 1542], [2503, 3503], [5714, 5734]], '24000/1001'], [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]])], [('regression: overlap push test', [[[33, 74], [1335, 1369], [1378, 1379]], '60000/1001'], [[1, 5, 16, 83], [80, 83, 1334, 1384], [83, 84, 1384, 1401]]), ('regression variant: overlap push test', [[[2500, 3940], [2660, 2680], [3360, 4360], [740, 4220]], '50'], [[125, 197, 2500, 3940], [197, 198, 3940, 3960], [198, 218, 3960, 4360], [218, 219, 4360, 4380]]), ('partial repair probe: overlap push test', [[[3000, 3041], [2820, 2860], [3520, 3554], [3530, 3564]], '50'], [[150, 153, 3000, 3060], [153, 154, 3060, 3080], [176, 178, 3520, 3560], [178, 179, 3560, 3580]]), ('partial repair variant: overlap push test', [[[540, 581], [384, 389]], '60000/1001'], [[32, 35, 533, 583], [35, 36, 583, 600]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[440, 474], [950, 951]], '25'], [[11, 12, 440, 480], [23, 24, 920, 960]]), ('normal control', [[[1168, 1169], [2368, 2373], [3068, 3073], [7340, 7360]], '24000/1001'], [[28, 29, 1167, 1209], [56, 57, 2335, 2377], [73, 74, 3044, 3086], [175, 177, 7298, 7382]]), ('normal control', [[[1000, 1005]], '50'], [[50, 51, 1000, 1020]])], [('regression: overlap push test', [[[5038, 5072], [5088, 5089], [2570, 2575]], '30000/1001'], [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]]), ('regression variant: overlap push test', [[[3500, 3540], [3471, 3472], [3481, 4004], [4181, 4215]], '24000/1001'], [[83, 85, 3461, 3545], [85, 86, 3545, 3586], [86, 96, 3586, 4004], [100, 102, 4170, 4254]]), ('partial repair probe: overlap push test', [[[4666, 4667], [5866, 5900], [5899, 5919], [2400, 3401]], '30'], [[139, 141, 4633, 4700], [175, 177, 5833, 5900], [177, 178, 5900, 5933], [178, 179, 5933, 5966]]), ('partial repair variant: overlap push test', [[[1041, 1082], [1098, 1099], [1101, 1106]], '24'], [[24, 26, 1000, 1083], [26, 27, 1083, 1125], [27, 28, 1125, 1166]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('normal control', [[[1002, 1036], [2535, 2576]], '30000/1001'], [[30, 32, 1001, 1067], [75, 78, 2502, 2602]]), ('normal control', [[[1018, 1058], [5972, 5992], [6013, 7014]], '30000/1001'], [[30, 32, 1001, 1067], [178, 180, 5939, 6006], [180, 211, 6006, 7040]]), ('normal control', [[[3001, 3041]], '30'], [[90, 92, 3000, 3066]])], [('regression: overlap push test', [[[3000, 3041], [2820, 2860], [3520, 3554], [3530, 3564]], '50'], [[150, 153, 3000, 3060], [153, 154, 3060, 3080], [176, 178, 3520, 3560], [178, 179, 3560, 3580]]), ('regression variant: overlap push test', [[[1041, 1082], [1098, 1099], [1101, 1106]], '24'], [[24, 26, 1000, 1083], [26, 27, 1083, 1125], [27, 28, 1125, 1166]]), ('partial repair probe: overlap push test', [[[1168, 1173], [1155, 1189]], '24000/1001'], [[28, 29, 1167, 1209], [29, 30, 1209, 1251]]), ('partial repair variant: overlap push test', [[[41, 61], [114, 119], [7500, 7520], [4541, 5542]], '24'], [[0, 2, 0, 83], [2, 3, 83, 125], [180, 181, 7500, 7541], [181, 182, 7541, 7583]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('normal control', [[[1018, 1023]], '60000/1001'], [[61, 62, 1017, 1034]]), ('normal control', [[[40, 6440]], '25'], [[1, 161, 40, 6440]]), ('normal control', [[[1018, 1058]], '24000/1001'], [[24, 26, 1001, 1084]])], [('regression: overlap push test', [[[4666, 4667], [5866, 5900], [5899, 5919], [2400, 3401]], '30'], [[139, 141, 4633, 4700], [175, 177, 5833, 5900], [177, 178, 5900, 5933], [178, 179, 5933, 5966]]), ('regression variant: overlap push test', [[[500, 505], [471, 476], [504, 544]], '60000/1001'], [[29, 31, 483, 517], [31, 32, 517, 533], [32, 33, 533, 550]]), ('partial repair probe: overlap push test', [[[2500, 3940], [2660, 2680], [3360, 4360], [740, 4220]], '50'], [[125, 197, 2500, 3940], [197, 198, 3940, 3960], [198, 218, 3960, 4360], [218, 219, 4360, 4380]]), ('partial repair variant: overlap push test', [[[41, 61], [114, 119], [7500, 7520], [4541, 5542]], '24'], [[0, 2, 0, 83], [2, 3, 83, 125], [180, 181, 7500, 7541], [181, 182, 7541, 7583]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[500, 501]], '30000/1001'], [[14, 16, 467, 533]]), ('normal control', [[[1002, 1022]], '30000/1001'], [[30, 31, 1001, 1034]]), ('normal control', [[[40, 1041]], '24000/1001'], [[0, 25, 0, 1042]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: overlap push test | [[0, 1, 0, 41], [0, 1, 0, 41]] | [[0, 1, 0, 41], [1, 2, 41, 83]] | Failed |
| regression variant: overlap push test | [[28, 29, 1167, 1209], [27, 29, 1126, 1209]] | [[28, 29, 1167, 1209], [29, 30, 1209, 1251]] | Failed |
| partial repair probe: overlap push test | [[150, 153, 5005, 5105], [152, 153, 5071, 5105], [153, 154, 5105, 5138]] | [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]] | Failed |
| partial repair variant: overlap push test | [[90, 91, 3000, 3033], [91, 92, 3033, 3066], [92, 93, 3066, 3100]] | [[90, 91, 3000, 3033], [91, 92, 3033, 3066], [92, 93, 3066, 3100]] | Passed |
| boundary control | [[0, 1, 0, 40], [1, 2, 40, 80]] | [[0, 1, 0, 40], [1, 2, 40, 80]] | Passed |
| boundary control | [[29, 30, 967, 1001]] | [[29, 30, 967, 1001]] | Passed |
| normal control | [[24, 48, 1001, 2002]] | [[24, 48, 1001, 2002]] | Passed |
| normal control | [[71, 73, 2961, 3044]] | [[71, 73, 2961, 3044]] | Passed |
| normal control | [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]] | [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]] | Passed |
SHA-256 / a8b137486cef0d3aff3c0b18976181554e879ae5110e933564aa7f5cb7f7c3f4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cues, fps):
num,den=(fps.split('/')+['1'])[:2]
num,den=int(num),int(den)
out=[]
prev_end=None
for start,end in cues:
a=(start*num)//(1000*den)
b=-((-end*num)//(1000*den))
if b<=a:
b=a+1
if prev_end is not None and a<prev_end and b>prev_end:
a=prev_end
b=max(b,a+1)
prev_end=b
out.append([a,b]+[(x*1000*den)//num for x in (a,b)])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overlap push test', [[[10, 20], [15, 30]], '24'], [[0, 1, 0, 41], [1, 2, 41, 83]]), ('regression variant: overlap push test', [[[1168, 1173], [1155, 1189]], '24000/1001'], [[28, 29, 1167, 1209], [29, 30, 1209, 1251]]), ('partial repair probe: overlap push test', [[[5038, 5072], [5088, 5089], [2570, 2575]], '30000/1001'], [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]]), ('partial repair variant: overlap push test', [[[3000, 3020], [1966, 1986], [2476, 2517]], '30'], [[90, 91, 3000, 3033], [91, 92, 3033, 3066], [92, 93, 3066, 3100]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('normal control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[3001, 3042]], '24000/1001'], [[71, 73, 2961, 3044]]), ('normal control', [[[1501, 1542], [2503, 3503], [5714, 5734]], '24000/1001'], [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]])], [('regression: overlap push test', [[[33, 74], [1335, 1369], [1378, 1379]], '60000/1001'], [[1, 5, 16, 83], [80, 83, 1334, 1384], [83, 84, 1384, 1401]]), ('regression variant: overlap push test', [[[2500, 3940], [2660, 2680], [3360, 4360], [740, 4220]], '50'], [[125, 197, 2500, 3940], [197, 198, 3940, 3960], [198, 218, 3960, 4360], [218, 219, 4360, 4380]]), ('partial repair probe: overlap push test', [[[3000, 3041], [2820, 2860], [3520, 3554], [3530, 3564]], '50'], [[150, 153, 3000, 3060], [153, 154, 3060, 3080], [176, 178, 3520, 3560], [178, 179, 3560, 3580]]), ('partial repair variant: overlap push test', [[[540, 581], [384, 389]], '60000/1001'], [[32, 35, 533, 583], [35, 36, 583, 600]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[440, 474], [950, 951]], '25'], [[11, 12, 440, 480], [23, 24, 920, 960]]), ('normal control', [[[1168, 1169], [2368, 2373], [3068, 3073], [7340, 7360]], '24000/1001'], [[28, 29, 1167, 1209], [56, 57, 2335, 2377], [73, 74, 3044, 3086], [175, 177, 7298, 7382]]), ('normal control', [[[1000, 1005]], '50'], [[50, 51, 1000, 1020]])], [('regression: overlap push test', [[[5038, 5072], [5088, 5089], [2570, 2575]], '30000/1001'], [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]]), ('regression variant: overlap push test', [[[3500, 3540], [3471, 3472], [3481, 4004], [4181, 4215]], '24000/1001'], [[83, 85, 3461, 3545], [85, 86, 3545, 3586], [86, 96, 3586, 4004], [100, 102, 4170, 4254]]), ('partial repair probe: overlap push test', [[[4666, 4667], [5866, 5900], [5899, 5919], [2400, 3401]], '30'], [[139, 141, 4633, 4700], [175, 177, 5833, 5900], [177, 178, 5900, 5933], [178, 179, 5933, 5966]]), ('partial repair variant: overlap push test', [[[1041, 1082], [1098, 1099], [1101, 1106]], '24'], [[24, 26, 1000, 1083], [26, 27, 1083, 1125], [27, 28, 1125, 1166]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('normal control', [[[1002, 1036], [2535, 2576]], '30000/1001'], [[30, 32, 1001, 1067], [75, 78, 2502, 2602]]), ('normal control', [[[1018, 1058], [5972, 5992], [6013, 7014]], '30000/1001'], [[30, 32, 1001, 1067], [178, 180, 5939, 6006], [180, 211, 6006, 7040]]), ('normal control', [[[3001, 3041]], '30'], [[90, 92, 3000, 3066]])], [('regression: overlap push test', [[[3000, 3041], [2820, 2860], [3520, 3554], [3530, 3564]], '50'], [[150, 153, 3000, 3060], [153, 154, 3060, 3080], [176, 178, 3520, 3560], [178, 179, 3560, 3580]]), ('regression variant: overlap push test', [[[1041, 1082], [1098, 1099], [1101, 1106]], '24'], [[24, 26, 1000, 1083], [26, 27, 1083, 1125], [27, 28, 1125, 1166]]), ('partial repair probe: overlap push test', [[[1168, 1173], [1155, 1189]], '24000/1001'], [[28, 29, 1167, 1209], [29, 30, 1209, 1251]]), ('partial repair variant: overlap push test', [[[41, 61], [114, 119], [7500, 7520], [4541, 5542]], '24'], [[0, 2, 0, 83], [2, 3, 83, 125], [180, 181, 7500, 7541], [181, 182, 7541, 7583]]), ('boundary control', [[[0, 40], [40, 80]], '25'], [[0, 1, 0, 40], [1, 2, 40, 80]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('normal control', [[[1018, 1023]], '60000/1001'], [[61, 62, 1017, 1034]]), ('normal control', [[[40, 6440]], '25'], [[1, 161, 40, 6440]]), ('normal control', [[[1018, 1058]], '24000/1001'], [[24, 26, 1001, 1084]])], [('regression: overlap push test', [[[4666, 4667], [5866, 5900], [5899, 5919], [2400, 3401]], '30'], [[139, 141, 4633, 4700], [175, 177, 5833, 5900], [177, 178, 5900, 5933], [178, 179, 5933, 5966]]), ('regression variant: overlap push test', [[[500, 505], [471, 476], [504, 544]], '60000/1001'], [[29, 31, 483, 517], [31, 32, 517, 533], [32, 33, 533, 550]]), ('partial repair probe: overlap push test', [[[2500, 3940], [2660, 2680], [3360, 4360], [740, 4220]], '50'], [[125, 197, 2500, 3940], [197, 198, 3940, 3960], [198, 218, 3960, 4360], [218, 219, 4360, 4380]]), ('partial repair variant: overlap push test', [[[41, 61], [114, 119], [7500, 7520], [4541, 5542]], '24'], [[0, 2, 0, 83], [2, 3, 83, 125], [180, 181, 7500, 7541], [181, 182, 7541, 7583]]), ('boundary control', [[[1000, 1001]], '30000/1001'], [[29, 30, 967, 1001]]), ('boundary control', [[[1001, 2002]], '24000/1001'], [[24, 48, 1001, 2002]]), ('normal control', [[[500, 501]], '30000/1001'], [[14, 16, 467, 533]]), ('normal control', [[[1002, 1022]], '30000/1001'], [[30, 31, 1001, 1034]]), ('normal control', [[[40, 1041]], '24000/1001'], [[0, 25, 0, 1042]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: overlap push test | [[0, 1, 0, 41], [0, 1, 0, 41]] | [[0, 1, 0, 41], [1, 2, 41, 83]] | Failed |
| regression variant: overlap push test | [[28, 29, 1167, 1209], [27, 29, 1126, 1209]] | [[28, 29, 1167, 1209], [29, 30, 1209, 1251]] | Failed |
| partial repair probe: overlap push test | [[150, 153, 5005, 5105], [152, 153, 5071, 5105], [77, 78, 2569, 2602]] | [[150, 153, 5005, 5105], [153, 154, 5105, 5138], [154, 155, 5138, 5171]] | Failed |
| partial repair variant: overlap push test | [[90, 91, 3000, 3033], [58, 60, 1933, 2000], [74, 76, 2466, 2533]] | [[90, 91, 3000, 3033], [91, 92, 3033, 3066], [92, 93, 3066, 3100]] | Failed |
| boundary control | [[0, 1, 0, 40], [1, 2, 40, 80]] | [[0, 1, 0, 40], [1, 2, 40, 80]] | Passed |
| boundary control | [[29, 30, 967, 1001]] | [[29, 30, 967, 1001]] | Passed |
| normal control | [[24, 48, 1001, 2002]] | [[24, 48, 1001, 2002]] | Passed |
| normal control | [[71, 73, 2961, 3044]] | [[71, 73, 2961, 3044]] | Passed |
| normal control | [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]] | [[35, 37, 1459, 1543], [60, 84, 2502, 3503], [136, 138, 5672, 5755]] | Passed |
SHA-256 / d1ccd9e56ff6fb7ded4ebf239ddc2abc1ba7c9b020b4ed65309d6021b2183758
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:30.713177+00:00.
Case digest / af504148d2965286edbd3bbde96842a0a488a2236febc793672ba0f8d0a743bb