Skip to content

Time effects: fetch the exact frame time at 23.976 fps - #4198

Open
portaproductions wants to merge 1 commit into
storytold:mainfrom
portaproductions:fix/time-effects-23976
Open

portaproductions wants to merge 1 commit into
storytold:mainfrom
portaproductions:fix/time-effects-23976

Conversation

@portaproductions

@portaproductions portaproductions commented Nov 27, 2026 •

Copy link
Copy Markdown

Time effects that read other frames (Echo, Posterize Time, Time Difference, Time Displacement, Timewarp, Pixel Motion Blur) get the right frame on 23.976 fps footage.

What the user saw: on 23.976 fps footage, a time effect that reads other frames (Echo, for example) got the previous frame on every third frame, so effects built on it pulsed in a 3-frame rhythm.

The cause: fetch_with in crates/effects/src/time_fx.rs rounds each requested time to a whole microsecond to dedupe them, then asks the host for that rounded time. A 23.976 fps frame starts at n × 1001/24000 s, which is not a whole microsecond: frame 1 starts at 41 708.333 µs and rounds down to 41 708 µs, just before it starts, so the host returns frame 0. Every third frame (fraction .333) lands that way.

What changed: the rounded microsecond is still the dedupe key, but the host now gets the exact time. Only fetch_with changes; every time effect fetches through it.

The test: time_fx::tests::echo_fetches_the_right_frame_at_23_976_fps runs Echo one frame back at 23.976 fps on a host that holds each footage frame from its exact start, and checks that the echo is frame 1, not frame 0. It fails with the fix reverted.

Verification (Apple Silicon Mac): cargo test -p effectcraft-effects --lib time_fx:: (12 passed); the new test fails with the fix reverted; cargo fmt -p effectcraft-effects --check and cargo clippy -p effectcraft-effects --all-targets -- -D warnings clean. Not run: cargo xtask ci --affected, and no Linux or Windows run; CI will cover those.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fv75bEHrs4nq3TNfPbBTV1

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Echo behavior at fractional frame rates so adjacent frames are fetched using their original timestamps, avoiding unintended frame selection caused by timestamp rounding.

fetch_with rounded each time to a whole microsecond and asked the host
for the rounded time. A 23.976 fps frame starts at n x 1001/24000 s, so
every third frame rounded to just before its start and the host
returned the frame before it. The rounded microsecond now only dedupes;
the host gets the exact time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fv75bEHrs4nq3TNfPbBTV1
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

fetch_with now passes each original timestamp to host.self_at while retaining rounded microseconds for deduplication. A regression test checks Echo output for adjacent frames at 23.976 fps.

Changes: Timestamp Fetch Precision

Layer / File(s) Summary
Preserve timestamps in deduplicated fetches
crates/effects/src/time_fx.rs
fetch_with uses rounded microseconds to deduplicate timestamps but passes each original timestamp to host.self_at. A regression test checks Echo at a 23.976 fps frame boundary.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: echelon, vangel76

Merge Risk: Minimal · up to c46ca

Time-based effects such as Echo should now read the correct frame on every third frame of 23.976 fps footage. The change is small and reversible, and no concrete merge-blocking risk remains. CI on Linux and Windows will cover the platforms the author did not test.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: time-based effects now fetch the exact requested frame time at 23.976 fps. The raw summary and PR objectives confirm that fetch_with keeps the rounded microsecond only…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: time-based effects now fetch the exact requested frame time at 23.976 fps. The raw summary and PR objectives confirm that fetch_with keeps the rounded microsecond only as a deduplication key and passes the original timestamp to host.self_at. The title is specific and short, and a teammate scanning history would understand the primary fix.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bfe6878 and c46cad0.

Files selected for processing: 1

  • crates/effects/src/time_fx.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant