thenickdude / webm-writer-js

JavaScript-based WebM video encoder for Google Chrome
272 stars 43 forks source link

Cannot read property 'getImageData' of null #27

Open romarybi opened 3 years ago

romarybi commented 3 years ago

The writer works fine until I pass the transparent: true prop. With it, I get an error Uncaught (in promise) TypeError: Cannot read property 'getImageData' of null here

I'm using a three.js canvas with an alpha property. There shouldn't be a problem with it since I am able to take transparent images of the canvas manually. Any help?

thenickdude commented 3 years ago

Can you post a little sample app that reproduce it?

Did you see the note about the limitations of the opacity range in the output of webm-writer? It'll only be useful for niche applications I think.

mishagrin commented 2 years ago

Same here, and also with Threejs

I capture main renderer canvas. Everything works fine until i set transparent: true. Dunno what cause the problem.

A tried to disable premultipliedAlpha property from WebGLRenderer. Tried to setClearColor() directly to WebGLRenderer, changed background color from completely transparent to half-transparent. Always got same error as @romarybi Uncaught (in promise) TypeError: Cannot read property 'getImageData' of null

Sorry, but unfortunately i can't show you app example. It's project from my job.

@thenickdude Any suggestions? Maybe i could do some tests to find out the problem, if you willing to help.

thenickdude commented 2 years ago

Make a minimal test case that reproduces it, I'm not building a three.js project from scratch so that I can investigate.

thenickdude commented 2 years ago

And before you even bother, make sure you understand the restrictions that prevent the resulting video being either fully opaque or fully transparent, which makes this feature pretty close to useless.