ワンクリックで
srt-remotion-video
SRT 字幕驱动的视频生成主流程。将 SRT 字幕文件转换为 Remotion 视频项目,自动生成分镜脚本、创建场景组件、合成最终视频。当用户需要从 SRT 字幕文件生成 Remotion 视频时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
SRT 字幕驱动的视频生成主流程。将 SRT 字幕文件转换为 Remotion 视频项目,自动生成分镜脚本、创建场景组件、合成最终视频。当用户需要从 SRT 字幕文件生成 Remotion 视频时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | srt-remotion-video |
| description | SRT 字幕驱动的视频生成主流程。将 SRT 字幕文件转换为 Remotion 视频项目,自动生成分镜脚本、创建场景组件、合成最终视频。当用户需要从 SRT 字幕文件生成 Remotion 视频时使用。 |
将 SRT 字幕文件转换为 Remotion 视频的完整工作流。
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────────┐ ┌──────────┐
│ 获取 SRT │ → │ 依赖预检 │ → │ 项目初始化│ → │ 生成分镜 │ → │ 并行 Creator 规划实现 │ → │ 合成视频 │
│ 文件路径 │ │ / 首次安装│ │ │ │ │ │ scene-plan + code │ │ │
└──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────────────────┘ └──────────┘
<skillRoot>/
├── SKILL.md
├── template/
├── references/
│ ├── storyboard-parser.md
│ └── scene-component-creator.md
└── scripts/
├── ensure-template-deps.js
├── init-project.js
├── generate-storyboard.js
├── generate-creator-scenes.js
├── generate-scenes-registry.js
├── scene-registry-utils.js
├── validate-project.js
└── validate-scene-plan.js
<srtDir>/
├── your-file.srt
└── remotion-video-projects/
└── {yyyy-mm-dd-hh-mm-ss}/
主流程和所有 SubAgent 统一使用以下绝对路径约定:
skillRoot: 当前 srt-remotion-video skill 目录的绝对路径templateRoot: {skillRoot}/templatereferencesRoot: {skillRoot}/referencesscriptsRoot: {skillRoot}/scriptssrtPath: 用户提供的 SRT 文件绝对路径projectBaseDir: {dirname(srtPath)}/remotion-video-projectsprojectRoot: 当前项目实例目录,格式为 {projectBaseDir}/{projectName}/强制要求:
referencesRoot 读取scriptsRoot 执行srtPathsrtPath关键:模板始终从 skill 内部复制,所有工作在字幕目录下的独立项目目录进行。
执行:
node "{skillRoot}/scripts/ensure-template-deps.js" "{templateRoot}"
脚本会:
{templateRoot}/package.json 和 {templateRoot}/package-lock.json{templateRoot} 下执行一次 npm install执行:
node "{skillRoot}/scripts/init-project.js" --srt-path "{srtPath}"
脚本会:
{dirname(srtPath)}/remotion-video-projects/ 存在remotion-video-projects/{yyyy-mm-dd-hh-mm-ss}/{skillRoot}/template/ 复制模板文件;若模板依赖已安装,则一并复制已安装依赖如果用户明确指定了项目路径,则直接使用该路径作为 projectRoot,跳过默认目录推导。
从脚本输出或用户指定路径获取:
projectRootskillRoottemplateRootreferencesRootscriptsRootsrtPath后续所有步骤都使用这些绝对路径。
必须使用 SubAgent 执行此步骤。
主 Agent 负责:
storyboardReference = {referencesRoot}/storyboard-parser.mdstoryboardScript = {scriptsRoot}/generate-storyboard.jsSubAgent prompt 模板:
你正在执行 srt-remotion-video 工作流的“分镜生成阶段”。
首先读取以下参考协议并严格按其步骤执行:
- {storyboardReference}
输入参数:
- skillRoot: {skillRoot}
- projectRoot: {projectRoot}
- srtPath: {srtPath}
重要:
1. 所有路径都已展开为绝对路径,不要自行猜测
2. 需要执行的脚本位于 {storyboardScript}
3. 完成后必须按参考协议中的“完成后返回”契约,返回结构化结果
主流程必须等待返回结果,并读取 storyboard.json 验证结构正确。
读取 storyboard.json,获取所有场景数据。
const SCENES_PER_CREATOR = 5;
const sceneCount = storyboard.scenes.length;
const creatorCount = Math.ceil(sceneCount / SCENES_PER_CREATOR);
creatorId 生成规则固定为:
const creatorId = `creator-${String(index + 1).padStart(2, '0')}`;
示例:
creator-01creator-02creator-10主流程必须始终使用该格式,不要省略前导零,不要改成其他命名方式。
主流程负责调度:
scenesDataPath = {projectRoot}/scene-plans/{creatorId}.scenes.jsoncreatorIdplanPath = {projectRoot}/scene-plans/{creatorId}.jsonvalidateScript = {scriptsRoot}/validate-scene-plan.jsnode "{scriptsRoot}/generate-creator-scenes.js" \
"{projectRoot}/storyboard.json" \
"{creatorId}" \
"{SCENES_PER_CREATOR}" \
"{scenesDataPath}"
{scenesDataPath} 的绝对路径写入 SubAgent prompt每个 Creator 的 SubAgent prompt 模板:
你正在执行 srt-remotion-video 工作流的“场景规划与实现阶段”。
首先读取以下参考协议并严格按其步骤执行:
- {referencesRoot}/scene-component-creator.md
输入参数:
- skillRoot: {skillRoot}
- projectRoot: {projectRoot}
- creatorId: {creatorId}
- planPath: {planPath}
- scenesDataPath: {scenesDataPath}
- validateScript: {validateScript}
重要:
1. 所有路径都已展开为绝对路径,不要自行猜测
2. 当前 creator 的场景事实源只允许来自 {scenesDataPath}
3. 规划阶段只使用 {scenesDataPath}、{projectRoot}/cartoon-ui-style-guide.css、{projectRoot}/cartoon-ui-style-guide-reference.md 和 {skillRoot}/../remotion-best-practices/SKILL.md
4. 先生成 scene-plan JSON,再执行校验,校验通过后再编写场景组件
5. `beatPlan` 默认一段字幕对应一个 beat;如果相邻 segments 明显属于同一句连续表达,可以合并
6. 合并仅允许发生在相邻 segments 之间,禁止跳跃式组合
7. `beatPlan` 只声明 `segments` 和 `action`;实际时间必须从 scenesData[].segments 的 `relativeStart / relativeDuration` 推导
8. 场景主节奏必须绑定 scenesData[].segments[].relativeStart / relativeDuration
9. 默认保留宿主背景,在透明根层上围绕画面中部或中上区域组织主视觉;不要重建整屏背景
10. 组件接口固定为 React.FC<{ segments: Segment[] }> 且使用默认导出
11. 只负责产出 {projectRoot}/src/scenes/SceneXXX.tsx;若文件不存在则创建,若已存在则仅修改自己负责的场景文件
12. 不要手改 {projectRoot}/src/compositions/Main.tsx 或 generated-scenes.ts
13. 完成后必须按参考协议中的“完成后返回”契约,返回结构化结果
14. `remotion-best-practices` 与当前 skill 同级,固定入口为 {skillRoot}/../remotion-best-practices/SKILL.md
确认所有目标场景组件文件均已生成。
componentResults仅用于任务完成反馈,不作为最终注册文件组装或总时长计算的真实来源。
普通视频生成流程不得重写 {projectRoot}/src/compositions/Main.tsx。
模板默认输出规格:1920x1080 / 30fps。
generated-scenes.ts 的 totalDurationInFrames 由 generate-scenes-registry.js 生成,不要手改Main.tsx 中的 msToFrames 必须使用 useVideoConfig().fps 动态获取帧率,不能硬编码 FPS 常量执行:
node "{scriptsRoot}/generate-scenes-registry.js" \
"{projectRoot}" \
"{projectRoot}/storyboard.json"
运行时契约固定:
SceneXXX.tsx 都通过默认导出暴露组件generated-scenes.ts 负责保存 start、duration、segments、ComponentMain.tsx 负责用 <Component segments={scene.segments} /> 把分段数据传给场景组件Root.tsx 是模板只读文件,不需要也不允许在普通流程中重写。
要求:
Root.tsx 必须保持从 generated-scenes.ts 读取 totalDurationInFrames渲染前必须执行:
node "{scriptsRoot}/validate-project.js" \
"{projectRoot}" \
"{projectRoot}/storyboard.json"
校验失败时必须停止流程,不得继续渲染。
cd "{projectRoot}"
npx remotion render Main out/output.mp4
通知用户:
{projectRoot}/out/output.mp4当主视频生成流程(步骤 0–5)完成后,用户可以请求"调试模式"或"重新渲染"。
这两个操作都假定
projectRoot已存在且场景组件已生成完毕。
当用户说"调试模式"、"预览模式"或类似表述,并要求添加音频时执行。
audioPath{projectRoot}/public/ 目录存在{projectRoot}/public/audio.mp3mkdir -p "{projectRoot}/public"
cp "{audioPath}" "{projectRoot}/public/audio.mp3"
修改 {projectRoot}/src/compositions/Main.tsx:
Audio 和 staticFile:
import { AbsoluteFill, Audio, Sequence, staticFile, useCurrentFrame } from "remotion";
<AbsoluteFill style={{ backgroundColor: ... }}> 的直接子级最前面添加:
<Audio src={staticFile("audio.mp3")} />
启动 Remotion Studio 供用户预览:
cd "{projectRoot}"
npx remotion studio
告知用户 Remotion Studio 已启动,音频已添加到时间轴,可在浏览器中预览。
当用户说"重新渲染"、"再次渲染"或类似表述时执行。
渲染最终视频前,必须确保 Main.tsx 中不存在音频组件:
{projectRoot}/src/compositions/Main.tsx<Audio 标签<Audio src={staticFile("audio.mp3")} /> 这一行Audio 和 staticFile(如果它们不再被其他代码使用)cd "{projectRoot}"
npx remotion render Main out/output.mp4
通知用户视频已重新渲染,输出路径为 {projectRoot}/out/output.mp4。
当主视频生成流程已经完成,用户要求生成 4K、60fps 或其他高于默认配置(1080p 30fps)的版本时执行。
这个操作假定
projectRoot已存在且场景组件已生成完毕。
场景组件中的所有元素(卡片、图标、文字等)使用绝对像素值,基于 1920x1080 设计。直接将 Root.tsx 的 width/height 改为 3840x2160 会导致所有元素在画面中占比缩小。正确做法是保持设计分辨率 1920x1080 不变,通过 Remotion 的 --scale 参数放大输出分辨率。
| 错误做法 | 后果 |
|---|---|
| 改 Root.tsx 的 width=3840 height=2160 | 所有场景元素占比缩小一半 |
用 --width 3840 --height 2160 CLI 参数 | 同上 |
| 只改 fps 不改 totalDurationInFrames | 视频只有前半段有内容,后半段空白 |
Main.tsx 中硬编码 const FPS = 30 | 改了 Root.tsx fps 后场景时序错乱 |
解析用户需求为具体的输出参数:
| 用户需求 | Root.tsx 修改 | generated-scenes.ts 修改 | 渲染命令 |
|---|---|---|---|
| 4K / 超清 | 不改 | 不改 | --scale 2 |
| 60fps | fps={60} | totalDurationInFrames 按比例换算 | 无需 scale |
| 4K 60fps | fps={60} | totalDurationInFrames 按比例换算 | --scale 2 |
{projectRoot}/src/Root.tsx 中的 fps 值:fps={60} // 从 30 改为 60
{projectRoot}/src/compositions/generated-scenes.ts 中的 totalDurationInFrames:// 帧数 = 原帧数 × (新fps / 原fps)
// 例如 30→60fps: 1572 × 2 = 3144
export const totalDurationInFrames = {原帧数 × 新fps / 原fps};
关键:{projectRoot}/src/Root.tsx 中 <Composition> 的 width 和 height 不要修改,必须保持 1920 和 1080。分辨率放大由渲染时的 --scale 参数完成,而非修改设计分辨率。
Main.tsx中的msToFrames必须使用useVideoConfig().fps动态获取帧率。如果发现Main.tsx中有硬编码的FPS常量,必须先修复为useVideoConfig().fps,否则 fps 变更后场景时序会完全错乱。
node "{scriptsRoot}/validate-project.js" \
"{projectRoot}" \
"{projectRoot}/storyboard.json"
校验失败时必须停止,不得继续渲染。
cd "{projectRoot}"
npx remotion render Main out/output-4k.mp4 --scale 2
--scale 2:将 1920x1080 的设计画布放大 2 倍渲染为 3840x2160--scale 2 即可通知用户:
{projectRoot}/out/output-4k.mp4interface Storyboard {
totalDuration: number;
sceneCount: number;
scenes: {
id: string;
startTime: number;
duration: number;
segments: {
text: string;
relativeStart: number;
relativeDuration: number;
}[];
semanticTags?: string[];
visualHint?: string;
}[];
}
interface ScenePlanCard {
sceneId: string;
goal: string;
layout: string;
visualCore: string;
surface: string;
emphasis: string;
screenShouldShow: string[];
beatPlan: {
segments: number[];
action: string;
}[];
}
interface SceneComponentResult {
sceneId: string;
componentPath: string;
componentName?: string;
planPath?: string;
}
storyboard-parser.md:分镜生成阶段协议scene-component-creator.md:场景规划与实现阶段协议theme-template-switching.md:主题模板更换指南ensure-template-deps.js:检查模板依赖,必要时执行首次安装init-project.js:根据 srtPath 初始化项目generate-storyboard.js:根据 SRT 和 groups.json 生成 storyboard.jsongenerate-creator-scenes.js:根据 storyboard.json 为指定 creator 生成 scenesData JSONgenerate-scenes-registry.js:生成 generated-scenes.tsscene-registry-utils.js:registry 和校验共用工具validate-project.js:渲染前完整性校验validate-scene-plan.js:校验 scene-plan JSON 结构与 segment 绑定ensure-template-deps.js 检查模板依赖,必要时完成首次安装init-project.js --srt-path 创建项目projectRoot、skillRoot、templateRoot、referencesRoot、scriptsRootreferences/storyboard-parser.md 生成 storyboard.jsonstoryboard.json 结构正确references/scene-component-creator.md 并行生成 scene-plan 与场景组件generate-scenes-registry.jsvalidate-project.js{projectRoot}/public/audio.mp3Main.tsx 添加 <Audio> 组件Main.tsx 是否存在 <Audio> 标签<Audio> 及相关 importMain.tsx 中 msToFrames 使用 useVideoConfig().fps 而非硬编码常量Root.tsx 的 fps 和 generated-scenes.ts 的 totalDurationInFramesRoot.tsx 的 width/height 保持 1920/1080 不变validate-project.js 校验--scale 2(4K时)执行渲染{skillRoot}/templatetemplate/ 依赖预检{dirname(srtPath)}/remotion-video-projectsMain.tsx、Root.tsx 属于受保护宿主层segmentsvalidate-project.js 失败时不得继续渲染references/theme-template-switching.md