HyperFrames CLI
所有操作均通过 npx hyperframes 运行。需要 Node.js >= 22 和 FFmpeg。
工作流程
- 脚手架搭建 —
npx hyperframes init my-video - 编写 — 编写 HTML 组合(参见
hyperframes技能) - 代码检查 —
npx hyperframes lint - 视觉检查 —
npx hyperframes inspect - 预览 —
npx hyperframes preview - 渲染 —
npx hyperframes render
在预览前先执行 lint 和 inspect。lint 会捕获缺少 data-composition-id、轨道重叠以及未注册的时间线。inspect 会在无头 Chrome 中打开渲染后的组合,沿时间线扫描,并报告文本超出气泡/容器或画布的问题。
脚手架搭建
npx hyperframes init my-video # 交互式向导
npx hyperframes init my-video --example warm-grain # 选择示例
npx hyperframes init my-video --video clip.mp4 # 包含视频文件
npx hyperframes init my-video --audio track.mp3 # 包含音频文件
npx hyperframes init my-video --non-interactive # 跳过提示(CI/Agent)
模板:blank, warm-grain, play-mode, swiss-grid, vignelli, decision-tree, kinetic-type, product-promo, nyt-graph。
init 会创建正确的文件结构、复制媒体文件、使用 Whisper 转录音频,并安装 AI 编码技能。请使用它而不是手动创建文件。
代码检查
npx hyperframes lint # 当前目录
npx hyperframes lint ./my-project # 指定项目
npx hyperframes lint --verbose # 信息级别结果
npx hyperframes lint --json # 机器可读格式
检查 index.html 和 compositions/ 中的所有文件。报告错误(必须修复)、警告(应修复)和信息(通过 --verbose)。
视觉检查
npx hyperframes inspect # 检查时间线上渲染的布局
npx hyperframes inspect ./my-project # 指定项目
npx hyperframes inspect --json # Agent 可读结果
npx hyperframes inspect --samples 15 # 更密集的时间线扫描
npx hyperframes inspect --at 1.5,4,7.25 # 显式关键帧时间戳
在 lint 和 validate 之后使用,尤其适用于包含对话气泡、卡片、字幕或紧凑排版的作品。它会报告:
- 文本扩展到最近的视觉容器或气泡之外
- 文本被自身固定宽/高的框裁剪
- 文本扩展到组合画布之外
- 子元素逃离裁剪容器
错误应在渲染前修复。警告会呈现给 Agent 审查;添加 --strict 可在警告时也让构建失败。重复的静态问题默认会折叠,以便 JSON 输出在 LLM 上下文中保持紧凑。如果溢出是入场/出场动画所必需的,请在元素或祖先上标记 data-layout-allow-overflow。如果装饰元素不应被检查,请标记 data-layout-ignore。
npx hyperframes layout 仍可作为同一次视觉检查的兼容别名使用。
预览
npx hyperframes preview # 服务当前目录
npx hyperframes preview --port 4567 # 自定义端口(默认 3002)
文件更改时热重载。自动在浏览器中打开 Studio。
当将项目交还给用户时,请使用 Studio 项目 URL,而不是源 index.html 路径:
http://localhost:<port>/#project/<project-name>
使用预览输出中的实际端口和项目目录名称。例如,在 codex-openai-video 中执行 npx hyperframes preview --port 3017 后,报告 http://localhost:3017/#project/codex-openai-video。
将 index.html 仅视为源代码上下文。作为实现文件链接是可以的,但不要将其标记为项目或预览界面。
渲染
npx hyperframes render # 标准 MP4
npx hyperframes render --output final.mp4 # 命名输出
npx hyperframes render --quality draft # 快速迭代
npx hyperframes render --fps 60 --quality high # 最终交付
npx hyperframes render --format webm # 透明 WebM
npx hyperframes render --docker # 字节一致
| 标志 | 选项 | 默认值 | 说明 |
|---|---|---|---|
--output | 路径 | renders/name_timestamp.mp4 | 输出路径 |
--fps | 24, 30, 60 | 30 | 60fps 会使渲染时间加倍 |
--quality | draft, standard, high | standard | draft 用于迭代 |
--format | mp4, webm | mp4 | WebM 支持透明背景 |
--workers | 1-8 或 auto | auto | 每个工作线程启动一个 Chrome |
--docker | 标志 | off | 可重现的输出 |
--gpu | 标志 | off | GPU 加速编码 |
--strict | 标志 | off | lint 错误时构建失败 |
--strict-all | 标志 | off | 错误和警告时构建失败 |
质量指南: 迭代时使用 draft,审阅时使用 standard,最终交付时使用 high。
转录
npx hyperframes transcribe audio.mp3
npx hyperframes transcribe video.mp4 --model medium.en --language en
npx hyperframes transcribe subtitles.srt # 导入现有字幕
npx hyperframes transcribe subtitles.vtt
npx hyperframes transcribe openai-response.json
文字转语音
npx hyperframes tts "Text here" --voice af_nova --output narration.wav
npx hyperframes tts script.txt --voice bf_emma
npx hyperframes tts --list # 显示所有语音
故障排除
npx hyperframes doctor # 检查环境(Chrome, FFmpeg, Node, 内存)
npx hyperframes browser # 管理捆绑的 Chrome
npx hyperframes info # 版本和环境详情
npx hyperframes upgrade # 检查更新
如果渲染失败,请先运行 doctor。常见问题:缺少 FFmpeg、缺少 Chrome、内存不足。
其他
npx hyperframes compositions # 列出项目中的组合
npx hyperframes docs # 打开文档
npx hyperframes benchmark . # 基准测试渲染性能