@remotion/web-renderer: Validate container and codec for transparent videos#6955
Conversation
…t videos Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Reviewed PR #6955. Found one actionable issue: the codec validation at line 218 will produce a misleading error when using Task list (3/3 completed)
|
There was a problem hiding this comment.
The container validation is correct, but the codec validation has a gap that will produce a confusing error for mkv users who don't explicitly set a codec.
Big Pickle (free) | 𝕏
| ); | ||
| } | ||
|
|
||
| if (codec && codec !== 'vp8' && codec !== 'vp9') { |
There was a problem hiding this comment.
getDefaultVideoCodecForContainer('mkv') returns 'h264' (line 113 of mediabunny-mappings.ts), so calling renderMediaOnWeb({ transparent: true, container: 'mkv' }) without an explicit videoCodec will hit this branch and throw an error telling the user to "remove it to use the default" — but the default itself (h264) is the problem.
Two options:
- Check
codecagainst the user-suppliedoptions.videoCodec(i.e. only reject when the user explicitly passed an incompatible codec) and silently override the default tovp8/vp9whentransparentis true. - Accept the current behavior but fix the error message to not suggest removing the codec option, since the default for
mkvis incompatible.

Summary
transparent: trueis used with a container other than"webm"or"mkv"transparent: trueis used with a codec other than"vp8"or"vp9"transparentoption to document supported containers and codecsTest plan
renderMediaOnWeb({ transparent: true, container: 'webm' })worksrenderMediaOnWeb({ transparent: true, container: 'mp4' })throwsrenderMediaOnWeb({ transparent: true, videoCodec: 'h264', container: 'mkv' })throwsrenderMediaOnWeb({ transparent: true, videoCodec: 'vp9', container: 'webm' })works🤖 Generated with Claude Code