Repository navigation
@remotion/studio: Fix crash in browser render dialog when no video codec can be encoded - #13662
Open
imeerkhurram wants to merge 1 commit into
Open
imeerkhurram wants to merge 1 commit into
imeerkhurram wants to merge 1 commit into
Conversation
…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
Contributor
Contributor
There was a problem hiding this comment.
✅ 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.
gpt-6.1-terra | 𝕏
This branch was successfully deployed
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.

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 inMenuContent(values[0].typeon 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, soVideoEncoderdoesn'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:WebRenderModal: disable "Render video" in that case, since the render can't succeed.I left
MenuContentas 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 (noVideoEncoder),ten-frame-tester, Render in browser → Video.Before: the Codec field is empty, and clicking it shows the
TypeErroroverlay from the issue.After: the Codec row explains why, and "Render video" is disabled.
On
http://localhostnothing changes: the Codec picker shows H.264 and "Render video" is enabled.How I tested
bun test srcinpackages/studio: 928 pass, 0 fail. This includes the newsrc/test/web-render-modal-video-codec.test.tsx. It renders the General tab with the realuseEncodableVideoCodecs()hook (happy-dom has noVideoEncoder, so the list resolves to empty) and checks both messages and that no empty Codec picker is shown. Both cases fail onmainand pass with this change.bun run lint(0 errors, existing warnings only),bun run formatting, andtsc --noEmitforpackages/studio.packages/examplein 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
TypeErroris no longer rendered.