Repository navigation
fix(cinematic): prevent clips with playbackRate < 1 from cutting off early - #939
Open
gauravchahal20 wants to merge 1 commit into
Open
gauravchahal20 wants to merge 1 commit into
gauravchahal20 wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where slow-motion video cuts (
playbackRate < 1/speed < 1) inCinematicRendererstop prematurely and leave the remaining seconds of the scene completely black.Related issue
Closes #855
Root Cause
VideoComposecorrectly computes the scene duration as(out_seconds - in_seconds) / speedand passestrimAfterSeconds: source_outalongsideplaybackRate: speed. In Remotion's<OffthreadVideo>, specifyingtrimAfterwraps the video in an internal<Sequence durationInFrames={trimAfter}>. Because Remotion 4.0 does not scaletrimAfterbyplaybackRate, the inner Sequence ends at frametrimAfteron the parent timeline rather than extending for the full durationtrimAfter / playbackRate. The outer scene<Sequence>already accurately limits the clip duration on the timeline, so passingtrimAftercaused slow-motion clips to terminate early and show black for the remainder of the scene.Changes
remotion-composer/src/CinematicRenderer.tsx: omittrimAfteron<OffthreadVideo>whenscene.playbackRate !== undefined && scene.playbackRate !== 1. This allows the video to play smoothly across the entire scene duration bounded by the parent<Sequence>.tests/tools/test_cinematic_remotion_adapter.py: addedtest_cinematic_cut_adapter_slow_motion_scales_durationverifying slow-motion cut duration scaling and trim properties.Testing
npx tsc --noEmitinremotion-composerpassed with 0 errors.pytest tests/tools/test_cinematic_remotion_adapter.py(10 passed).pytest tests/tools/test_video_compose_*.py(44 passed).Checklist
make test-contracts/make test) where applicable.