MZ How to convert blob to playable video format?

FINAL UPDATE:
Seems like the missing component to getting all of this working was passing the blob created by WebM-Writer into a reader that reads as DataURL rather than using the blob to createObjectURL.
The dataURL could then be split at 'base64' which would then allow fs.writefile to create the webm file with base64 encoding. The result is a video that is stored and can be played when needed, rather than have the video stored temporarily in memory. The creation of these videos is unfortunately not asynchronous, so will have to be done during a loading screen and obviously the time this takes will increase with each video created. But I shall investigate further to see if this is a viable way of making battles a little more dynamic. I might create a tutorial/plugin if it does turn out to be useful and if anyone is interested.


UPDATE (Original Post in the spoiler below):

So I've now managed to actually encode a webp image into a webm video using a different set of scripts. Whammy has been replaced with WebMWriter. This gives me a blob that can be played as a video after using URL.createObjectURL(blob). Now the issue is getting it to write to disk in the correct format. It seems that WebMWriter has a built-in method for doing this, so once I can figure out how to correctly do this, I will update one last time with my fully functional code.

Spoiler
Hi, I'm still learning the ropes of Javascript and making plugins so this probably isn't exactly possible but I thought I might ask. It's also entirely possible that none of what I've written in code is doing what I think it's doing. Essentially, I was wondering if there was a way to convert a binary large object (BLOB.) into a webm that Rpg Maker Mz can play via script/plugin. I've downloaded a script called whammy.js which is a realtime Javascript webm encoder. I put that in js/libs and import via RMMZ's main.js script. I then create a new plugin script with a function that an event can call from the editor (CreateVideo()). This function uses an XMLHttpRequest to convert a webp image into a dataURL that whammy can use to create a video (I've just tried it with one single image for now just to test out the concept). Whammy returns a compiled video in the form of a blob (video/webm) which I then convert into an objectURL but this cannot be played using RMMZ's video.play() function. I've also tried playing the "output" variable before converting and it doesn't like that either. I was trying to find a way to save the blob as a webm file in the local movies directory as I thought I might have more luck getting it to work that way but can't figure out how to do that either. The main aim behind all of this is to try and have some videos of actor animations play during battles but I wanted the battle backgrounds to change depending on where the battle takes place (as a starting point, maybe even more variation if I could get it working). Thus avoiding having loads of premade video files. Any help on this would be appreciated, maybe it's just a mad idea that I can avoid wasting any more time on or maybe there's a much easier way of doing this. Just ask if there's any other information I need to include that might help. I've got console output of the blob objects if it helps or the error message that displays when trying to play the video, they just didn't seem very informative.
JavaScript:
 CreateVideo = function () {                  var xhr = new XMLHttpRequest();          xhr.open("GET", "img/webP/Road3.webp", true);          xhr.responseType = "blob";          xhr.onload = function (e) {              console.log(this.response);              var reader = new FileReader();              reader.onload = function (event) {                  var res = event.target.result;                                  var recorder = new Whammy.Video(0.8, 100);                  recorder.add(res);                  var output = recorder.compile();                  console.log(output);                  var url = webkitURL.createObjectURL(output);                  //Video.play(url);                                  //Video.play(output);                              }              var file = this.response;              reader.readAsDataURL(file)          };          xhr.send()
Edit: So after messing around with importing a webm, reading it as a dataURL and then passing that dataURL to a file writer, I am able to save that webm as a readable video. So I can only assume that I'm doing something wrong when encoding & compiling the video with whammy.js. Will mess around some more and see how this develops.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-convert-blob-to-playable-video-format.126728/