{"record":{"id":"c0d24695cde6638d","repo":"remotion-dev/remotion","slug":"label-encoding-is-not-supported-at-size-width","errorCode":null,"errorMessage":"${label} encoding is not supported at ${size.width}×${size.height} in this browser. Reduce the scale or select a smaller area.","messagePattern":"(.+?) encoding is not supported at (.+?)×(.+?) in this browser\\. Reduce the scale or select a smaller area\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/canvas-capture-extension/src/recorder.ts","lineNumber":208,"sourceCode":") => {\n\tconst {canEncodeVideo, QUALITY_HIGH} = await import('mediabunny');\n\treturn canEncodeVideo(format === 'mp4' ? 'avc' : 'vp9', {\n\t\twidth,\n\t\theight,\n\t\t...getVideoEncodingOptions(QUALITY_HIGH),\n\t});\n};\n\nexport const assertCanEncodeCapture = async (\n\tformat: CaptureFormat,\n\tsize: {readonly width: number; readonly height: number},\n) => {\n\tif (await canEncodeCapture(format, size)) {\n\t\treturn;\n\t}\n\n\tconst label = format === 'mp4' ? 'H.264 MP4' : 'VP9 WebM';\n\tthrow new Error(\n\t\t`${label} encoding is not supported at ${size.width}×${size.height} in this browser. Reduce the scale or select a smaller area.`,\n\t);\n};\n\nconst setCanvasSize = (\n\tcanvas: HTMLCanvasElement | OffscreenCanvas,\n\tscaledWidth: number,\n\tscaledHeight: number,\n) => {\n\tif (canvas.width !== scaledWidth) {\n\t\tcanvas.width = scaledWidth;\n\t}\n\n\tif (canvas.height !== scaledHeight) {\n\t\tcanvas.height = scaledHeight;\n\t}\n};\n","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/canvas-capture-extension/src/recorder.ts#L190-L226","documentation":"`assertCanEncodeCapture` delegates to `canEncodeCapture`, which calls Mediabunny's `canEncodeVideo` for 'avc' (mp4) or 'vp9' (webm) at the given width/height with realtime latency and high quality. If the codec is not encodable at that resolution in the current browser, it throws with the codec label and dimensions, advising a smaller scale/area.","triggerScenarios":"Selecting a capture size (after applying the density/scale factor) that exceeds the browser's maximum supported encode dimensions for H.264/VP9; requesting mp4 in a browser without hardware/software H.264 encode; requesting very large dimensions where WebCodecs `isConfigSupported` returns false.","commonSituations":"High-DPI capture with a large scale factor pushing effective pixels beyond codec limits (e.g. 4K+ on a retina display); browser lacks the requested encoder; VP9 max dimension limits hit on WebM.","solutions":["Reduce the density/scale factor so the effective encode dimensions fall within codec limits.","Select a smaller capture area.","Switch format (mp4 <-> webm) to find a codec the browser supports.","Call `canEncodeCapture(format, size)` yourself before starting to probe support."],"exampleFix":"// before\nawait assertCanEncodeCapture('mp4', {width: 7680, height: 4320});\n\n// after\nconst scale = await pickScaleFitting('mp4', area);\nawait assertCanEncodeCapture('mp4', scale);","handlingStrategy":"validation","validationCode":"import {canEncodeCapture} from './recorder';\nasync function pickSize(format: 'mp4'|'webm', max: {width:number;height:number}) {\n  for (const s of [max, half(max), quarter(max)]) {\n    if (await canEncodeCapture(format, s)) return s;\n  }\n  throw new Error('No supported encode size found.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await assertCanEncodeCapture(format, size);\n} catch (e) {\n  if (e instanceof Error && /encoding is not supported/.test(e.message)) {\n    size = reduceScale(size);\n    await assertCanEncodeCapture(format, size);\n  } else throw e;\n}","preventionTips":["Probe canEncodeCapture before starting capture.","Cap the density/scale factor for high-DPI displays.","Offer a format fallback (mp4/webm)."],"tags":["canvas-capture","encoding","webcodecs","codec-support","dimensions"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}