ccapture.js icon indicating copy to clipboard operation
ccapture.js copied to clipboard

Webm capture corrupted by enabled alpha in THREE.js

Open vaneenige opened this issue 8 years ago • 7 comments

Capturing with format set to Webm causes the file to be corrupt on export when the alpha of the canvas is set to true.

With the latest version THREE.js (v82) and THREE.WebGLRenderer({ alpha: false }) it works totally fine! With alpha set to true and format set to png the export does actually work.

vaneenige avatar Jan 07 '17 12:01 vaneenige

Corrupt as in can't be played, or as in it plays but there are glitches and artifacts?

WebM doesn't support transparency, I don't think the conversion from alpha-enabled canvas to webm frame is defined, so the glitchy playback would be the expected result.

Related: https://github.com/spite/ccapture.js/issues/18

spite avatar Jan 07 '17 12:01 spite

Corrupt as in can't be played. The problem wasn't directly obvious to me but when I saw the PNG working with transparency I knew it had to do with the alpha. Might this be added to the documentation to let the user know it wouldn't work?

vaneenige avatar Jan 07 '17 12:01 vaneenige

Same here. I'm trying to capture an animation created with Babylon.js and using an alpha channel background. The result is a corrupted webm file.

devotionsolutions avatar Jan 11 '17 14:01 devotionsolutions

WebM doesn't support transparency

Are you sure?

mrdoob avatar Jan 12 '17 00:01 mrdoob

May be it does now. What's for sure is that the library that I'm using to encode WebPs into a WebM doesn't support it -and it doesn't look like it will: https://github.com/antimatter15/whammy/issues/7

Previously if you tried to save a video with transparent background, the background would be solid white, or have glitches. I don't know what's changed to make the videos not playable.

I'm still looking into the issue, may be I'll try another encoder (like https://github.com/Kagami/webm.js)

spite avatar Jan 12 '17 00:01 spite

WebM supported an alpha channel mid 2013 already: https://developers.google.com/web/updates/2013/07/Alpha-transparency-in-Chrome-video

Simran-B avatar May 09 '19 18:05 Simran-B

People who still have this problem should try the library: https://github.com/thenickdude/webm-writer-js

bmarotta avatar Jul 27 '20 10:07 bmarotta