FA-78386 / Broadcast timecode arithmetic / Open access
Frame count to timecode label with frame pairs: pair index · case 01
Frame-pair fields restart halfway through each second.
ROOT CAUSE
The pair index wraps modulo half the rate instead of halving the frame.
THE FAILURE
The pair index wraps modulo half the rate instead of halving the frame.
Unsuccessful approach: Rounding up the pair index groups frames into the wrong pairs.
Case contract
Convert a frame count (any integer, wrapped modulo 24 hours) to HH:MM:SS:FF. For fps above 30 the frame field counts frame pairs (frame//2) and the last separator is "." for the second frame of a pair and ":" otherwise.
Why this case matters
Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(frames, fps):
day=24*3600*fps
frames%=day
fr=frames%fps
s=frames//fps
hh,mm,ss=s//3600,s//60%60,s%60
if fps>30:
return '%02d:%02d:%02d%s%02d'%(hh,mm,ss,'.' if fr%2 else ':',fr%(fps//2))
return '%02d:%02d:%02d:%02d'%(hh,mm,ss,fr)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: pair index', [3, 50], '00:00:00.01'), ('regression variant: pair index', [4147205, 48], '00:00:00.02'), ('partial repair probe: pair index', [216007, 60], '01:00:00.03'), ('partial repair variant: pair index', [-1, 50], '23:59:59.24'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [-1, 25], '23:59:59:24'), ('normal control', [1803, 30], '00:01:00:03'), ('normal control', [8166989, 30], '03:37:12:29')], [('regression: pair index', [2, 50], '00:00:00:01'), ('regression variant: pair index', [-5184003, 60], '23:59:59.28'), ('partial repair probe: pair index', [8640011, 50], '00:00:00.05'), ('partial repair variant: pair index', [49, 50], '00:00:00.24'), ('boundary control', [-1, 25], '23:59:59:24'), ('boundary control', [0, 25], '00:00:00:00'), ('normal control', [5184000, 60], '00:00:00:00'), ('normal control', [-4622105, 30], '05:12:09:25'), ('normal control', [2, 30], '00:00:00:02')], [('regression: pair index', [216007, 60], '01:00:00.03'), ('regression variant: pair index', [1, 48], '00:00:00.00'), ('partial repair probe: pair index', [3745221, 48], '21:40:25.10'), ('partial repair variant: pair index', [-4147203, 48], '23:59:59.22'), ('boundary control', [2160000, 25], '00:00:00:00'), ('boundary control', [-1, 25], '23:59:59:24'), ('normal control', [2592005, 30], '00:00:00:05'), ('normal control', [2592000, 30], '00:00:00:00'), ('normal control', [1, 25], '00:00:00:01')], [('regression: pair index', [8640011, 50], '00:00:00.05'), ('regression variant: pair index', [2, 48], '00:00:00:01'), ('partial repair probe: pair index', [4147205, 48], '00:00:00.02'), ('partial repair variant: pair index', [180007, 50], '01:00:00.03'), ('boundary control', [30, 30], '00:00:01:00'), ('boundary control', [2160000, 25], '00:00:00:00'), ('normal control', [48, 48], '00:00:01:00'), ('normal control', [2591999, 30], '23:59:59:29'), ('normal control', [2073605, 24], '00:00:00:05')], [('regression: pair index', [3745221, 48], '21:40:25.10'), ('regression variant: pair index', [-4147203, 48], '23:59:59.22'), ('partial repair probe: pair index', [4319999, 50], '23:59:59.24'), ('partial repair variant: pair index', [4320005, 50], '00:00:00.02'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [0, 48], '00:00:00:00'), ('normal control', [29, 30], '00:00:00:29'), ('normal control', [2, 25], '00:00:00:02')]]
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: pair index | 00:00:00.03 | 00:00:00.01 | Failed |
| regression variant: pair index | 00:00:00.05 | 00:00:00.02 | Failed |
| partial repair probe: pair index | 01:00:00.07 | 01:00:00.03 | Failed |
| partial repair variant: pair index | 23:59:59.24 | 23:59:59.24 | Passed |
| boundary control | 00:00:00:00 | 00:00:00:00 | Passed |
| boundary control | 00:00:01:00 | 00:00:01:00 | Passed |
| normal control | 23:59:59:24 | 23:59:59:24 | Passed |
| normal control | 00:01:00:03 | 00:01:00:03 | Passed |
| normal control | 03:37:12:29 | 03:37:12:29 | Passed |
SHA-256 / aa9e78120c16f2f0a59bc563641293b6474b3a3d6d600284a878a4aca1ebe22b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(frames, fps):
day=24*3600*fps
frames%=day
fr=frames%fps
s=frames//fps
hh,mm,ss=s//3600,s//60%60,s%60
if fps>30:
return '%02d:%02d:%02d%s%02d'%(hh,mm,ss,'.' if fr%2 else ':',(fr+1)//2)
return '%02d:%02d:%02d:%02d'%(hh,mm,ss,fr)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: pair index', [3, 50], '00:00:00.01'), ('regression variant: pair index', [4147205, 48], '00:00:00.02'), ('partial repair probe: pair index', [216007, 60], '01:00:00.03'), ('partial repair variant: pair index', [-1, 50], '23:59:59.24'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [-1, 25], '23:59:59:24'), ('normal control', [1803, 30], '00:01:00:03'), ('normal control', [8166989, 30], '03:37:12:29')], [('regression: pair index', [2, 50], '00:00:00:01'), ('regression variant: pair index', [-5184003, 60], '23:59:59.28'), ('partial repair probe: pair index', [8640011, 50], '00:00:00.05'), ('partial repair variant: pair index', [49, 50], '00:00:00.24'), ('boundary control', [-1, 25], '23:59:59:24'), ('boundary control', [0, 25], '00:00:00:00'), ('normal control', [5184000, 60], '00:00:00:00'), ('normal control', [-4622105, 30], '05:12:09:25'), ('normal control', [2, 30], '00:00:00:02')], [('regression: pair index', [216007, 60], '01:00:00.03'), ('regression variant: pair index', [1, 48], '00:00:00.00'), ('partial repair probe: pair index', [3745221, 48], '21:40:25.10'), ('partial repair variant: pair index', [-4147203, 48], '23:59:59.22'), ('boundary control', [2160000, 25], '00:00:00:00'), ('boundary control', [-1, 25], '23:59:59:24'), ('normal control', [2592005, 30], '00:00:00:05'), ('normal control', [2592000, 30], '00:00:00:00'), ('normal control', [1, 25], '00:00:00:01')], [('regression: pair index', [8640011, 50], '00:00:00.05'), ('regression variant: pair index', [2, 48], '00:00:00:01'), ('partial repair probe: pair index', [4147205, 48], '00:00:00.02'), ('partial repair variant: pair index', [180007, 50], '01:00:00.03'), ('boundary control', [30, 30], '00:00:01:00'), ('boundary control', [2160000, 25], '00:00:00:00'), ('normal control', [48, 48], '00:00:01:00'), ('normal control', [2591999, 30], '23:59:59:29'), ('normal control', [2073605, 24], '00:00:00:05')], [('regression: pair index', [3745221, 48], '21:40:25.10'), ('regression variant: pair index', [-4147203, 48], '23:59:59.22'), ('partial repair probe: pair index', [4319999, 50], '23:59:59.24'), ('partial repair variant: pair index', [4320005, 50], '00:00:00.02'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [0, 48], '00:00:00:00'), ('normal control', [29, 30], '00:00:00:29'), ('normal control', [2, 25], '00:00:00:02')]]
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: pair index | 00:00:00.02 | 00:00:00.01 | Failed |
| regression variant: pair index | 00:00:00.03 | 00:00:00.02 | Failed |
| partial repair probe: pair index | 01:00:00.04 | 01:00:00.03 | Failed |
| partial repair variant: pair index | 23:59:59.25 | 23:59:59.24 | Failed |
| boundary control | 00:00:00:00 | 00:00:00:00 | Passed |
| boundary control | 00:00:01:00 | 00:00:01:00 | Passed |
| normal control | 23:59:59:24 | 23:59:59:24 | Passed |
| normal control | 00:01:00:03 | 00:01:00:03 | Passed |
| normal control | 03:37:12:29 | 03:37:12:29 | Passed |
SHA-256 / 6e0296b77f07de5ba939619e2efb8b5fd110297999412d4728f64ef7a4dc3d60
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 SMPTE or any broadcast 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:34.690763+00:00.
Case digest / 3283c6052d5b9e0cf617f02ba679b9c233e79ce7b20a9826fa83770a2100c6bc