VideoRecorder class causes FPS drop, fails to dispose properly

Creating the VideoRecorder class creates a noticeable FPS drop

var recorder = new VideoRecorder(engine, { fps: 30, recordChunckSize: 3000, mimeType: “video/webm;codecs=h264” });

Then recorder.dispose() does not clear properly, and the FPS drop remains.

In fact, recorder.dispose() then creating another recorder stacks the FPS drops i.e. causing the FPS to drop more and more on each new recorder instantiation

I am not able to experience this locally at all, I suspect you could go in sofware mode for video envoding or you have another issue :slight_smile:

Could you create a repro in the playground ?

Could you try this mime type ? video/webm;codecs=vp8

vp8 has really bad compression, which creates a ton of artifacts in the rendered output video. h264 is much better

Here’s a super simple PG

https://playground.babylonjs.com/#2TNRDB

The FPS tanks to 25 on my system and never recovers. If you don’t notice it because your system is more performance, could try changing i < 100 or something, maybe that’ll be quite evident

EDIT: WEIRD, if I open or resize the console debugger tools (F12), it goes back to 60 FPS?

The thing is here you are not even recording so you are only creating some pretty heavy Garbage collect from creating and disposing MediaRecorder.

You could do the same by instantiating big Arrays. At a first glance it is not a babylon issue.