4904b939ef
Check Codex Skill / test-installer (push) Failing after 1s
Deploy to GitHub Pages / build (push) Failing after 1s
Check Root Skills / validate-root-skills (push) Failing after 1s
Deploy to GitHub Pages / deploy (push) Has been skipped
Publish cli-anything-hub to PyPI / publish (push) Failing after 1s
PR Labeler Tests / test (push) Failing after 1s
23 lines
728 B
Markdown
23 lines
728 B
Markdown
# Timecode Precision
|
|
|
|
Non-integer frame rates (29.97fps = 30000/1001) cause cumulative rounding errors. Follow these rules to avoid drift.
|
|
|
|
## Use `round()`, Not `int()`
|
|
|
|
For float-to-frame conversion:
|
|
- `int(9000 * 29.97)` — **wrong**, truncates and loses frames
|
|
- `round(9000 * 29.97)` — **correct**, gets the right answer
|
|
|
|
## Use Integer Arithmetic for Timecode Display
|
|
|
|
Convert frames → total milliseconds via:
|
|
```python
|
|
total_ms = round(frames * fps_den * 1000 / fps_num)
|
|
```
|
|
|
|
Then decompose with integer division. Avoid intermediate floats that drift over long durations.
|
|
|
|
## Accept ±1 Frame Tolerance
|
|
|
|
In roundtrip tests at non-integer FPS, exact equality is mathematically impossible. Accept ±1 frame tolerance.
|