Skip to content

fix(cinematic): prevent clips with playbackRate < 1 from cutting off early - #939

Open
gauravchahal20 wants to merge 1 commit into
OpenMontageInc:mainfrom
gauravchahal20:fix/issue-855-cinematic-speed-trim-after
Open

gauravchahal20 wants to merge 1 commit into
OpenMontageInc:mainfrom
gauravchahal20:fix/issue-855-cinematic-speed-trim-after

Conversation

@gauravchahal20

Copy link
Copy Markdown

Summary

Fixes an issue where slow-motion video cuts (playbackRate < 1 / speed < 1) in CinematicRenderer stop prematurely and leave the remaining seconds of the scene completely black.

Related issue

Closes #855

Root Cause

VideoCompose correctly computes the scene duration as (out_seconds - in_seconds) / speed and passes trimAfterSeconds: source_out alongside playbackRate: speed. In Remotion's <OffthreadVideo>, specifying trimAfter wraps the video in an internal <Sequence durationInFrames={trimAfter}>. Because Remotion 4.0 does not scale trimAfter by playbackRate, the inner Sequence ends at frame trimAfter on the parent timeline rather than extending for the full duration trimAfter / playbackRate. The outer scene <Sequence> already accurately limits the clip duration on the timeline, so passing trimAfter caused slow-motion clips to terminate early and show black for the remainder of the scene.

Changes

  • In remotion-composer/src/CinematicRenderer.tsx: omit trimAfter on <OffthreadVideo> when scene.playbackRate !== undefined && scene.playbackRate !== 1. This allows the video to play smoothly across the entire scene duration bounded by the parent <Sequence>.
  • In tests/tools/test_cinematic_remotion_adapter.py: added test_cinematic_cut_adapter_slow_motion_scales_duration verifying slow-motion cut duration scaling and trim properties.

Testing

  • Typecheck: npx tsc --noEmit in remotion-composer passed with 0 errors.
  • Python tests: pytest tests/tools/test_cinematic_remotion_adapter.py (10 passed).
  • Full compose suite: pytest tests/tools/test_video_compose_*.py (44 passed).

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable.
  • I updated docs/README if behavior or usage changed.
  • No unrelated files (build artifacts, local config) are included in the diff.

…early

When playbackRate is set, Remotion's <OffthreadVideo> inner Sequence uses
trimAfter directly as timeline frames without dividing by playbackRate,
causing slow-motion clips (speed < 1) to stop early and render black for the
rest of the scene. The parent scene Sequence already bounds the clip's
lifetime, so omitting trimAfter when playbackRate is modified allows the
video to play smoothly through the entire scene duration.

Fixes OpenMontageInc#855
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.

CinematicRenderer: clips with speed < 1 end early and leave the rest of the scene black

1 participant