npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

framekit

v0.0.2

Published

Frames into Videos in the Browser

Downloads

1

Readme

framekit

framekit is a modular tool to convert frames into videos. It supports inputting canvases and screens and can output WebM videos (for some browsers). More outputs can be possible through plugins.

framekit is in very early stages of development. There may be significant changes in newer versions that may break existing APIs.

Installing

In Browser

framekit is meant to be used in browser. It can be included through a script tag in browser through a CDN:

<script src="https://unpkg.com/[email protected]/dist/framekit.js"></script>

Or if locally downloaded:

<script src="path/to/dist/framekit.js"></script>

In Node

If using a bundler, from the command-line:

npm install --save-dev framekit

Then in your files:

import framekit from 'framekit';

Basic Usage

Capturing a canvas element with the id canvas-id, for 300 frames:

(async function () {
  var canvas = document.querySelector('#canvas-id');
  var kit = await framekit({
    fps: 30, // output frame rate
    output: 'webm'
  });
  for (let i = 0; i < 300; i++) {
    // do something to update/render the canvas
    // ...
    await kit.addFrame(canvas);
  }
  var blob = await kit.finish();
  // do something with the blob
})()

Limitations - Inputs

Screen Capturing Limitations

Screen capturing is done via getDisplayMedia, which has certain limitations:

  • Requires the user to select and approve capturing of the current window
  • Limited to Frame Rate, so faster-than-real-time capturing at the same frame rate is not possible.
  • Cursors appear when moved, because no browser seems to support the cursor constraint property for getDisplayMedia.

Limitations - Output

WebCodecs Limitations

The WebCodecs API offers access to video encoding that is faster and/or produces smaller videos than other in-browser solutions. It is only supported by Chromium based browsers (Chrome, Edge, etc.).

Depending on the codec, and the client's hardware and platform, trying to use hardware acceleration may result in an error.

WebM Video Limitations

framekit can directly encode WebM video (by using the WebMWriter library). Directly encoding video requires using a browser that can convert canvases to WebP images, which currently is only Firefox and Chromium-based browsers (Chrome, Edge, etc.).

framekit can also use WebMWriter as a muxer with webcodecs, which has the same limitations as those found in the webcodecs limitations sections.

Directly encoding frames with WebMWriter will generally be slower and create larger files than using WebCodecs with WebMWriter as a muxer. Using output: 'webm' will use WebCodecs if possible.

Bundled Libraries

dist/framekit.js bundles webm-writer-esm, a version of webm-writer-js modified to support WebCodecs.