FAILURE MAP
← Case archive

FA-78376 / Broadcast timecode arithmetic / Open access

Frame count to timecode label with frame pairs: pair notation threshold · case 01

Plain 30 fps labels are printed in frame-pair notation.

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

ROOT CAUSE

The pair notation threshold includes 30 fps.

VERIFIED REPAIR

Use pair notation only above 30 fps.

Unsuccessful approach: Starting pair notation at 50 prints 48 fps labels with frame fields above 30.

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//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 notation threshold', [1803, 30], '00:01:00:03'), ('regression variant: pair notation threshold', [2592005, 30], '00:00:00:05'), ('partial repair probe: pair notation threshold', [1, 48], '00:00:00.00'), ('partial repair variant: pair notation threshold', [172807, 48], '01:00:00.03'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [3, 50], '00:00:00.01'), ('normal control', [-1, 25], '23:59:59:24'), ('normal control', [2, 50], '00:00:00:01'), ('normal control', [59, 60], '00:00:00.29')], [('regression: pair notation threshold', [8166989, 30], '03:37:12:29'), ('regression variant: pair notation threshold', [31, 30], '00:00:01:01'), ('partial repair probe: pair notation threshold', [2, 48], '00:00:00:01'), ('partial repair variant: pair notation threshold', [49, 48], '00:00:01.00'), ('boundary control', [-1, 25], '23:59:59:24'), ('boundary control', [2, 50], '00:00:00:01'), ('normal control', [216007, 60], '01:00:00.03'), ('normal control', [-5184003, 60], '23:59:59.28'), ('normal control', [49, 50], '00:00:00.24')], [('regression: pair notation threshold', [-1, 30], '23:59:59:29'), ('regression variant: pair notation threshold', [2591999, 30], '23:59:59:29'), ('partial repair probe: pair notation threshold', [-4147203, 48], '23:59:59.22'), ('partial repair variant: pair notation threshold', [-20013062, 48], '04:11:01:05'), ('boundary control', [2160000, 25], '00:00:00:00'), ('boundary control', [59, 60], '00:00:00.29'), ('normal control', [5184000, 60], '00:00:00:00'), ('normal control', [0, 24], '00:00:00:00'), ('normal control', [7086760, 24], '10:01:21:16')], [('regression: pair notation threshold', [-4622105, 30], '05:12:09:25'), ('regression variant: pair notation threshold', [-2592003, 30], '23:59:59:27'), ('partial repair probe: pair notation threshold', [8294411, 48], '00:00:00.05'), ('partial repair variant: pair notation threshold', [-9650997, 48], '16:08:57.13'), ('boundary control', [3, 50], '00:00:00.01'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [2073600, 24], '00:00:00:00'), ('normal control', [1, 25], '00:00:00:01'), ('normal control', [48, 48], '00:00:01:00')], [('regression: pair notation threshold', [2, 30], '00:00:00:02'), ('regression variant: pair notation threshold', [29, 30], '00:00:00:29'), ('partial repair probe: pair notation threshold', [15958672, 48], '20:21:12:08'), ('partial repair variant: pair notation threshold', [47, 48], '00:00:00.23'), ('boundary control', [2, 50], '00:00:00:01'), ('boundary control', [0, 25], '00:00:00:00'), ('normal control', [2160005, 25], '00:00:00:05'), ('normal control', [5184005, 60], '00:00:00.02'), ('normal control', [2073605, 24], '00:00:00:05')]]
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: pair notation threshold00:01:00.0100:01:00:03Failed
regression variant: pair notation threshold00:00:00.0200:00:00:05Failed
partial repair probe: pair notation threshold00:00:00.0000:00:00.00Passed
partial repair variant: pair notation threshold01:00:00.0301:00:00.03Passed
boundary control00:00:00:0000:00:00:00Passed
boundary control00:00:00.0100:00:00.01Passed
normal control23:59:59:2423:59:59:24Passed
normal control00:00:00:0100:00:00:01Passed
normal control00:00:00.2900:00:00.29Passed

SHA-256 / ca20156d1a9cda35baaade0b212ddd51e9d0276d60da22efde1826a0a09f0b5f

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>=50:
        return '%02d:%02d:%02d%s%02d'%(hh,mm,ss,'.' if fr%2 else ':',fr//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 notation threshold', [1803, 30], '00:01:00:03'), ('regression variant: pair notation threshold', [2592005, 30], '00:00:00:05'), ('partial repair probe: pair notation threshold', [1, 48], '00:00:00.00'), ('partial repair variant: pair notation threshold', [172807, 48], '01:00:00.03'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [3, 50], '00:00:00.01'), ('normal control', [-1, 25], '23:59:59:24'), ('normal control', [2, 50], '00:00:00:01'), ('normal control', [59, 60], '00:00:00.29')], [('regression: pair notation threshold', [8166989, 30], '03:37:12:29'), ('regression variant: pair notation threshold', [31, 30], '00:00:01:01'), ('partial repair probe: pair notation threshold', [2, 48], '00:00:00:01'), ('partial repair variant: pair notation threshold', [49, 48], '00:00:01.00'), ('boundary control', [-1, 25], '23:59:59:24'), ('boundary control', [2, 50], '00:00:00:01'), ('normal control', [216007, 60], '01:00:00.03'), ('normal control', [-5184003, 60], '23:59:59.28'), ('normal control', [49, 50], '00:00:00.24')], [('regression: pair notation threshold', [-1, 30], '23:59:59:29'), ('regression variant: pair notation threshold', [2591999, 30], '23:59:59:29'), ('partial repair probe: pair notation threshold', [-4147203, 48], '23:59:59.22'), ('partial repair variant: pair notation threshold', [-20013062, 48], '04:11:01:05'), ('boundary control', [2160000, 25], '00:00:00:00'), ('boundary control', [59, 60], '00:00:00.29'), ('normal control', [5184000, 60], '00:00:00:00'), ('normal control', [0, 24], '00:00:00:00'), ('normal control', [7086760, 24], '10:01:21:16')], [('regression: pair notation threshold', [-4622105, 30], '05:12:09:25'), ('regression variant: pair notation threshold', [-2592003, 30], '23:59:59:27'), ('partial repair probe: pair notation threshold', [8294411, 48], '00:00:00.05'), ('partial repair variant: pair notation threshold', [-9650997, 48], '16:08:57.13'), ('boundary control', [3, 50], '00:00:00.01'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [2073600, 24], '00:00:00:00'), ('normal control', [1, 25], '00:00:00:01'), ('normal control', [48, 48], '00:00:01:00')], [('regression: pair notation threshold', [2, 30], '00:00:00:02'), ('regression variant: pair notation threshold', [29, 30], '00:00:00:29'), ('partial repair probe: pair notation threshold', [15958672, 48], '20:21:12:08'), ('partial repair variant: pair notation threshold', [47, 48], '00:00:00.23'), ('boundary control', [2, 50], '00:00:00:01'), ('boundary control', [0, 25], '00:00:00:00'), ('normal control', [2160005, 25], '00:00:00:05'), ('normal control', [5184005, 60], '00:00:00.02'), ('normal control', [2073605, 24], '00:00:00:05')]]
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: pair notation threshold00:01:00:0300:01:00:03Passed
regression variant: pair notation threshold00:00:00:0500:00:00:05Passed
partial repair probe: pair notation threshold00:00:00:0100:00:00.00Failed
partial repair variant: pair notation threshold01:00:00:0701:00:00.03Failed
boundary control00:00:00:0000:00:00:00Passed
boundary control00:00:00.0100:00:00.01Passed
normal control23:59:59:2423:59:59:24Passed
normal control00:00:00:0100:00:00:01Passed
normal control00:00:00.2900:00:00.29Passed

SHA-256 / b104fed982d671e2df6d4cdbe1172cf442cd93128787db91e63646b4c8cef855

3 / The verified repair

Exit 0
"""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//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 notation threshold', [1803, 30], '00:01:00:03'), ('regression variant: pair notation threshold', [2592005, 30], '00:00:00:05'), ('partial repair probe: pair notation threshold', [1, 48], '00:00:00.00'), ('partial repair variant: pair notation threshold', [172807, 48], '01:00:00.03'), ('boundary control', [0, 25], '00:00:00:00'), ('boundary control', [3, 50], '00:00:00.01'), ('normal control', [-1, 25], '23:59:59:24'), ('normal control', [2, 50], '00:00:00:01'), ('normal control', [59, 60], '00:00:00.29')], [('regression: pair notation threshold', [8166989, 30], '03:37:12:29'), ('regression variant: pair notation threshold', [31, 30], '00:00:01:01'), ('partial repair probe: pair notation threshold', [2, 48], '00:00:00:01'), ('partial repair variant: pair notation threshold', [49, 48], '00:00:01.00'), ('boundary control', [-1, 25], '23:59:59:24'), ('boundary control', [2, 50], '00:00:00:01'), ('normal control', [216007, 60], '01:00:00.03'), ('normal control', [-5184003, 60], '23:59:59.28'), ('normal control', [49, 50], '00:00:00.24')], [('regression: pair notation threshold', [-1, 30], '23:59:59:29'), ('regression variant: pair notation threshold', [2591999, 30], '23:59:59:29'), ('partial repair probe: pair notation threshold', [-4147203, 48], '23:59:59.22'), ('partial repair variant: pair notation threshold', [-20013062, 48], '04:11:01:05'), ('boundary control', [2160000, 25], '00:00:00:00'), ('boundary control', [59, 60], '00:00:00.29'), ('normal control', [5184000, 60], '00:00:00:00'), ('normal control', [0, 24], '00:00:00:00'), ('normal control', [7086760, 24], '10:01:21:16')], [('regression: pair notation threshold', [-4622105, 30], '05:12:09:25'), ('regression variant: pair notation threshold', [-2592003, 30], '23:59:59:27'), ('partial repair probe: pair notation threshold', [8294411, 48], '00:00:00.05'), ('partial repair variant: pair notation threshold', [-9650997, 48], '16:08:57.13'), ('boundary control', [3, 50], '00:00:00.01'), ('boundary control', [30, 30], '00:00:01:00'), ('normal control', [2073600, 24], '00:00:00:00'), ('normal control', [1, 25], '00:00:00:01'), ('normal control', [48, 48], '00:00:01:00')], [('regression: pair notation threshold', [2, 30], '00:00:00:02'), ('regression variant: pair notation threshold', [29, 30], '00:00:00:29'), ('partial repair probe: pair notation threshold', [15958672, 48], '20:21:12:08'), ('partial repair variant: pair notation threshold', [47, 48], '00:00:00.23'), ('boundary control', [2, 50], '00:00:00:01'), ('boundary control', [0, 25], '00:00:00:00'), ('normal control', [2160005, 25], '00:00:00:05'), ('normal control', [5184005, 60], '00:00:00.02'), ('normal control', [2073605, 24], '00:00:00:05')]]
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: pair notation threshold00:01:00:0300:01:00:03Passed
regression variant: pair notation threshold00:00:00:0500:00:00:05Passed
partial repair probe: pair notation threshold00:00:00.0000:00:00.00Passed
partial repair variant: pair notation threshold01:00:00.0301:00:00.03Passed
boundary control00:00:00:0000:00:00:00Passed
boundary control00:00:00.0100:00:00.01Passed
normal control23:59:59:2423:59:59:24Passed
normal control00:00:00:0100:00:00:01Passed
normal control00:00:00.2900:00:00.29Passed

SHA-256 / fc1deee8192ba29e4376bcfa3bb4edc03bc92c5d919aca5d592dfd1bb50f3c60

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

Case digest / 612488937e7e69c334fc774549750ee861b69ff3c01c728c9c25faa515413168