Skip to content

🎥 Make videos programmatically with React

`@remotion/renderer`: Fix Lambda stills of >8192px

Jonny Burgereb9c15683185
diff --git a/packages/renderer/src/screenshot-task.ts b/packages/renderer/src/screenshot-task.ts
index 693fd6fd42..4506a348b3 100644
--- a/packages/renderer/src/screenshot-task.ts
+++ b/packages/renderer/src/screenshot-task.ts
@@ -62,7 +62,11 @@ export const screenshotTask = async ({
// To be determined: Is this a problem with Lambda, or the Chrome version
// we are using on Lambda?
// We already found out that the problem is not a general Linux problem.
- const fromSurface = !process.env.DISABLE_FROM_SURFACE;
+
+ // However, if `fromSurface` is false, the screenshot is limited to 8192x8192 pixels.
+ // If the image is larger, always use `fromSurface: true`.
+ const fromSurface =
+ !process.env.DISABLE_FROM_SURFACE || height > 8192 || width > 8192;
const scaleFactor = fromSurface ? 1 : scale;
const {value} = await client.send('Page.captureScreenshot', {