Communitygithub.com

film-build

用代码构建产品宣传片,生成确定性的 seek(t) 网页(真实产品 UI、真实操作系统界面、动态文字、打字提示、光标、变形和镜头移动),以静态帧和草稿形式审查,60fps 运动模糊渲染,并适配 9:16 而不改变 16:9。输出项目工具包(init.sh、影片引擎、渲染/同步/探测/拼版/回归工具)。属于 product-film 的第三和第六阶段。用于构建、修复或渲染发布/宣传片的画面,或制作其竖屏版本。

film-build 是什么?

film-build 是一个面向开发者的 AI 智能体技能,用于以代码方式构建确定性的产品宣传片。它生成一个纯函数形式的网页,其中所有画面(包括真实产品 UI、操作系统界面、动态文字、光标、变形和镜头移动)都作为时间 t 的函数渲染,确保每次渲染结果完全一致。该技能支持多平台:可在 Claude Code、Coder、Cursor 等 AI 编码助手中使用,并提供了完整的本地开发工具链(init.sh、渲染引擎、同步/探测/拼版/回归工具)。其工作流程强调先审查静态帧再渲染全片,通过 `film.js` 中的 shot() 定义、`render.mjs` 进行渲染、`review.py` 审查输出,以及 `tools/sheet.py` 创建接触印相。核心规则包括:只使用 2D 变换、禁止 CSS 过渡和随机数、元素必须显式注册、在 build 阶段而非 run 阶段测量布局。该技能还内置了对 9:16 竖屏版本的支持,通过 `pk()` 函数和 `same.sh` 回归检查确保 16:9 版本不受影响,非常适合制作发布宣传片或产品的推广视频。

兼容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/aqeelshamz/product-film-skills/tree/HEAD/film-build

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

影片构建

开始

sh ~/.claude/skills/film-build/kit/init.sh marketing/videos/<film>   # 拒绝非空文件夹
cd marketing/videos/<film> && npm i && npx playwright install chromium   # 如果提示 NEXT

工具包包含以下文件:

文件作用
film/core.js引擎:scene({name, from, to, build, run, after})(时间单位为拍 = 秒 × 2),put(el, {o, css}),reg(el, base),C.W/C.H/C.FMT,C.start()
film/film.js包含以下所有辅助函数和四个示例镜头(线稿、提示、分裂、角色卡)的启动文件。每个辅助函数的注释说明了它来自哪个 rejection。替换镜头,保留辅助函数。
film/mock.jswindow.MOCK:真实 UI 部件的 HTML(仪表盘、窗口、手机屏幕),以屏幕像素为单位
film/index.html从 assets/fonts/{display,ui}.woff2 加载字体(本地无衬线字体作为后备)
scripts/render.mjs--sheet,--at t1,t2,--draft,--range a,b,--verify,final,--mux,--fmt 9x16,--all
scripts/sync.mjs将 timeline.json 复制到页面中
scripts/review.py基于渲染的 MP4 进行审查的工具包:接触印相、最快动作条、手机视图、9:16 安全区域、指标
tools/probe.mjscuts(每个剪辑点及每个镜头的中点,以视频秒为单位)或任意表达式,例如 "window.UNWARP(12.4)"
tools/sheet.py将静态帧平铺到一个带标签的印相中
tools/pack_grid.py将 4×3 角色表(透明或白色背景)裁剪成 12 帧的条带,供 sprite() 使用;打印单元格大小
tools/cut_cast.py将一行角色排列表裁剪成单个静态角色帧
assets/characters/四个示例角色(创始人、开发者、销售、学生),12 帧条带,单元格 360 px
tools/same.shsave / check 对前后静态帧进行 PSNR 回归检测

启动文件中的辅助函数(请使用它们,不要重新发明)

  • io(五次方缓入缓出)用于镜头移动和变形;oq(五次方缓出)用于入场;back 用于小幅超调。
  • cam(e, s, fx, fy) 将 1920×1080 平面的焦点 (fx, fy) 置于帧中心,缩放比例为 s。 camD 功能相同,但不会使平面边缘超出画面(覆盖缩放;在 9:16 中至关重要)。
  • posIn(e, root) 读取元素在移动平面中的位置(用于光标目标、插入符跟随)。
  • typed() 用于逐字显示文本行;keyed() 用于真实键盘:每个字符时间不规则, 空格处停顿更长,末尾带有闪烁插入符。
  • wordsHTML() 从第一帧开始将每个单词布局在其最终宽度上,在其出现时间之前保持透明,因此行 从不重新排版(“文本过渡根本不流畅”)。
  • cursor()/putCursor()/bump():一个真实的箭头光标,滑动移动,提前到达,点击时下沉 15%。
  • pop() 用于小物件的下落动画。
  • sprite(parent, src, cellW, cellH, h) / putSprite(e, t, a, z, loops) 用于绘制角色:在 a→z 范围内 遍历其 12 帧,并带有轻微呼吸动作使其永不静止。它是一个 <img>,因此引擎会等待它加载。
  • shot(name, t0, t1, build, run) 以秒为单位封装 scene。
  • 底部的节奏扭曲:SLOW(全局拉伸),EV 保持(冻结一个瞬间供阅读)和插入; window.CUTS 和 window.UNWARP 提供视频时间用于声音和配音定位。
  • PT / pk(a16, a9) 在一个文件中为每种格式选择不同的值。

引擎规则(确定性)

影片是 t 的纯函数。任何一帧的渲染结果应相同,无论它是第一帧还是之后任何一帧之后渲染。

  • 仅使用 2D 变换:不要用 translate3d,不要用 will-change,不要用 CSS 过渡,不要用 Math.random(使用索引的哈希值)。
  • 初始隐藏的元素:reg(el, {o: 0}),绝不能内联 opacity:0。
  • 在 after() 或 build 中一次性测量布局,绝不在 run 中测量(它会读取前一帧)。
  • 3D 视图:每帧使用 insertBefore(v, firstChild) 重新插入,这样不会保留缓存的栅格。
  • 嵌入的 CSS 动画(例如产品小部件的动画):暂停它们并设置 animation-delay: calc(-1s * var(--t))。
  • 在第一帧之前等待图像和字体加载(decode(),document.fonts.ready)。
  • 将产品 CSS 限定在唯一的根类下;在影片中使用唯一的类名(.w 曾造成泄漏)。
  • 使用 classList.add,不要用 className =。
  • node scripts/render.mjs --verify 在发送任何渲染前必须输出 12/12。

真实感:构建任何屏幕前请阅读 references/realism.md

简短版:以真实密度显示真实应用、使用品牌官网的真实 Logo、带有该操作系统上真实应用的 OS 界面、真实壁纸、以真实 dp 尺寸绘制在真实启动器网格上的手机屏幕(由产品自己的渲染器绘制)、比你以为的更丰富的产品 UI、每当显示品牌标志时加上一段署名使用文字。

构建循环(审查驱动)

  1. 根据已批准的故事板撰写镜头列表到 film.js 中,每个 shot() 一个,重叠部分用于交接。
  2. 先做静态帧。 node tools/probe.mjs cuts → 在每个镜头中点和每个交接处渲染静态帧: node scripts/render.mjs --at … 然后 python3 tools/sheet.py review/stills/16x9 review/sheet.jpg <times>。 自己阅读印相。修复。重复。(每轮约 1–2 分钟,而完整渲染则需要 25 分钟以上。)
  3. 在发送任何审查之前进行 QA 检查: 以 ≤ 1.5 秒的间隔并在每个交接处逐帧播放(在每个过渡处生成 10–15 fps 的接触印相)。逐行检查 references/qa.md:重叠、裁剪、空白帧、阅读时间、文本平滑度、打字效果、Logo 提示、OS 真实感、手机尺寸。
  4. 发送静态帧(印相)给负责人进行初次查看。等待。
  5. 草稿: node scripts/render.mjs --draft(30 fps,约 4 分钟),python3 scripts/review.py 1 --draft,阅读条带。发送草稿 MP4。明确说明这是没有运动模糊的 30 fps 草稿(看起来比最终版更断续)。
  6. “渲染最终版”: 在后台运行 node scripts/render.mjs(60 fps,运动模糊;60 秒影片约需 25–35 分钟)。 渲染期间绝不要编辑 film.js:如果需要继续工作,请先复制项目。
  7. 在每一轮批准后提交影片代码和时间线。

节奏

第一版剪辑几乎总是太快。屏幕上的文字每个单词需要约 0.3 秒 + 完全显示后 1 秒(总时间不低于 1.5 秒)。优先使用扭曲(SLOW 1.1–1.25,行上的 EV 保持)而不是重新调整每个镜头的时间。每次节奏调整后,重新运行 probe.mjs cuts,因为声音和配音位置会发生变化。

9:16:阅读 references/formats.md

使用 pk() 在一个文件中重新取景同一部影片;使用 tools/same.sh 证明 16:9 版本未改变(每个静态帧 PSNR = inf);--verify --fmt 9x16;为负责人生成静态帧印相;然后在后台运行 --fmt 9x16 最终版,然后运行 --mux --fmt 9x16。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

film-sound

Add sound to a finished product-film picture with real recorded sound effects (CC0 packs such as Kenney's) placed only on real on-screen events, decide with the owner whether there's a music bed, mix to -14 LUFS and mux into the renders without re-rendering. Stage 4 of product-film. Use when a film's picture is approved and needs sound effects or music, or when the owner says the sounds feel fake, synthetic or "AI slop".

film-storyboard

Write the story of a product film as beats (what the viewer sees, the words on screen, the voice, the sound, why the beat exists, and where each claim is proven) and send it to the owner as a one-page storyboard with frames for review, with 2–4 directions when the story is open. Stage 2 of product-film, and the review format reused for the voiceover. Use when planning a launch/promo film's story, shot list, or script, or when the owner says "give me a storyboard", "give me directions", "I'll review and decide".

film-voiceover

Write, review, test and record the voiceover for a product film after its picture is approved, as a script on a storyboard of the film's real frames, with directions to choose from, an eyes-closed coherence check, a pronunciation test for the product name, TTS recording per section (Fish Audio), phrase placement on the film's timeline, mixing and muxing. Stage 5 of product-film. Use when a launch/promo film needs narration, or the owner says the voiceover sounds like AI, doesn't match the frames, or mispronounces the name.

product-film

Make a product launch / promo / explainer film that sells and does not look or sound AI-made, through review gates the owner signs off one at a time. Study a reference video for its grammar (never copy it), then storyboard, build the film in code, add sound, write and record the voiceover, and deliver 16:9 and 9:16. Use when someone wants a launch video, promo, product film, explainer, ad, "a video like this one" for their product, or says the last video looked like "AI slop" or "vibe coded". Entry point for the film-* skills (film-reference-study, film-storyboard, film-build, film-sound, film-voiceover).

相关技能