Merge pull request #281 from GuilhermeFaga/main

fix(#264): read raw pixels from canvas for VideoFrame to avoid silent failures on Linux
This commit is contained in:
Sid
2026-04-03 22:50:15 -07:00
committed by GitHub
+10 -2
View File
@@ -232,8 +232,16 @@ export class VideoExporter {
const canvas = renderer.getCanvas();
// @ts-expect-error - colorSpace is available at runtime even if TS does not know it.
const exportFrame = new VideoFrame(canvas, {
// Read raw pixels from the canvas instead of passing
// the canvas directly to VideoFrame. On some Linux
// systems the GPU shared-image path (EGL/Ozone) fails
// silently, producing empty frames.
const canvasCtx = canvas.getContext("2d")!;
const imageData = canvasCtx.getImageData(0, 0, canvas.width, canvas.height);
const exportFrame = new VideoFrame(imageData.data.buffer, {
format: "RGBA",
codedWidth: canvas.width,
codedHeight: canvas.height,
timestamp,
duration: frameDuration,
colorSpace: {