Skip to content

@remotion/media: Apply effects during video rendering#7756

Merged
JonnyBurger merged 2 commits into
mainfrom
fix-media-video-render-effects
May 29, 2026
Merged

@remotion/media: Apply effects during video rendering#7756
JonnyBurger merged 2 commits into
mainfrom
fix-media-video-render-effects

Conversation

@samohovets
Copy link
Copy Markdown
Member

Summary

  • Pass memoized effects into the @remotion/media <Video> render path
  • Apply the effect chain after extracting video frames for rendering
  • Normalize extracted ImageBitmap frames through the canvas before running effects to preserve WebGL orientation

Fixes #7725.

Testing

  • cd packages/media && bunx oxfmt src --write
  • bun run build
  • bun run formatting

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment May 28, 2026 1:04pm
remotion Building Building Preview, Comment May 28, 2026 1:04pm

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The !completed guard after runEffectChain in the render path can leave delayRender handles unclosed, which stalls the render pipeline. Details are inline.

Reviewed changes — Fix @remotion/media <Video> to apply effects in the render path (not just preview), by drawing the extracted ImageBitmap to a canvas and running the effect chain before compositing.

  • video.tsx — Pass memoized effects into VideoForRendering.
  • video-for-rendering.tsx — Acquire effectChainState, draw the extracted frame to the output canvas, and run Internals.runEffectChain when effects are present.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2𝕏

Comment thread packages/media/src/video/video-for-rendering.tsx
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The previously raised issue on video-for-rendering.tsx is still present in the latest revision.

Reviewed changes — No new substantive code changes were introduced by the merge commit d10f72b; the diff is identical to the prior revision. The finding from the initial review still applies.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2𝕏


if (!completed) {
imageBitmap.close();
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Returning early when !completed skips continueRender(newHandle), leaving the delayRender handle open indefinitely and stalling the render pipeline.

runEffectChain returns false only when superseded by a newer run. In the render path, that can only happen when a prior async frame extraction (already cleaned up by useLayoutEffect) races to finish. None of the other effect-chain consumers — CanvasImage, HtmlInCanvas, Gif, or video-iterator-manager — check this return value. Remove the guard and let execution fall through to continueRender.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! I think this one is okay to leave as-is: runEffectChain() returns false only when superseded by a newer run, and in that scenario the previous useLayoutEffect cleanup has already called continueRender(newHandle). We also intentionally avoid falling through for stale effect-chain results so we do not continue/register work from an outdated frame. This matches the pattern in other effect consumers such as CanvasImage, Solid, and AnimatedImage, which only continue when the chain completed.

@JonnyBurger JonnyBurger merged commit c1b4d0e into main May 29, 2026
35 of 38 checks passed
@JonnyBurger JonnyBurger deleted the fix-media-video-render-effects branch May 29, 2026 08:02
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.

@remotion/media: <Video> does not apply effects in render path

2 participants