FA-78066 / Subtitle cue timing / Open access
Two-point subtitle synchronisation: slope orientation · case 01
Subtitles drift in the wrong direction the further they are from the first anchor.
ROOT CAUSE
The slope is computed as subtitle span over video span, the reciprocal of the mapping.
VERIFIED REPAIR
Use (b2-b1)/(a2-a1) as the slope.
Unsuccessful approach: A slope through the origin from the second anchor ignores the first anchor and mis-scales offset files.
Case contract
anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.
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
import math
from fractions import Fraction
N = 1
observations = []
def solve(cues, anchors):
(a1,b1),(a2,b2)=anchors
k=Fraction(a2-a1,b2-b1)
def m(t):
return math.floor(b1+(t-a1)*k+Fraction(1,2))
out=[]
for s,e in cues:
ns,ne=max(0,m(s)),max(0,m(e))
if ne>ns:
out.append([ns,ne])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: slope orientation', [[[1000, 2000]], [[0, 0], [1000, 2000]]], [[2000, 4000]]), ('regression variant: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair probe: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('partial repair variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[1920, 2920]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 1]], [[5000, 6000], [5003, 6503]]], []), ('normal control', [[[0, 500], [1, 1001]], [[1000, 0], [11000, 12000]]], [[0, 1]])], [('regression: slope orientation', [[[1, 3]], [[0, 0], [2, 1]]], [[1, 2]]), ('regression variant: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair probe: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('partial repair variant: slope orientation', [[[7782, 10282], [7777, 7780], [250, 252], [1500, 2000]], [[1000, 2000], [3000, 2500]]], [[3696, 4321], [3694, 3695], [2125, 2250]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 8777], [7777, 7779]], [[0, 500], [1000, -1000]]], []), ('normal control', [[[1, 4]], [[1003, 1003], [1000, 2000]]], []), ('normal control', [[[7777, 7779], [250, 1250], [3735, 3737]], [[10000, 10000], [11000, 11000]]], [[7777, 7779], [250, 1250], [3735, 3737]])], [('regression: slope orientation', [[[999, 1002], [999, 1999], [7777, 8277]], [[1000, 1500], [2000, 2000]]], [[1500, 1501], [1500, 2000], [4889, 5139]]), ('regression variant: slope orientation', [[[1, 1001]], [[0, -1000], [10000, 9500]]], [[0, 51]]), ('partial repair probe: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair variant: slope orientation', [[[1, 1001], [1500, 1503]], [[1000, 500], [0, 0]]], [[1, 501], [750, 752]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[250, 750]], [[5000, 5000], [15000, 15000]]], [[250, 750]]), ('normal control', [[[0, 500], [1500, 1502]], [[1000, 1500], [2000, 0]]], []), ('normal control', [[[1500, 1502], [250, 252]], [[5000, 5000], [5003, 5003]]], [[1500, 1502], [250, 252]])], [('regression: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('regression variant: slope orientation', [[[3231, 3731], [1, 1001], [1500, 1501]], [[3, 1003], [0, -3000]]], [[4308231, 4975398], [0, 1332668], [1998500, 1999834]]), ('partial repair probe: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair variant: slope orientation', [[[7777, 7780], [6684, 6687], [0, 500], [999, 3499]], [[0, -1000], [3, 1503]]], [[6487610, 6490113], [5575684, 5578187], [0, 416167], [832499, 2918332]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 7778], [0, 2500]], [[1000, 1000], [2000, 0]]], []), ('normal control', [[[999, 1000], [1, 501], [1, 501]], [[1000, 0], [11000, 12000]]], []), ('normal control', [[[1500, 1502]], [[0, 0], [1000, 1000]]], [[1500, 1502]])], [('regression: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('regression variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('partial repair probe: slope orientation', [[[1, 2], [1, 2], [1500, 1501], [250, 253]], [[11000, 12000], [10000, 11000]]], [[1001, 1002], [1001, 1002], [2500, 2501], [1250, 1253]]), ('partial repair variant: slope orientation', [[[0, 2500], [250, 750], [0, 3]], [[10000, 10500], [20000, 20500]]], [[500, 3000], [750, 1250], [500, 503]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[999, 1499], [999, 1002], [5305, 5306], [1, 501]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 3]], [[10000, 9000], [20000, 19500]]], []), ('normal control', [[[999, 1002]], [[1000, 1000], [11000, 11000]]], [[999, 1002]])]]
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: slope orientation | [[500, 1000]] | [[2000, 4000]] | Failed |
| regression variant: slope orientation | [[8468, 8913], [2909, 2910]] | [[9124, 9687], [2088, 2090]] | Failed |
| partial repair probe: slope orientation | [[833, 2500], [667, 669]] | [[0, 625]] | Failed |
| partial repair variant: slope orientation | [[1504, 1506], [1503, 1504]] | [[2248500, 6001000], [0, 1498000]] | Failed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [[0, 1]] | [[0, 1]] | Passed |
SHA-256 / 7f86d322a58554c74e147d5e0781db541db1890ef8757075410bc997d8fcba26
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(cues, anchors):
(a1,b1),(a2,b2)=anchors
k=Fraction(b2,a2) if a2 else Fraction(1)
def m(t):
return math.floor(b1+(t-a1)*k+Fraction(1,2))
out=[]
for s,e in cues:
ns,ne=max(0,m(s)),max(0,m(e))
if ne>ns:
out.append([ns,ne])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: slope orientation', [[[1000, 2000]], [[0, 0], [1000, 2000]]], [[2000, 4000]]), ('regression variant: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair probe: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('partial repair variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[1920, 2920]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 1]], [[5000, 6000], [5003, 6503]]], []), ('normal control', [[[0, 500], [1, 1001]], [[1000, 0], [11000, 12000]]], [[0, 1]])], [('regression: slope orientation', [[[1, 3]], [[0, 0], [2, 1]]], [[1, 2]]), ('regression variant: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair probe: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('partial repair variant: slope orientation', [[[7782, 10282], [7777, 7780], [250, 252], [1500, 2000]], [[1000, 2000], [3000, 2500]]], [[3696, 4321], [3694, 3695], [2125, 2250]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 8777], [7777, 7779]], [[0, 500], [1000, -1000]]], []), ('normal control', [[[1, 4]], [[1003, 1003], [1000, 2000]]], []), ('normal control', [[[7777, 7779], [250, 1250], [3735, 3737]], [[10000, 10000], [11000, 11000]]], [[7777, 7779], [250, 1250], [3735, 3737]])], [('regression: slope orientation', [[[999, 1002], [999, 1999], [7777, 8277]], [[1000, 1500], [2000, 2000]]], [[1500, 1501], [1500, 2000], [4889, 5139]]), ('regression variant: slope orientation', [[[1, 1001]], [[0, -1000], [10000, 9500]]], [[0, 51]]), ('partial repair probe: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair variant: slope orientation', [[[1, 1001], [1500, 1503]], [[1000, 500], [0, 0]]], [[1, 501], [750, 752]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[250, 750]], [[5000, 5000], [15000, 15000]]], [[250, 750]]), ('normal control', [[[0, 500], [1500, 1502]], [[1000, 1500], [2000, 0]]], []), ('normal control', [[[1500, 1502], [250, 252]], [[5000, 5000], [5003, 5003]]], [[1500, 1502], [250, 252]])], [('regression: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('regression variant: slope orientation', [[[3231, 3731], [1, 1001], [1500, 1501]], [[3, 1003], [0, -3000]]], [[4308231, 4975398], [0, 1332668], [1998500, 1999834]]), ('partial repair probe: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair variant: slope orientation', [[[7777, 7780], [6684, 6687], [0, 500], [999, 3499]], [[0, -1000], [3, 1503]]], [[6487610, 6490113], [5575684, 5578187], [0, 416167], [832499, 2918332]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 7778], [0, 2500]], [[1000, 1000], [2000, 0]]], []), ('normal control', [[[999, 1000], [1, 501], [1, 501]], [[1000, 0], [11000, 12000]]], []), ('normal control', [[[1500, 1502]], [[0, 0], [1000, 1000]]], [[1500, 1502]])], [('regression: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('regression variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('partial repair probe: slope orientation', [[[1, 2], [1, 2], [1500, 1501], [250, 253]], [[11000, 12000], [10000, 11000]]], [[1001, 1002], [1001, 1002], [2500, 2501], [1250, 1253]]), ('partial repair variant: slope orientation', [[[0, 2500], [250, 750], [0, 3]], [[10000, 10500], [20000, 20500]]], [[500, 3000], [750, 1250], [500, 503]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[999, 1499], [999, 1002], [5305, 5306], [1, 501]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 3]], [[10000, 9000], [20000, 19500]]], []), ('normal control', [[[999, 1002]], [[1000, 1000], [11000, 11000]]], [[999, 1002]])]]
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: slope orientation | [[2000, 4000]] | [[2000, 4000]] | Passed |
| regression variant: slope orientation | [[9240, 9823], [1944, 1945]] | [[9124, 9687], [2088, 2090]] | Failed |
| partial repair probe: slope orientation | [[0, 1938]] | [[0, 625]] | Failed |
| partial repair variant: slope orientation | [[3000, 5500], [1500, 2500]] | [[2248500, 6001000], [0, 1498000]] | Failed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [[0, 1]] | [[0, 1]] | Passed |
SHA-256 / 34481161d769b02dd45737d2cdeb0596b01b6d260d5593a5023d2b42391490d4
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(cues, anchors):
(a1,b1),(a2,b2)=anchors
k=Fraction(b2-b1,a2-a1)
def m(t):
return math.floor(b1+(t-a1)*k+Fraction(1,2))
out=[]
for s,e in cues:
ns,ne=max(0,m(s)),max(0,m(e))
if ne>ns:
out.append([ns,ne])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: slope orientation', [[[1000, 2000]], [[0, 0], [1000, 2000]]], [[2000, 4000]]), ('regression variant: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair probe: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('partial repair variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[1920, 2920]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 1]], [[5000, 6000], [5003, 6503]]], []), ('normal control', [[[0, 500], [1, 1001]], [[1000, 0], [11000, 12000]]], [[0, 1]])], [('regression: slope orientation', [[[1, 3]], [[0, 0], [2, 1]]], [[1, 2]]), ('regression variant: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair probe: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('partial repair variant: slope orientation', [[[7782, 10282], [7777, 7780], [250, 252], [1500, 2000]], [[1000, 2000], [3000, 2500]]], [[3696, 4321], [3694, 3695], [2125, 2250]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 8777], [7777, 7779]], [[0, 500], [1000, -1000]]], []), ('normal control', [[[1, 4]], [[1003, 1003], [1000, 2000]]], []), ('normal control', [[[7777, 7779], [250, 1250], [3735, 3737]], [[10000, 10000], [11000, 11000]]], [[7777, 7779], [250, 1250], [3735, 3737]])], [('regression: slope orientation', [[[999, 1002], [999, 1999], [7777, 8277]], [[1000, 1500], [2000, 2000]]], [[1500, 1501], [1500, 2000], [4889, 5139]]), ('regression variant: slope orientation', [[[1, 1001]], [[0, -1000], [10000, 9500]]], [[0, 51]]), ('partial repair probe: slope orientation', [[[7777, 8277], [1523, 1524]], [[5000, 6000], [9000, 10500]]], [[9124, 9687], [2088, 2090]]), ('partial repair variant: slope orientation', [[[1, 1001], [1500, 1503]], [[1000, 500], [0, 0]]], [[1, 501], [750, 752]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[250, 750]], [[5000, 5000], [15000, 15000]]], [[250, 750]]), ('normal control', [[[0, 500], [1500, 1502]], [[1000, 1500], [2000, 0]]], []), ('normal control', [[[1500, 1502], [250, 252]], [[5000, 5000], [5003, 5003]]], [[1500, 1502], [250, 252]])], [('regression: slope orientation', [[[250, 2750], [0, 3]], [[5000, 4000], [6000, 5500]]], [[0, 625]]), ('regression variant: slope orientation', [[[3231, 3731], [1, 1001], [1500, 1501]], [[3, 1003], [0, -3000]]], [[4308231, 4975398], [0, 1332668], [1998500, 1999834]]), ('partial repair probe: slope orientation', [[[999, 1999], [1, 2501], [7777, 8277], [250, 253]], [[0, -1000], [3, 503]]], [[499499, 1000499], [0, 1252001], [3895277, 4145777], [124250, 125753]]), ('partial repair variant: slope orientation', [[[7777, 7780], [6684, 6687], [0, 500], [999, 3499]], [[0, -1000], [3, 1503]]], [[6487610, 6490113], [5575684, 5578187], [0, 416167], [832499, 2918332]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[7777, 7778], [0, 2500]], [[1000, 1000], [2000, 0]]], []), ('normal control', [[[999, 1000], [1, 501], [1, 501]], [[1000, 0], [11000, 12000]]], []), ('normal control', [[[1500, 1502]], [[0, 0], [1000, 1000]]], [[1500, 1502]])], [('regression: slope orientation', [[[999, 1001], [7777, 7779], [1500, 2000], [250, 251]], [[3000, 1000], [1000, 0]]], [[0, 1], [3389, 3390], [250, 500]]), ('regression variant: slope orientation', [[[1500, 4000], [0, 1000]], [[3, 1503], [0, -3000]]], [[2248500, 6001000], [0, 1498000]]), ('partial repair probe: slope orientation', [[[1, 2], [1, 2], [1500, 1501], [250, 253]], [[11000, 12000], [10000, 11000]]], [[1001, 1002], [1001, 1002], [2500, 2501], [1250, 1253]]), ('partial repair variant: slope orientation', [[[0, 2500], [250, 750], [0, 3]], [[10000, 10500], [20000, 20500]]], [[500, 3000], [750, 1250], [500, 503]]), ('boundary control', [[[0, 1000]], [[1000, 0], [3000, 1000]]], []), ('normal control', [[[999, 1499], [999, 1002], [5305, 5306], [1, 501]], [[0, 1000], [2000, 0]]], []), ('normal control', [[[0, 3]], [[10000, 9000], [20000, 19500]]], []), ('normal control', [[[999, 1002]], [[1000, 1000], [11000, 11000]]], [[999, 1002]])]]
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: slope orientation | [[2000, 4000]] | [[2000, 4000]] | Passed |
| regression variant: slope orientation | [[9124, 9687], [2088, 2090]] | [[9124, 9687], [2088, 2090]] | Passed |
| partial repair probe: slope orientation | [[0, 625]] | [[0, 625]] | Passed |
| partial repair variant: slope orientation | [[2248500, 6001000], [0, 1498000]] | [[2248500, 6001000], [0, 1498000]] | Passed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [[0, 1]] | [[0, 1]] | Passed |
SHA-256 / 1b0db27c5ea3b7b6aae2a4e79a55dfb2271047712a6244f56e18023a629de7fe
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:31.934097+00:00.
Case digest / de494a7c79daa2805eff12a0243fd4c42dedef4d7c1f2ed94eed3a5119f89fd8