traced-edit
您通过编写小型 JSON 文件来编辑素材;脚本负责其余所有工作,并留下每一步的痕迹。您永远不需要编写 ffmpeg 命令,也永远不需要手动计算时间。
| # | 状态(文件夹) | 您编写的内容 | 用户操作 | Studio 弹窗 |
|---|---|---|---|---|
| 1 | states/1script(human-review) | brief.json、script.txt(+ beats.json、soundbites.json) | 投放上下文素材,阅读脚本,逐条用耳朵检查音频片断,批准,录制它 | – |
| 2 | states/2audio-analysis | params.json | – | – |
| 3 | states/3video-analysis | params.json | – | – |
| 4 | states/4video-edition(human-review) | edit.json(+ 来自 videos/ASSETS 的 inserts) | 检查片段和插入内容,批准 | 是 |
| 5 | states/5sound-effects(human-review) | sfx.json(来自 videos/ASSETS/sound-effects 的音效) | 聆听,提供反馈,批准 | 是 |
| 6 | states/6music(human-review) | music.json | 聆听,提供反馈,批准 | 是 |
| 7 | deliverables | deliver.json | 观看动画,批准渲染 | 是 |
每个状态都等待前一个状态的批准(1 → 2,4 → 5 → 6 → 7)。状态 2–7 对 raw-media/ 中的素材进行操作,因此在添加素材前它们保持被阻塞状态。素材会被复制到那里一次,并且永远不会被修改。trace.html 在一个页面上显示整个管道。
两种入口(brief.json 中的 "mode")
| 模式 | 何时使用 | 语音来源 | 脚本依据 | 脚本之后 |
|---|---|---|---|---|
planned | 已规划的主题,尚未录制 | 用户面对镜头说话(素材本身就是语音) | 主题、上下文文本和素材 | 录制 → --media → 状态 2 对齐片段并据此生成 edit.json(包括修剪) |
footage | 已有未规划的视频 | 脚本完成后录制的画外音 | 素材本身,每段对应一个节拍(beats.json) | 录制 → --voice → 状态 2 对齐 → 状态 4 将每个段落放置到其对应片段,并将素材的原始音频音量调低 |
none | 无语音的素材(例如纯画面) | – | – | 跳过状态 1 |
init.mjs 根据项目启动方式写入模式;--mode 可以更改。当情况不明确时,询问用户是哪一种。在每种模式下,提词器文件都是纯文本,没有时间码:在素材优先模式下,时间信息位于 beats.json 中,录制会设定实际时间。
工作示例(pintas-presupuesto 计数器:32 个事件,4 个片段,41 个提示点,3 个音乐段落):
examples/pintas.edit.json、pintas.sfx.json、pintas.music.json、pintas.deliver.json。
现在打开它们并复制其模式。
所有命令均从工作区根目录(hyperframes-videos/)运行。S 代表
.claude/skills/traced-edit/scripts。
规则(请勿违反)
- 仅编辑配置文件:
brief.json、script.txt、beats.json和soundbites.json(状态 1)、params.json(状态 2–3)、edit.json、sfx.json、music.json、deliver.json。用户的 素材放在context/(状态 1)和raw-media/(通过init.mjs)。out/、review/、listen/、preview/和deliverables/<project>/中的所有内容都是生成的。 edit.json中的每个srcT都是读取自脚本生成图片的源时间。 每个其他时间都是一个锚点({"on": "pieceStart", "piece": "B"}、{"on": "event", "n": 12}) 或从out/timeline.json复制的一个剪切时间。永远不要估算或计算任何一个。- 在将事件标记为
"verified": true之前,每个事件都必须通过眼睛确认,并且在编写脚本之前,必须打开状态 1 的out/context.md中的每张图片。一个节拍的from/to是 就像任何srcT一样,是从素材表上读取的源时间。 - 批准权在用户手中。 只有在用户观看/聆听并确认无误,并使用其原话作为
--note后,才能运行approve.mjs。使用feedback.mjs记录他们说的其他所有内容。用户通过手机审核页面进行的批准也视为用户的批准(记录中 会包含"source": "phone");您绝不能通过该页面或其 API 自行批准。 - 在状态 7 获得批准之前,永远不要进行渲染。
run.mjs … 7 --render否则会拒绝。 - Studio 中的编辑应被移植,而不是丢弃。 如果状态显示
STUDIO EDIT,请读取差异, 将修改移至配置中(见下表),然后使用--ported "<改动已移至何处>"重新构建。 - 当任何步骤失败时:首先读取该状态的
TRACE.md(出了什么问题、要粘贴的失败命令、 其 stderr),然后是log.txt。如果代码追踪显示 "Script stack (this is a bug in the skill)",请停止并精确地告知用户该消息。 - 您无法听到音频。音效和音乐由用户在 Studio 预览中判断。
- 状态 4(转码)和状态 7 的
--render需要数分钟:应将其放在前台运行并设置最长的超时时间(--render在后台运行),一次只运行一个。 - 状态 4 和 5 仅从
videos/ASSETS/(从项目文件夹看的../ASSETS/)组合素材。 状态 4 的inserts从中获取其剪辑片段、图片、动画、运动图形和图标 (clips/、images/、animations/、motion-graphics/、svg-icons/)。数据图表是motion-graphics/manim/中的 Manim 渲染结果,基于data/<place>/中的事实生成(只读)。 状态 5 的sounds来自videos/ASSETS/sound-effects/。脚本会拒绝任何指向该路径之外的内容。要使用 新资源,用户应首先将其复制到正确的 ASSETS 文件夹;切勿将配置指向 项目文件夹、Downloads或其他视频的文件。技能会自行写入的唯一文件夹是videos/ASSETS/clips/cabildo/:状态 1 会将事实核查员的议会剪辑片段复制到 那里(每个片段附带一个.json侧车文件)。请勿手动将文件放入该文件夹。 - 音频片断的说明文字是用户的,需通过耳朵检查。 议会剪辑片段中的 Chirp 文本是草稿:
绝不能原样显示在屏幕上。只有用户聆听了从
from到to的剪辑片段并确认了说明文字、 说话者和角色后,才能在soundbites.json中标记"verified": true。否则,状态 1 会拒绝提词器副本,状态 4 会拒绝构建。 真实的、常被指控的官员会被点名:姓名和职务来自用户或侧车文件, 绝不能猜测。
审核循环(状态 4、5、6、7)
状态 4、5、6 或 7 的每次成功运行都会构建一个 HyperFrames 项目,并在用户的浏览器中通过 HyperFrames Studio 打开它(一次一个预览;URL 会被打印并保存在追踪中)。
node S/run.mjs videos/<project> <4|5|6|7>:预览会弹出。- 告知用户需要观看/聆听什么(见下文),并询问反馈。
- 记录他们所说的内容:
node S/feedback.mjs videos/<project> <id> "<他们的原话>"。 - 修改配置,再次运行。Studio 会重新加载相同的 URL。
- 当他们满意时:
node S/approve.mjs videos/<project> <id> --note "<他们的原话>"。
重新打开预览:node S/preview.mjs videos/<project> <id>。停止:… --stop。在没有浏览器标签页的情况下启动服务器(远程/无头模式):向 run.mjs 或 preview.mjs 添加 --no-open;使用 --no-preview 完全跳过。
通过手机审核
状态 4–7 的每次构建还会写入 out/preview.mp4(720 像素的剪辑,并包含该状态下 deliver.json 中设置音量的音频),并在 PC 上保持一个审核服务器运行(run.mjs 会启动它;--no-phone 可以跳过)。在同一 Wi-Fi 网络上,手机页面会播放该视频,并在其上绘制时间线(计数器、片段和速度、正在播放的提示点或音乐段落、插入轮廓),列出事件、提示点或段落以便跳转,记录即时笔记(芯片 + 听写输入),显示您的回复,并允许用户批准。此页面用于观看和聆听;插入内容和计数器动画则需在 Studio(状态 4)和状态 7 中精确判断。
node S/review.mjs videos/<project>:启动服务器并在 PC 上打开二维码 (http://127.0.0.1:3019/qr)。同时将打印出的📱URL 也提供给用户:您的终端输出不会直接传达给他们。一旦用户通过手机审核完毕,请向run.mjs添加--no-open,以便 Studio 不再在 PC 上弹出。- 在后台启动
node S/review.mjs videos/<project> --wait。当用户从手机上发送笔记或批准时,它会退出并打印信息,例如PHONE NOTE state 5 (sound-effects): 📱 1:11.40 · near event #12 (+0.05s) · cue pop at 71.37s (rule 3, gain 0.9, +0.03s) · too loud。 该笔记已在feedback.jsonl中:请勿再次记录。 - 收到笔记时:修改配置(
near部分指定了规则、事件或段落),使用node S/feedback.mjs videos/<project> <id> --reply "pop gain 0.9 -> 0.6, rebuilding"告知您已执行的操作(该信息会显示在手机上),运行run.mjs <project> <id> --no-open(页面会显示 "Rebuilding…",然后是 "New build ready"),然后再次启动--wait。 - 收到
PHONE APPROVAL时:该状态已获批准。继续下一个状态(其--dry、配置、构建),然后再次--wait。 - 对于您无法处理的笔记(涉及只有 Studio 显示的内容,或不清晰):在
--reply中询问,并再次--wait。
review.mjs <project> --status / --stop。如果手机无法连接,请参见
references/troubleshooting.md(Wi-Fi、防火墙)。
移植 Studio 编辑
Studio 是一个完整的编辑器,用户可能手动修改了某些内容。下一次构建会覆盖它,因此状态会显示 STUDIO EDIT 并拒绝构建。
node S/studio-diff.mjs videos/<project> <id> 会显示更改(会忽略 Studio 自身的重新序列化,例如 data-hf-id 标记)。将其移至配置中:
| 在 Studio 中更改的内容 | 移植到 |
|---|---|
轨道的 data-volume(基础、音效、音乐) | deliver.json 中的 volumes.base / .sfx / .music |
素材优先模式:语音或素材的音频(voice、base-audio = ambience.wav) | deliver.json 中的 volumes.voice / .ambience;素材在语音下降低音量的程度是 edit.json 中的 voice.duckDb |
| 某个音效的音量变大/变小 | sfx.json 中该规则的 gain |
| 覆盖层的位置、大小、颜色、字体 | deliver.json 中的 overlay.css(追加在覆盖层内部的 CSS,例如 #ctr-box { bottom: 420px; }) |
| 计数器标签 / 强调色 | deliver.json 中的 overlay.vars.label / .accent |
| 剪辑片段的时间 | sfx.json / music.json 中的锚点,或 edit.json 中的片段 |
插入元素的位置或大小(#ins-<id>) | edit.json 中的 inserts[].box,以及 inserts[].css 中的声明(例如 "top: 300px;") |
| 插入元素的时间 | edit.json 中的 inserts[].at / .dur(一个锚点,绝不是您计算出的秒数) |
音频片断的说明文字、姓名或角色(compositions/soundbite-<id>.html) | soundbites.json 中的 caption / speaker / role(状态 1:用户再次确认,然后重新运行 2 → 4);其外观:templates/soundbite.html |
| 音频片断的时间 | edit.json 中的相应片段(以及 soundbites.json 中的 from/to) |
动画内部的内容(compositions/insert-<id>.html) | 不移植:它是 videos/ASSETS/animations/… 的副本。如果需要,修改 ASSETS 文件,然后重新运行状态 4 |
之后运行 node S/run.mjs videos/<project> <id> --ported "volumes.sfx 1 -> 0.6 (Studio)"。差异会被归档到 <state>/studio-edits/ 中,并记录在追踪中。
步骤 0:创建项目
node S/init.mjs videos/<project> # planned: nothing recorded yet
node S/init.mjs videos/<project> --media <video.mp4> # new project: footage-first
node S/init.mjs <video.mp4> videos/<project> # footage with no voice (mode none)
之后,录制:init.mjs videos/<project> --media <video>(planned: the on-camera take)
或 init.mjs videos/<project> --voice <audio>(footage: the voiceover; a new take replaces the
old one, which is kept in raw-media/voice-takes/)。--mode planned|footage|none changes the
mode; --link hard-links instead of copying (same drive). Every script prints the status table,
with the next command under each state.
Step 1: The script (human review)
Mode none skips this step (run … 1 once). Details: references/script.md.
- Fill
brief.jsonfrom what the user gave you:topic,context(the facts, notes, article text), optionalaudienceandtone. Images and video clips they give you go instates/1script(human-review)/context/. Optional, for municipal stories:"enrich": { "corpus": "cabildo" }(with thetopic, or"queries": [...]) also searches the fact-checker's archive of Facebook-Live council sessions and cuts the best moments into candidate sound bites (references/script.md). node S/run.mjs videos/<project> 1digests the context: oneout/context.mdwith every image, every clip's contact sheets and transcript and, in footage mode, the footage itself. It stops there until the script exists. Open every picture it lists. Withenrich, it first asks the fact-checker (everyfccall traced; a failure is only a warning): the clips land invideos/ASSETS/clips/cabildo/, andout/enrich/ENRICH.mdlists each candidate (c1,c2…) with speaker, session, date, agenda item, link into the session, contact sheet and the Chirp words with their times.- Write
script.txt, in Spanish, as plain text: only the words to be read, one idea per paragraph, short sentences, numbers and symbols written the way they are said. No title, no notes, no[pausa], noNARRADOR:, no timings, no target length. Every fact comes from the context.- Numbers about the municipality (budget, income, debt, predial, crime, police, health)
come from
videos/ASSETS/data/ixtapaluca/FACTS.md, with the wording itssaylines give. That way a data chart can back the sentence in state 4. A fact marked ⚠verify goes in only after the user signs off, and you tell them it is marked preliminary. - Footage mode: the paragraphs follow the footage in order, and
beats.jsongives each one its stretch:[{ "p": 1, "from": 0, "to": 7.5 }, …], source seconds read off the sheets. Each paragraph must fit its stretch at a calm pace (2.5 words/s); an over
- Numbers about the municipality (budget, income, debt, predial, crime, police, health)
come from