Skip to content

@remotion/studio: Fix crash in browser render dialog when no video codec can be encoded - #13662

Open
imeerkhurram wants to merge 1 commit into
remotion-dev:mainfrom
imeerkhurram:fix-web-render-no-encodable-video-codec
Open

imeerkhurram wants to merge 1 commit into
remotion-dev:mainfrom
imeerkhurram:fix-web-render-no-encodable-video-codec

Conversation

@imeerkhurram

Copy link
Copy Markdown

Fixes #13658

What was wrong

In the "Render in browser" dialog, the Codec options come from getEncodableVideoCodecs(). When that returns an empty list, the Codec field rendered blank, and opening it crashed the Studio in MenuContent (values[0].type on an empty list), which is the error in the issue.

An empty list happens when the browser can't encode any video codec for the chosen container. The easiest way to hit it is to open the Studio through its "Network" URL (for example http://192.168.x.x:3000). That is not a secure context, so VideoEncoder doesn't exist and Mediabunny reports no encodable codecs.

What changed

  • WebRenderModalBasic: when no video codec is encodable, show a message in place of the empty Codec picker:
    • not a secure context: "Video encoding requires HTTPS or localhost."
    • otherwise: "This browser cannot encode any MP4 video codec. Try another container." (uses the selected container's name)
  • WebRenderModal: disable "Render video" in that case, since the render can't succeed.

I left MenuContent as is. The Codec field was the only caller passing it an empty list, so I fixed it where the empty list comes from instead of guarding the generic menu.

Before / after

Chrome 158, example Studio opened from a non-localhost http:// address (no VideoEncoder), ten-frame-tester, Render in browser → Video.

Before: the Codec field is empty, and clicking it shows the TypeError overlay from the issue.

before-modal
before-crash-after-opening-codec

After: the Codec row explains why, and "Render video" is disabled.

after-modal

On http://localhost nothing changes: the Codec picker shows H.264 and "Render video" is enabled.

How I tested

  • bun test src in packages/studio: 928 pass, 0 fail. This includes the new src/test/web-render-modal-video-codec.test.tsx. It renders the General tab with the real useEncodableVideoCodecs() hook (happy-dom has no VideoEncoder, so the list resolves to empty) and checks both messages and that no empty Codec picker is shown. Both cases fail on main and pass with this change.
  • bun run lint (0 errors, existing warnings only), bun run formatting, and tsc --noEmit for packages/studio.
  • Manually with packages/example in Chrome, as described above: before the change I got the exact crash from the issue; after it, the message and the disabled button; on localhost, the normal picker.

The issue also mentions the error showing on page load without a click. I couldn't reproduce that part. With this change, the empty picker that leads to this TypeError is no longer rendered.

…codec can be encoded

When getEncodableVideoCodecs() returns an empty list (for example when the
Studio is opened over plain HTTP on a network address, where WebCodecs is
not exposed), the Codec field rendered empty and opening it threw
"Cannot read properties of undefined (reading 'type')" in MenuContent.

Show why no codec is available instead of an empty picker, and disable
the Render video button since the render could not succeed.

Fixes remotion-dev#13658
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
bugs Ready Ready Preview Nov 28, 2026 3:14am UTC
remotion Ready Ready Preview Nov 28, 2026 3:14am UTC

Request Review

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Approach: sound — the dialog handles an empty video codec list at the source and prevents video submission once codec detection completes.

Reviewed changes: Reviewed the browser render dialog and its codec availability handling.

  • Codec picker: Replaces an empty menu with an explanation tailored to the browser context and container.
  • Render action: Disables video rendering when no video codec is available, while preserving still and audio rendering.
  • Tests: Covers the secure and insecure context messages using the codec detection hook.

Pullfrog  | View workflow run | Using gpt-6.1-terra | 𝕏

This branch was successfully deployed

2 active deployments
Preview – remotion — 73a19cd7 Deployed Nov 28, 2026 by vercel[bot]
Preview – bugs — 73a19cd7 Deployed Nov 28, 2026 by vercel[bot]
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.

Studio: 'Render in browser' quebra com TypeError em MenuContent (values[0].type) e Codec vazio

1 participant