Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,43 @@ OpenMotion is a high-performance, open-source alternative to Remotion. It allows
- 📹 **Offthread Video**: High-performance video decoding moved to background processes.
- 📊 **Dynamic Metadata**: Calculate video dimensions, duration, and other properties dynamically based on input props.
- 🎬 **GIF & Video Output**: Render to both MP4 video and GIF formats with automatic format detection.
- 🛡️ **Pre-Flight Checks**: Built-in validation and helpful error messages for missing dependencies.
- 🌍 **Custom Chromium Path**: Override the Chromium executable path using the `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` environment variable.
### 4. 渲染视频 (正式出片)

### Dynamic Metadata
推荐使用项目自带的 `render` 脚本进行渲染,它会自动完成 **构建 -> 启动静态服务 -> 渲染 -> 自动清理** 的全套流程,确保渲染过程极其稳健,不会因开发服务器缓冲区问题而卡死。

```bash
# 执行一键渲染 (默认输出 ./out.mp4,开启 4 线程并行)
npm run render

# 修改输出文件名或指定合成 ID (通过 -- 透传参数)
npm run render -- -o my-video.mp4 -c main
```

## 💡 最佳实践

### 稳健渲染方案
生产环境建议始终优先使用 `npm run render`。该命令内部使用了静态服务模式,彻底告别渲染卡死。

### 参数透传技巧
你可以通过 `npm run render -- [更多参数]` 覆盖脚本中的默认值:
- **修改并发数**: `npm run render -- -j 8`
- **指定 Chromium 路径**: `npm run render -- --chromium-path "/path/to/chrome"`

### 资源存放
所有本地图片/视频资源请放在 `public/` 目录下,在代码中通过 `/filename` 路径引用。

## 🎬 输出格式支持
- **.mp4**: 标准视频,包含音频。
- **.webm**: 支持透明背景的高质量视频。
- **.gif**: 动态图片,不含音频。
- **.webp**: 现代动图格式,体积更小,质量更好。

## 🛡️ 特色功能
- 🛡️ **Pre-Flight Checks**: 内置浏览器安装检查与环境验证。
- 🌍 **Custom Chromium Path**: 支持通过 `--chromium-path` 参数自定义浏览器路径。
- 🚀 **Turbo Render**: 一键自动化构建与全自动渲染链条。

## 📚 API Reference

Calculate video properties dynamically:

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-motion/cli",
"version": "0.1.1",
"version": "0.1.3",
"bin": {
"open-motion": "dist/bin.js"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const runInit = async (projectName: string) => {
dev: 'vite',
build: 'vite build',
preview: 'vite preview',
render: 'open-motion render -u http://localhost:5173 -o out.mp4'
render: 'npm run build && (npx http-server dist -p 5173 > /dev/null 2>&1 & sleep 2 && open-motion render -u http://localhost:5173 --composition main -o ./out.mp4 --concurrency 4 && pkill -f http-server)',
'render:path': 'npm run build && (npx http-server dist -p 5173 > /dev/null 2>&1 & sleep 2 && PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH="/root/.cache/ms-playwright/chromium-1187/chrome-linux/chrome" open-motion render -u http://localhost:5173 --composition main -o ./out.mp4 --concurrency 4 && pkill -f http-server)'
},
dependencies: {
'react': '^18.2.0',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-motion/core",
"version": "0.1.1",
"version": "0.1.3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/encoder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-motion/encoder",
"version": "0.1.1",
"version": "0.1.3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-motion/renderer",
"version": "0.1.1",
"version": "0.1.3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down