在 Node 中使用需额外安装 etro-node 包装器;离线渲染尚未支持,目前只能实时渲染为 blob;音频效果标注为即将推出,尚不可用
浏览器端用 TypeScript 编程剪辑视频的库,通过图层合成和滤镜实现视频编辑
用 TypeScript 写的浏览器端视频剪辑库,能在网页里直接合成、剪辑视频和音频,省去服务端转码的麻烦。
核心能力
- 合成视频、音频、文本、图像图层
- 内置硬件加速的 GLSL 滤镜效果
- 支持用 JavaScript 和 GLSL 自定义效果
- 图层与效果参数支持关键帧或函数
- 会话可序列化为 JSON 并反序列化恢复
容易踩的坑
- v0.14.1最新正式版2026-08-12 · 2026-08-12 06:05 UTC
Fixed
- Visual layers' canvases are now only resized when needed (#362 by @suhailopensource).
- Transform effects no longer leave a trail when moving layers (#363 by @suhailopensource).
- v0.14.02026-06-06 · 2026-06-06 05:52 UTC
查看更新说明
0.14.0 - 2026-06-06
Added
- Movie serialization and deserialization (#340 by @G3RRYGL3Z).
Changed
- Bump rollup-plugin-typescript2 to 0.37.0.
- Bump karma to 6.4.4.
Security
- v0.13.02026-03-18 · 2026-03-18 02:38 UTC
查看更新说明
0.13.0 - 2026-03-18
Added
Movie#play()optiononDraw()(#266).
Changed
- The type for
KeyFrame.valuehas been updated fromunknown[][]to(number|T|Interpolate)[][](#259).
Fixed
- Shader effects producing solid black output in browsers whose GLSL linker does not assign
a_VertexPositionto attribute location 0 (e.g., Firefox on macOS).
Security
- Bump ejs from 3.1.8 to 3.1.10 (#271).
- Bump follow-redirects from 1.15.4 to 1.15.6 (#267).
- Bump braces from 3.0.2 to 3.0.3 (#274).
- Bump socket.io from 4.6.1 to 4.7.5 (#277).
- Bump js-yaml from 4.1.0 to 4.1.1 (#309).
- Bump @rollup/plugin-eslint from 8.0.2 to 9.2.0 (#309).
- Bump validator from 13.11.0 to 13.15.20 (#308).
- Bump pbkdf2 from 3.1.2 to 3.1.5 (#307).
- Bump cipher-base from 1.0.4 to 1.0.6 (#305).
- Bump rollup from 1.32.1 to 2.79.2 (#300).
- Bump elliptic from 6.5.4 to 6.6.1 (#299).
- Bump ws, socket.io-adapter (#281).
- Bump cookie, socket.io (#283).
- Bump body-parser from 1.20.1 to 1.20.3 (#285).
- Bump shipjs from 0.26.3 to 0.27.0 (#314).
- Bump basic-ftp from 5.0.4 to 5.2.0 (#320).
- v0.12.12024-02-19 · 2024-02-19 17:07 UTC
查看更新说明
[0.12.1] - 2024-02-19
Fixed
- Importing etro in the client-side code of a NextJS project causing a "module not found" error (#243).
- Keyframes with values that are not numbers no longer result in type mismatches.
TypeError: this.data is undefinedwhen applying aTransformeffect with a dynamic matrix.
- v0.12.02024-01-15 · 2024-01-15 21:20 UTC
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Etro
Etro is a framework-agnostic TypeScript library for programmatically editing videos. It lets you composite layers and add filters. Etro includes text, video, audio and image layers, along with a variety of GLSL filters. You can also define your own layers and filters with TypeScript and GLSL.
Features
- Composite video and audio layers
- Use built-in hardware accelerated effects
- Write your own effects in JavaScript and GLSL
- Manipulate audio with the web audio API (audio effects coming soon)
- Define layer and effect parameters as keyframes or custom functions
- Render to a blob in realtime (offline rendering coming soon)
- Serialize session to JSON and deserialize it back
- UI framework agnostic
Installation
npm i etro
Basic Usage
Let's look at an example:
import etro from 'etro'
var movie = new etro.Movie({ canvas: outputCanvas })
var layer = new etro.layer.Video({ startTime: 0, source: videoElement }) // the layer starts at 0s
movie.addLayer(layer)
movie.record({ frameRate: 24 }) // or just `play` if you don't need to save it
.then(blob => ...)
The blob could then be downloaded as a video file or displayed using a <video>
element.
See the documentation for a list of all built-in layers.
Effects
Effects can transform the output of a layer or movie:
var layer = new etro.layer.Video({ startTime: 0, source: videoElement })
.addEffect(new etro.effect.Brightness({ brightness: +100) }))
See the documentation for a list of all built-in effects.
Dynamic Properties
Most properties also support keyframes and functions:
// Keyframes
layer.effects[0].brightness = new etro.KeyFrame(
[0, -75], // brightness == -75 at 0 seconds
[2, +75] // +75 at 2 seconds
)
// Function
layer.effects[0].brightness = () => 100 * Math.random() - 50
See the documentation for more info.
Using in Node
To use Etro in Node, see the wrapper:
Running the Examples
Start the development server (used for convenience during development; Etro does not require a server):
npm i
npm run build
npm start
Now you can open any example (such as http://127.0.0.1:8080/examples/introduction/hello-world1.html).
Further Reading
Contributing
See the contributing guide
License
Distributed under GNU General Public License v3. See LICENSE for more information.