{"record":{"id":"ed82c3c9824a84df","repo":"remotion-dev/remotion","slug":"the-encoded-frame-would-be-outputsize-width-o","errorCode":null,"errorMessage":"The encoded frame would be ${outputSize.width}×${outputSize.height} pixels at ${scale}× scale; its maximum even side is ${maxEncodedDimension.toLocaleString()} pixels. Reduce the scale or select a smaller area.","messagePattern":"The encoded frame would be (.+?)×(.+?) pixels at (.+?)× scale; its maximum even side is (.+?) pixels\\. Reduce the scale or select a smaller area\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/canvas-capture-extension/src/capture.ts","lineNumber":109,"sourceCode":"\t\t1,\n\t\tMath.round(height * window.devicePixelRatio),\n\t);\n\tconst outputSize = getScaledCanvasSize(\n\t\tresolvedCrop.width,\n\t\tresolvedCrop.height,\n\t\tscale,\n\t);\n\tif (displayWidth > maxCanvasDimension || displayHeight > maxCanvasDimension) {\n\t\tthrow new Error(\n\t\t\t`The display canvas would be ${displayWidth}×${displayHeight} pixels; its maximum side is ${maxCanvasDimension.toLocaleString()} pixels.`,\n\t\t);\n\t}\n\n\tif (\n\t\toutputSize.width > maxEncodedDimension ||\n\t\toutputSize.height > maxEncodedDimension\n\t) {\n\t\tthrow new Error(\n\t\t\t`The encoded frame would be ${outputSize.width}×${outputSize.height} pixels at ${scale}× scale; its maximum even side is ${maxEncodedDimension.toLocaleString()} pixels. Reduce the scale or select a smaller area.`,\n\t\t);\n\t}\n\n\treturn outputSize;\n};\n\nexport const getCapturePreflight = ({\n\tscale,\n\tcrop,\n}: {\n\treadonly scale: number;\n\treadonly crop: CaptureCrop | null;\n}): CapturePreflight => {\n\tconst sourceSize = getWholePageSize();\n\treturn {\n\t\tsourceSize,\n\t\toutputSize: validateCaptureSize({","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/canvas-capture-extension/src/capture.ts#L91-L127","documentation":"Even when the display canvas fits, Canvas Capture scales the crop region by `scale` to get the encoded frame size and rejects if either side exceeds the encoder's maximum even dimension. The encoder requires even dimensions and has a hard cap, so a large crop multiplied by a high scale factor trips this check in validateCaptureSize.","triggerScenarios":"Using a scale > 1 on a crop that is already near the encoder limit; scale = 2 doubling a large region past the max even side; selecting a wide/tall area and requesting a high scale.","commonSituations":"Requesting 2x/3x scale on a 1080p+ region; exporting high-DPI crops of large areas; defaulting to a high scale factor without accounting for crop size.","solutions":["Reduce the scale factor (e.g. from 2x to 1x).","Select a smaller crop area so the scaled dimensions stay under the encoder cap.","Compute scale dynamically from the crop size to stay within limits.","Prefer 1x scale for full-page captures and reserve higher scales for small regions."],"exampleFix":"// before\ngetCapturePreflight({scale: 3, crop: {left: 0, top: 0, width: 1920, height: 1080}});\n\n// after\ngetCapturePreflight({scale: 1, crop: {left: 0, top: 0, width: 1920, height: 1080}});","handlingStrategy":"validation","validationCode":"const MAX_ENCODED = 4096; // platform encoder max even side\nconst encodedFits = (cropW: number, cropH: number, scale: number) => {\n  const w = Math.round(cropW * scale);\n  const h = Math.round(cropH * scale);\n  return w <= MAX_ENCODED && h <= MAX_ENCODED && w % 2 === 0 && h % 2 === 0;\n};\n// pick the highest scale that fits:\nconst safeScale = pickScale(cropW, cropH, MAX_ENCODED);","typeGuard":null,"tryCatchPattern":"try {\n  getCapturePreflight({scale, crop});\n} catch (err) {\n  if (String(err?.message ?? '').startsWith('The encoded frame would be')) {\n    // reduce scale or shrink crop, then retry\n  } else throw err;\n}","preventionTips":["Compute scale from crop size so scaled dimensions stay under the encoder cap.","Prefer 1x scale for large regions; use higher scales only for small crops.","Ensure encoded dimensions are even (encoder requirement).","Show users the max even side so they pick a valid combination."],"tags":["canvas-capture","encoder","size-limits","scale"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}