@diffusionstudio/core

中文文档
4.0.3发布于 2025/12/01MPL-2.0TypeScriptES Module近 30 天下载 5530

A fast, browser based video compositing engine powered by WebCodecs

原始使用文档
文档目录18 节
  1. Documentation
  2. Getting Started
  3. Features
  4. Concatenate two videos
  5. Apply basic transitions
  6. Mask an image
  7. Animate your clips with key frames
  8. Add basic effects to visual clips
  9. Required Headers
  10. Pricing
  11. FAQ
  12. Do I have to renew the license key?
  13. What happens if the license server is down?
  14. What if I lose my key?
  15. What are the limitations of the key?
  16. When to use Diffusion Studio Core
  17. When not to use Diffusion Studio Core
  18. How it works

The video engine for your timeline

Diffusion Studio Core is a browser based video engine built in TypeScript for fast media composition. Think of it like a game engine that is optimized for video, audio and image workloads. It supports both interactive playback for editing and a high fidelity rendering mode for final output. Developers often use it to build non linear editors or other timeline based media applications (e.g. Diffusion Studio Pro). Under the hood it takes advantage of Canvas2DContext and the WebCodecs API to tap directly into hardware accelerated processing in the browser.

https://github.com/user-attachments/assets/3878f293-ab1b-4bb1-8088-b9493546180a

Documentation

Visit the Docs for comprehensive guides

Getting Started

npm install @diffusionstudio/core

Recommended usage:

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

const composition = new core.Composition();

Features

A few highlights: declarative timeline compositions, layering, splitting, shapes, captions, rich text, silence removal, effects, transitions, keyframing, bounding boxes, masking, audio ramps, font management, checkpoints, realtime playback and hardware accelerated rendering.

Let’s look at some of these in action.

Concatenate two videos

const sources = await Promise.all([
  core.Source.from<core.VideoSource>('/intro.webm'),
  core.Source.from<core.VideoSource>('/outro.mp4'),
]);

const layer = await composition.add(
  new core.Layer({
    mode: 'SEQUENTIAL'
  })
);

await layer.add(
  new core.VideoClip(sources[0], {
    range: [2, 8],
  })
);

await layer.add(
  new core.VideoClip(sources[1], {
    range: [2, 12],
  })
);

Apply basic transitions

new core.VideoClip(/** source **/, {
  transition: {
    duration: 1,
    type: 'dissolve',
  }
})

Mask an image

const mask = new core.RectangleMask({
  width: 640,
  height: 1080,
  radius: 100,
});

new core.ImageClip(/** source **/, { mask });

Animate your clips with key frames

new core.TextClip({
  text: "Hello World",
  align: 'center',
  baseline: 'middle',
  position: 'center',
  animations: [
    {
      key: 'rotation',
      frames: [
        { time: 0, value: 0 },
        { time: 2, value: 720 },
      ],
    },
  ]
});

Add basic effects to visual clips

new core.RectangleClip({
  position: 'center',
  delay: 6,
  duration: 4,
  effects: [
    {
      type: 'blur',
      value: 10,
    },
    {
      type: 'hue-rotate',
      value: 90
    }
  ]
})

Required Headers

Diffusion Studio Core requires specific HTTP headers to be set for proper operation. These headers enable the use of SharedArrayBuffer and other advanced browser APIs needed for video processing.

The following headers are required:

  • Cross-Origin-Opener-Policy: same-origin
  • Cross-Origin-Embedder-Policy: credentialless

Pricing

You can use the engine for free as long as you keep the "Made with Diffusion Studio" watermark on the rendered video. To remove the watermark, you can purchase a license key.

FAQ

Do I have to renew the license key?

No. It’s a one time purchase and your key stays valid forever.

What happens if the license server is down?

There is no license server. Your key is a signed payload created with our private key. The library includes a public key that verifies it locally so it works even without an internet connection.

What if I lose my key?

We can regenerate it any time. Just email contact |at| diffusion.studio.

What are the limitations of the key?

You can’t share your key with other organizations. Other than that, feel free to use it across as many of your own apps or domains as you need.

When to use Diffusion Studio Core

  • You’re building a timeline based application such as an NLE that needs to render video in the browser
  • Your app needs to compose multiple assets into a video or audio output
  • You want a framework agnostic and efficient video engine that works with Svelte, Vue, Solid, Angular and others

When not to use Diffusion Studio Core

  • You need to render videos server side
    • Use Remotion
  • You want to compose videos with HTML or React
    • Use Remotion
  • You want a framework that already includes frontend components like a timeline or inspector
  • You need low level encoding, decoding, muxing, demuxing or transcoding capabilities
    • Use Mediabunny

How it works

Diffusion Studio Core is written in TypeScript and built on top of Mediabunny (Sponsoring is welcome!). The architecture is inspired by Pixi.js but built from scratch, optimized for media processing. Decoding and encoding are performed using the WebCodecs API, which taps into your system's hardware acceleration. Decoded frames are then painted using the Canvas 2D Context API. Nearly all features of the Canvas 2D API are available in Diffusion Studio Core.

版本与发布记录

@diffusionstudio/core 共发布 70 个版本,首次发布于 2024/08/13;过去 12 个月发布了 4 个版本。

版本发布日期距今
4.0.3latest2025/12/0111 个月前
4.0.22025/11/2611 个月前
4.0.12025/11/2011 个月前
4.0.02025/11/1911 个月前
3.8.32025/05/301.5 年前
3.8.22025/05/131.5 年前

关于 @diffusionstudio/core 的常见问题

@diffusionstudio/core 是什么?

A fast, browser based video compositing engine powered by WebCodecs

如何安装 @diffusionstudio/core?

在项目目录运行 npm install @diffusionstudio/core,或使用 pnpm add / yarn add / bun add。

@diffusionstudio/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@diffusionstudio/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@diffusionstudio/core 可以商用吗?

@diffusionstudio/core 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@diffusionstudio/core 的下载量有多少?

根据 npm 官方下载统计,@diffusionstudio/core 在 2026/10/12 – 2026/11/10 这 30 天内被下载 5,530 次,日均约 184 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@diffusionstudio/core 还在维护吗?

最新版本 4.0.3 发布于 2025/12/01(11 个月前);至今共发布 70 个版本,其中过去 12 个月发布了 4 个;首次发布于 2024/08/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。