关于 json-render-remotion
json-render-remotion 是面向视频开发者的 Remotion 渲染器,可将 JSON 时间线规格转换为视频合成,并提供标准组件及转场支持。
主要功能
- 01将 JSON 时间线渲染为 Remotion 合成
- 02使用标准场景和叠加组件
- 03定义自定义目录组件
- 04通过钩子和包装器应用转场
适用场景
- 01渲染标题卡、图片幻灯片和分屏
- 02为视频添加文字叠加或字幕条
- 03为时间线创建自定义片段组件
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ vercel-labs/ json-render --skill json-render-remotion安装后在 Claude Code 中输入/json-render-remotion确认已加载。
详细介绍
@json-render/remotion
Remotion 渲染器,可将 JSON 时间线规格转换为视频合成。
快速开始
import { Player } from "@remotion/player";
import { Renderer, type TimelineSpec } from "@json-render/remotion";
function VideoPlayer({ spec }: { spec: TimelineSpec }) {
return (
<Player
component={Renderer}
inputProps={{ spec }}
durationInFrames={spec.composition.durationInFrames}
fps={spec.composition.fps}
compositionWidth={spec.composition.width}
compositionHeight={spec.composition.height}
controls
/>
);
}
使用标准组件
import { defineCatalog } from "@json-render/core";
import {
schema,
standardComponentDefinitions,
standardTransitionDefinitions,
standardEffectDefinitions,
} from "@json-render/remotion";
export const videoCatalog = defineCatalog(schema, {
components: standardComponentDefinitions,
transitions: standardTransitionDefinitions,
effects: standardEffectDefinitions,
});
添加自定义组件
import { z } from "zod";
const catalog = defineCatalog(schema, {
components: {
...standardComponentDefinitions,
MyCustomClip: {
props: z.object({ text: z.string() }),
type: "scene",
defaultDuration: 90,
description: "My custom video clip",
},
},
});
// Pass custom component to Renderer
<Player
component={Renderer}
inputProps={{
spec,
components: { MyCustomClip: MyCustomComponent },
}}
/>
时间线规格结构
{
"composition": { "id": "video", "fps": 30, "width": 1920, "height": 1080, "durationInFrames": 300 },
"tracks": [{ "id": "main", "name": "Main", "type": "video", "enabled": true }],
"clips": [
{ "id": "clip-1", "trackId": "main", "component": "TitleCard", "props": { "title": "Hello" }, "from": 0, "durationInFrames": 90 }
],
"audio": { "tracks": [] }
}
标准组件
| 组件 | 类型 | 说明 |
|---|---|---|
TitleCard | 场景 | 带副标题的全屏标题 |
TypingText | 场景 | 终端风格的打字动画 |
ImageSlide | 图像 | 全屏图像展示 |
SplitScreen | 场景 | 双面板对比 |
QuoteCard | 场景 | 带署名的引言 |
StatCard | 场景 | 动态统计数据展示 |
TextOverlay | 叠加层 | 文字叠加层 |
LowerThird | 叠加层 | 姓名/职务叠加层 |
主要导出项
| 导出项 | 用途 |
|---|---|
Renderer | 将规格渲染为 Remotion 合成 |
schema | 时间线架构 |
standardComponents | 预构建组件注册表 |
standardComponentDefinitions | 目录定义 |
useTransition | 转场动画钩子 |
ClipWrapper | 为片段添加转场效果 |
评论
支持 Markdown