@remotion/renderer: Make renderMedia() and renderStill() return MIME types#6611
@remotion/renderer: Make renderMedia() and renderStill() return MIME types#6611JonnyBurger merged 6 commits intomainfrom
@remotion/renderer: Make renderMedia() and renderStill() return MIME types#6611Conversation
…till() return values Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Clean, well-scoped change. Implementation is correct — mimeLookup handles all codec extensions and still image formats properly, and the || 'application/octet-stream' fallback correctly covers the false return from mimeLookup. One minor docs suggestion inline.
There was a problem hiding this comment.
Low urgency. The implementation is functional and handles the common cases correctly. One edge case worth considering: renderMedia derives the MIME type from the codec's default extension rather than the actual output filename, which could return a mismatched MIME type when users specify non-default extensions (e.g., output.mkv for h264+aac would return video/mp4 instead of video/x-matroska).
path.extname('.mp4') returns '' (treated as dotfile), so prefix
with 'file.' to ensure correct extension extraction.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a mimeType field to the return values of both renderMedia() and renderStill() functions in the @remotion/renderer package. The MIME type is automatically derived from the output file format using the existing mimeLookup() utility function, with a fallback to 'application/octet-stream' for unrecognized formats.
Changes:
- Added
mimeType: stringfield toRenderStillReturnValuetype definition - Added
mimeType: stringfield toRenderMediaResulttype definition - Updated documentation for both functions to describe the new return value field
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/renderer/src/render-still.ts | Added mimeType field to return type, implemented using mimeLookup(imageFormat) |
| packages/renderer/src/render-media.ts | Added mimeType field to return type, implemented using mimeLookup(getFileExtensionFromCodec(codec, audioCodec)) |
| packages/docs/docs/renderer/render-still.mdx | Documented the new mimeType return value field with examples |
| packages/docs/docs/renderer/render-media.mdx | Documented the new mimeType return value field with examples |
@remotion/renderer: Add mimeType field to renderMedia() and renderStill() return values@remotion/renderer: Make renderMedia() and renderStill() return MIME types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Summary
mimeTypefield to the return values ofrenderMedia()andrenderStill()mimeLookup()utility to derive the MIME type from the output file extensionrenderMedia()andrenderStill()to document the new fieldTest plan
renderMedia()returns correct MIME types (e.g.video/mp4,video/webm)renderStill()returns correct MIME types (e.g.image/png,image/jpeg)application/octet-streamfor unknown extensions🤖 Generated with Claude Code