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

@diffusionstudio/core

v1.6.0

Published

Build bleeding edge video processing applications

Downloads

1,240

Readme

Getting Started

@diffusionstudio/core is an open-source, browser-based video editing library that allows developers to automate video editing workflows at scale, build custom editing applications, or seamlessly integrate video processing capabilities into existing projects.

Documentation

Visit https://docs.diffusion.studio to view the full documentation.

Why Use Diffusion Studio

💻 100% client-side 📦 Fully extensible with Pixi.js 🩸 Blazingly fast WebGPU/WebGL renderer 🏎️ Cutting edge WebCodecs export

Getting Started

npm install @diffusionstudio/core

Basic Usage

Let's take a look at an example:

import * as core from '@diffusionstudio/core';

const source = await core.VideoSource // convenience function for fetch -> blob -> file
  .from('https://diffusion-studio-public.s3.eu-central-1.amazonaws.com/videos/big_buck_bunny_1080p_30fps.mp4');

// create a video clip and trim it
const video = new core.VideoClip(source) // compatible with the File API
  .subclip(0, 160); // The base unit is frames at 30 FPS

// create a text clip and add styles
const text = new core.TextClip({ 
  text: 'Bunny - Our Brave Hero', 
  position: 'center', 
  stop: 80, 
  stroke: { color: '#000000' } 
});

const composition = new core.Composition(); // 1920x1080

// this is how to compose your clips
await composition.add(video);  // convenience function for 
await composition.add(text);   // clip -> track -> composition

// render video using webcodecs at 25 FPS
// use resolution: 2 to render at 4k 
new core.Encoder(composition, { fps: 25 }).render();

This may look familiar to some. That is because the API is heavily inspired by Moviepy and Swift UI. It models the structure of popular video editing applications such as Adobe Premiere or CapCut. The current state can be visualized as follows:

Composition Visulization

Whereas each track contains zero or more clips of a single type in ascending chronological order.

A track will be created implicitly with composition.add(clip) however you can also create them manually like this:

const track = composition.createTrack('text');
await track.add(text0);
await track.add(text1);
await track.add(text2);
...

Examples

You can find more examples here., or give them a whirl on: https://examples.diffusion.studio

https://github.com/user-attachments/assets/7a943407-e916-4d9f-b46a-3163dbff44c3

How does DS Core compare to Remotion and Motion Canvas?

Remotion is a React-based video creation tool that transforms the entire DOM into videos. It's particularly suited for beginners, as web developers can start creating videos using the skills they already have.

Motion Canvas is intended as a standalone editor for creating production-quality animations. It features a unique imperative API that adds elements to the timeline procedurally, rather than relying on keyframes like traditional video editing tools. This makes Motion Canvas ideal for crafting detailed, animated videos.

In contrast, Diffusion Studio is not a framework with a visual editing interface but a video editing library that can be integrated into existing projects. It operates entirely on the client-side, eliminating the need for additional backend infrastructure. Diffusion Studio is also dedicated to supporting the latest rendering technologies, including WebGPU, WebGL, and WebCodecs. If a feature you need isn't available, you can easily extend it using Pixi.js.

Current features

  • Video/Audio trim and offset
  • Tracks & Layering
  • Splitting clips
  • Html & Image rendering
  • Text with multiple styles
  • Web & Local Fonts
  • Custom Clips based on Pixi.js
  • Filters
  • Keyframe animations
    • Numbers, Degrees and Colors
    • Easing (easeIn, easeOut etc.)
    • Extrapolation 'clamp' | 'extend'
  • Realtime playback
  • Hardware accelerated encoding via WebCodecs
  • Dynamic render resolution and framerate

Contributing

Contributions to DS Core are welcome and highly appreciated. Simply fork this respository and run:

npm install

Before checking in a pull request please verify that all unit tests are still green by running:

npm run test

Background

This project began in March 2023 with the mission of creating the "video processing toolkit for the era of AI." As someone passionate about video editing for over a decade, I saw Chrome’s release of Webcodecs and WebGPU without a feature flag as the perfect moment to build something new.

Currently, most browser-based video editors rely on server-side rendering, requiring time-consuming uploads and downloads of large video files. With Webcodecs, video processing can now be handled directly in the browser, making it faster and more efficient.

I’m excited to be part of the next generation of video editing technology.

Compatability

✅ Supported 🧪 Experimental ❌ Not supported

Desktop

| Browser | | Operating System | | | ----------------- | -- | ----------------- | -- | | Chrome | ✅ | Windows | ✅ | | Edge | ✅ | Macos | ✅ | | Firefox | ✅ | Linux | ✅ | | Safari | ✅ | | Opera | ✅ | | Brave | ✅ | | Vivaldi | ✅ |

Mobile

| Browser | | Operating System | | | ----------------- | -- | ----------------- | -- | | Brave Android | ✅ | Android | ✅ | | Chrome Android | ✅ | iOS | 🧪 | | Firefox Android | 🧪 | | Opera Android | ✅ | | Safari iOS | 🧪 |

| | Demultiplexing | Multiplexing | | ----------- | -------------- | -------------| | Mp4 | ✅ | ✅ | | Webm | ✅ | ❌ | | Mov | ✅ | ❌ | | Mkv | ❌ | ❌ | | Avi | ❌ | ❌ |

| | Decoding | Encoding | | ----------- | -------- | ----------------- | | Avc1 | ✅ | ✅ | | AAC | ✅ | ✅ (Chromium only)| | Opus | ✅ | ✅ | | Wav | ✅ | ✅ | | Hevc | ✅ | ❌ | | VP9 | ✅ | ❌ | | VP8 | ✅ | ❌ | | Mp3 | ✅ | ❌ | | Ogg | ✅ | ❌ |