FAILURE MAP
← Case archive

FA-78761 / Broadcast timecode arithmetic / Open access

Decimal seconds to frame label: frame field modulus · case 01

NTSC labels show frame fields in the thousands.

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

ROOT CAUSE

The frame field is reduced modulo the rate numerator.

VERIFIED REPAIR

Reduce the frame field modulo the nominal rate.

Unsuccessful approach: The truncated rate gives 29 labels per second at 29.97.

Case contract

Convert a decimal seconds string exactly (no binary floating point) at rate [N,D] to the nearest frame, halves rounding up, and a non-drop label using the nominal rate ceil(N/D). Negative input returns None.

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
import math
from fractions import Fraction
N = 1
observations = []
def solve(sec, fps):
    num,den=fps
    x=Fraction(sec)
    if x<0:
        return None
    n=x*num/den
    fr=math.floor(n+Fraction(1,2))
    nominal=-(-num//den)
    return [fr,'%02d:%02d:%02d:%02d'%(fr//(3600*nominal)%24,fr//(60*nominal)%60,fr//nominal%60,fr%num)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame field modulus', ['1.001', [30000, 1001]], [30, '00:00:01:00']), ('regression variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair probe: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('partial repair variant: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['-1', [24000, 1001]], None), ('normal control', ['-1', [24, 1]], None)], [('regression: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('regression variant: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair probe: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('normal control', ['0.14', [24000, 1001]], [3, '00:00:00:03']), ('normal control', ['0.18', [24000, 1001]], [4, '00:00:00:04']), ('normal control', ['0', [24000, 1001]], [0, '00:00:00:00'])], [('regression: frame field modulus', ['3600', [30000, 1001]], [107892, '00:59:56:12']), ('regression variant: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair probe: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['-1', [25, 1]], None), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['7.3', [24, 1]], [175, '00:00:07:07']), ('normal control', ['1.001', [24, 1]], [24, '00:00:01:00']), ('normal control', ['0.5005', [50, 1]], [25, '00:00:00:25'])], [('regression: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('regression variant: frame field modulus', ['3600', [24000, 1001]], [86314, '00:59:56:10']), ('partial repair probe: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair variant: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('boundary control', ['-1', [25, 1]], None), ('normal control', ['0.1', [25, 1]], [3, '00:00:00:03']), ('normal control', ['0.1', [24000, 1001]], [2, '00:00:00:02']), ('normal control', ['0.1', [50, 1]], [5, '00:00:00:05'])], [('regression: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('regression variant: frame field modulus', ['1.5', [24000, 1001]], [36, '00:00:01:12']), ('partial repair probe: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.04', [24000, 1001]], [1, '00:00:00:01']), ('normal control', ['0.14', [25, 1]], [4, '00:00:00:04']), ('normal control', ['0.0166', [50, 1]], [1, '00:00:00:01'])]]
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 field modulus[30, '00:00:01:30'][30, '00:00:01:00']Failed
regression variant: frame field modulus[370, '00:00:12:370'][370, '00:00:12:10']Failed
partial repair probe: frame field modulus[219, '00:00:07:219'][219, '00:00:07:09']Failed
partial repair variant: frame field modulus[296, '00:00:12:296'][296, '00:00:12:08']Failed
boundary control[2, '00:00:00:02'][2, '00:00:00:02']Passed
boundary control[0, '00:00:00:00'][0, '00:00:00:00']Passed
normal control[1, '00:00:00:01'][1, '00:00:00:01']Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / bb9285a519ef491c5fd274a092e66f7bb639b3ef77fd2fc64a4d8575708ab4df

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(sec, fps):
    num,den=fps
    x=Fraction(sec)
    if x<0:
        return None
    n=x*num/den
    fr=math.floor(n+Fraction(1,2))
    nominal=-(-num//den)
    return [fr,'%02d:%02d:%02d:%02d'%(fr//(3600*nominal)%24,fr//(60*nominal)%60,fr//nominal%60,fr%(num//den))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame field modulus', ['1.001', [30000, 1001]], [30, '00:00:01:00']), ('regression variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair probe: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('partial repair variant: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['-1', [24000, 1001]], None), ('normal control', ['-1', [24, 1]], None)], [('regression: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('regression variant: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair probe: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('normal control', ['0.14', [24000, 1001]], [3, '00:00:00:03']), ('normal control', ['0.18', [24000, 1001]], [4, '00:00:00:04']), ('normal control', ['0', [24000, 1001]], [0, '00:00:00:00'])], [('regression: frame field modulus', ['3600', [30000, 1001]], [107892, '00:59:56:12']), ('regression variant: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair probe: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['-1', [25, 1]], None), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['7.3', [24, 1]], [175, '00:00:07:07']), ('normal control', ['1.001', [24, 1]], [24, '00:00:01:00']), ('normal control', ['0.5005', [50, 1]], [25, '00:00:00:25'])], [('regression: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('regression variant: frame field modulus', ['3600', [24000, 1001]], [86314, '00:59:56:10']), ('partial repair probe: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair variant: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('boundary control', ['-1', [25, 1]], None), ('normal control', ['0.1', [25, 1]], [3, '00:00:00:03']), ('normal control', ['0.1', [24000, 1001]], [2, '00:00:00:02']), ('normal control', ['0.1', [50, 1]], [5, '00:00:00:05'])], [('regression: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('regression variant: frame field modulus', ['1.5', [24000, 1001]], [36, '00:00:01:12']), ('partial repair probe: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.04', [24000, 1001]], [1, '00:00:00:01']), ('normal control', ['0.14', [25, 1]], [4, '00:00:00:04']), ('normal control', ['0.0166', [50, 1]], [1, '00:00:00:01'])]]
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 field modulus[30, '00:00:01:01'][30, '00:00:01:00']Failed
regression variant: frame field modulus[370, '00:00:12:22'][370, '00:00:12:10']Failed
partial repair probe: frame field modulus[219, '00:00:07:16'][219, '00:00:07:09']Failed
partial repair variant: frame field modulus[296, '00:00:12:20'][296, '00:00:12:08']Failed
boundary control[2, '00:00:00:02'][2, '00:00:00:02']Passed
boundary control[0, '00:00:00:00'][0, '00:00:00:00']Passed
normal control[1, '00:00:00:01'][1, '00:00:00:01']Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / 4344a2629fd2d68df6207e519ee96f420a886a2d903e5e616321b8d85d75e052

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(sec, fps):
    num,den=fps
    x=Fraction(sec)
    if x<0:
        return None
    n=x*num/den
    fr=math.floor(n+Fraction(1,2))
    nominal=-(-num//den)
    return [fr,'%02d:%02d:%02d:%02d'%(fr//(3600*nominal)%24,fr//(60*nominal)%60,fr//nominal%60,fr%nominal)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame field modulus', ['1.001', [30000, 1001]], [30, '00:00:01:00']), ('regression variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair probe: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('partial repair variant: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['-1', [24000, 1001]], None), ('normal control', ['-1', [24, 1]], None)], [('regression: frame field modulus', ['12.345', [24000, 1001]], [296, '00:00:12:08']), ('regression variant: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair probe: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('normal control', ['0.14', [24000, 1001]], [3, '00:00:00:03']), ('normal control', ['0.18', [24000, 1001]], [4, '00:00:00:04']), ('normal control', ['0', [24000, 1001]], [0, '00:00:00:00'])], [('regression: frame field modulus', ['3600', [30000, 1001]], [107892, '00:59:56:12']), ('regression variant: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair probe: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('partial repair variant: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('boundary control', ['-1', [25, 1]], None), ('boundary control', ['0.02', [25, 1]], [1, '00:00:00:01']), ('normal control', ['7.3', [24, 1]], [175, '00:00:07:07']), ('normal control', ['1.001', [24, 1]], [24, '00:00:01:00']), ('normal control', ['0.5005', [50, 1]], [25, '00:00:00:25'])], [('regression: frame field modulus', ['7.3', [30000, 1001]], [219, '00:00:07:09']), ('regression variant: frame field modulus', ['3600', [24000, 1001]], [86314, '00:59:56:10']), ('partial repair probe: frame field modulus', ['7.3', [24000, 1001]], [175, '00:00:07:07']), ('partial repair variant: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('boundary control', ['-1', [25, 1]], None), ('normal control', ['0.1', [25, 1]], [3, '00:00:00:03']), ('normal control', ['0.1', [24000, 1001]], [2, '00:00:00:02']), ('normal control', ['0.1', [50, 1]], [5, '00:00:00:05'])], [('regression: frame field modulus', ['1.001', [24000, 1001]], [24, '00:00:01:00']), ('regression variant: frame field modulus', ['1.5', [24000, 1001]], [36, '00:00:01:12']), ('partial repair probe: frame field modulus', ['1.5', [30000, 1001]], [45, '00:00:01:15']), ('partial repair variant: frame field modulus', ['12.345', [30000, 1001]], [370, '00:00:12:10']), ('boundary control', ['0.06', [25, 1]], [2, '00:00:00:02']), ('boundary control', ['0', [24, 1]], [0, '00:00:00:00']), ('normal control', ['0.04', [24000, 1001]], [1, '00:00:00:01']), ('normal control', ['0.14', [25, 1]], [4, '00:00:00:04']), ('normal control', ['0.0166', [50, 1]], [1, '00:00:00:01'])]]
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 field modulus[30, '00:00:01:00'][30, '00:00:01:00']Passed
regression variant: frame field modulus[370, '00:00:12:10'][370, '00:00:12:10']Passed
partial repair probe: frame field modulus[219, '00:00:07:09'][219, '00:00:07:09']Passed
partial repair variant: frame field modulus[296, '00:00:12:08'][296, '00:00:12:08']Passed
boundary control[2, '00:00:00:02'][2, '00:00:00:02']Passed
boundary control[0, '00:00:00:00'][0, '00:00:00:00']Passed
normal control[1, '00:00:00:01'][1, '00:00:00:01']Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / ba38c61eb3740f8a9f32ba68c0ca4ce0f946ce453c35f969f555d273bdc73769

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

Case digest / d70c5c832c36d9b8c61f9ff95734c3ba190f04f9dba15451e73a37d14db63e9f