Open nahkd123 opened 4 years ago
You can pass the Blob
from convertToBlob()
to FileReader
or FileReaderSync
readAsDataURL()
, then pass the data URL
to addFrame()
(async _ => {
const osc = new OffscreenCanvas(1,1);
const osctx = osc.getContext('2d');
const blob = await osc.convertToBlob({type:'image/webp'});
const frs = new FileReaderSync();
const canvas = frs.readAsDataURL(blob);
videoWriter.addFrame(canvas);
})();
I use the WebMWriter
with an OffscreenCanvas
inside a WebWorker
and came across the exception:
Failed to find VP8 keyframe in WebP image, is this image mistakenly encoded in the Lossless WebP format?
To solve the issue I changed the quality
of the conversion to
const blob = await osc.convertToBlob({type:'image/webp', quality: 0.9999});
It would be nice if webm writer support
OffscreenCanvas
, because I'm trying to do render stuffs inside web worker. As far I know, you can get the WebP blob by usingOffscreenCanvas#convertToBlob({type: "image/webp"})