Skip to main content
Deno 2 is finally here 🎉️
Learn more

createWebMFromFrames.js

Creates a WebM video from a series of frames using the new WebCodecs API.

import createWebMFromFrames from "https://deno.land/x/create_webm_from_frames@v0.0.4/mod.js";

let fileHandle = await window.showSaveFilePicker({
  startIn: 'videos',
  suggestedName: 'myVideo.webm',
  types: [{
    description: 'Video File',
    accept: {'video/webm' :['.webm']},
  }],
});

let fileWritableStream = await fileHandle.createWritable();

let webm = createWebMFromFrames(fileWritableStream, {width:config.codedWidth, height:config.codedHeight, bitrate:10e6});

webm.addFrame(frame1);
webm.addFrame(frame2);

await webm.save();