Skip to main content

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.1/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 = createWebM(fileWritableStream, {width:config.codedWidth, height:config.codedHeight, bitrate:10e6});

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

webm.save();