# Instantiating Video Recorder lowers FPS

**URL:** <https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154>\
**Category:** Bugs\
**Tags:** documentation\
**Created:** [April 7, 2022, 6:03pm UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154 "2022-04-07T18:03:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aprowe](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aprowe/32/23408_2.png) [@aprowe](https://forum.babylonjs.com/u/aprowe)\
**Post date:** [April 7, 2022, 6:03pm UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154/1 "2022-04-07T18:03:30Z")

</div>

Hello, I recently spent hours trying to figure out why my app frame rate was low- it seemed to be around 40 even after slowly stripping my app until it was an empty scene.

Eventually I found the culprit, which was the line `new VideoRecorder(engine)`.  
I had instantiated that on scene creation, then on user event triggered event I called `startRecording`.

To fix it, I called `new VideoRecorder(engine)` when the event was triggered rather than at the top.

This may be intended but I would like to express my frustration with this design-  
I really did not expect that calling a constructor would have such drastic side effects on the rendering engine. I would have expected that would happen with “startRecording”, but not upon instantiation.

I had all my object creation at the top- creating the engine, camera, scene, and VideoRecorder, which felt like a natural design pattern within BabylonJS.

Anyway I think some alerts in the documentation would be helpful if this is intended, or having VideoRecorder only change the FPS upon recording would feel more intuitive. Since the VideoRecorder is re-usable, I don’t see why not!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 7, 2022, 6:15pm UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154/2 "2022-04-07T18:15:05Z")

</div>

adding @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 7, 2022, 7:01pm UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154/3 "2022-04-07T19:01:32Z")

</div>

What browser are you using ?

I am asking cause even if I defer the creation of the MediaRecorder and the captureStream calls, everything after would get slower which anyway should not happen. There is unfortunately no stop stream function on the canvas and I d like to report this to browser vendors to see if any workaround exist.

---

<div class="post-metadata">

**Author:** ![woniubushiniu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/woniubushiniu/32/22130_2.png) [@woniubushiniu](https://forum.babylonjs.com/u/woniubushiniu)\
**Post date:** [April 7, 2023, 2:25am UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154/4 "2023-04-07T02:25:56Z")

</div>

hello,I met the same problem, after using VideoRecorder, is there any good way to solve it?，  
if there any way to use MediaRecorder,and no low fps to webgl?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 7, 2023, 9:57pm UTC](https://forum.babylonjs.com/t/instantiating-video-recorder-lowers-fps/29154/5 "2023-04-07T21:57:08Z")

</div>

> [@aprowe](#):
>
> To fix it, I called `new VideoRecorder(engine)` when the event was triggered rather than at the top.

Did you try this ?
