Save output of Babylon.VideoRecorder as Mov/MP4

Hello, I am having trouble with the output of the BABYLON.VideoRecorder. The default of the function “startRecording()” is to download a webm file on completion of recording the Babylon scene. I would like the recording as a more accessible file type though, preferably mp4 or mov. As you can see in the playground linked below, you can use a .then() to access a blob containing the data, but I have been unable to figure out how to use it correctly and download what I want. Any help would be greatly appreciated, thanks!


Also - this is less important but would also be great to know - I cannot stop the recording when I want and still have access to the data. Right now - you have to tell videoRecorder.startRecording() how long to record for, and using the stopRecording() function when clicked by a button simply stops recording and does not save it at all. This is less important but would still be great to know, thanks!

Adding @sebavan

mp4 are unfortunately not supported by all browsers so it is why we default to webm which has a better support to record.

from the blob you could simply do that to download:

Yup you would provide the max duration to prevent a memory explosion but can still force stop early if wished:

1 Like

Thanks. Do you know of any way to convert a webm file to mp4 or mov though? I would either like to save it directly as a mp4 from the blob or convert the webm to mp4/mov.

You could use ffmpeg ??? there is a wasm version I guess :slight_smile:

Here is ready solution with ffmpeg.wasm - Save canvas data as mp4 - Javascript - Stack Overflow