⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
xilo-opus-video
>-
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
xilo-opus-video
用 Claude Opus 5.5 写代码做视频:先给你三个方案和预览,你挑一个,它再把视频做出来。
Canvas / HTML·CSS·SVG / WebGL 着色器 / Three.js / Remotion / HyperFrames / Manim | 代码合成配乐 | Claude Code Skill
这个仓库是什么
Opus 5.5 自己不会生成视频。推特上那些刷屏的像素动画、界面动效、游戏史短片,其实是它写了一个会自己动的网页,再一帧一帧截图拍成的视频。
直接丢一句话过去让它做,效果好不好基本靠运气:它怎么规划的你不知道,这次做得好,下次换个主题就不一定了。
xilo-opus-video 把这件事拆成了能确认、能复用的几步:
- 先问你要做什么:一个想法、一篇文章、一个产品网址、一个代码库,或者一条参考视频都可以
- 给三个方案:风格、技术组合、逐镜头的画面概括、声音、预计渲染时间,三个方案刻意拉开差别
- 每个方案出预览:一张关键帧,或者一段 2–4 秒的小样
- 你确认以后再做:先把确认的方案写成
brief.md(一份结构化提示词,可以复用),再按它逐个镜头制作、逐个镜头出静帧自检,最后渲染成 MP4
示例:同一个需求,三个方案的预览
需求是「做一条 12 秒的短视频,介绍 xilo-opus-video 这个 Skill,16:9,不配音,配乐用代码合成,风格你来定」。skill 给出的三个方案预览如下,每张都是代码渲染出来的。
方案 A · 界面动效(HTML/CSS/SVG + 弹簧动画)

方案 B · 像素卡带(Canvas 2D 像素画面 → WebGL CRT 着色器)
![]()
方案 C · 一条线(SVG 描线 + 一镜到底的跟随镜头,3 秒小样抽帧)

适合做什么
- 产品宣传片、功能演示、发布会风格的动效短片
- 知识讲解、历史回顾、数据故事
- 像素风、复古电视、手绘、界面动效这类风格化短片
- 照着一条参考视频的结构和手法,做一条自己的
- 已经有视频模型生成的绿幕人物,想用代码给它搭场景、加大字和动效
不适合:
- 直接生成写实画面(这需要视频模型,本 skill 只负责代码这一层)
- 在剪映、Premiere、AE 里剪辑现成素材
- 给已有视频加字幕
安装
在 Claude Code 里直接说:
帮我安装这个 Skill:https://github.com/Kianzzz/xilo-opus-video
或者用 skills 命令行:
npx skills add Kianzzz/xilo-opus-video
或者手动复制:
git clone https://github.com/Kianzzz/xilo-opus-video.git
cp -r xilo-opus-video/skills/xilo-opus-video ~/.claude/skills/
需要的环境
- Python 3.9+,以及
numpy、playwright(python3 -m pip install numpy playwright) - FFmpeg
- 一个 Chromium 内核的浏览器:
python3 -m playwright install chromium,或者装了 Google Chrome 也可以
第一次使用时 skill 会运行 scripts/check_env.py 检查一遍,缺什么会告诉你怎么装。
怎么用
装好以后,直接跟 Claude 说你想做什么:
帮我做一条 30 秒的产品宣传片,产品是 https://example.com,16:9,配乐用代码合成
这是我的一篇文章(附上文字),帮我做成一条 60 秒的竖屏知识讲解视频
参考这条视频的节奏和转场,做一条介绍我们 App 新功能的 15 秒视频(附上视频文件)
所有产出放在当前目录的 opus-video/<项目名>/ 下:
source/ 原材料、参考视频抽帧和分析
previews/ 三个方案的预览
brief.md 确认后的完整方案(结构化提示词,可以复用)
index.html 成片的画面代码
audio/ 合成的配乐和音效
qa/ 自检用的静帧和抽帧图
out/ 成片 MP4
里面有什么
skills/xilo-opus-video/
SKILL.md 流程:问需求 → 三个方案 → 预览 → 确认 → brief → 制作 → 验收
references/
code-stack.md 八种代码各自擅长什么,风格和技术组合怎么对应
plan-format.md 三个方案的写法和预览规则
brief-template.md 七块结构的提示词模板
craft-rules.md 画面只由时间决定、弹簧分档、多画幅、声音、自检打分、验收清单
scripts/
check_env.py 检查 Python / FFmpeg / Playwright / 浏览器 / WebGL
render.py 逐帧渲染:单帧预览、整片、只渲一段、运动模糊、混音
analyze_video.py 视频信息、镜头切换时间点、抽帧拼图(参考视频分析和成片验收都用它)
audio_tools.py 按时间表合成音效、测音乐节拍、响度标准化、波形和频谱图
致谢
这套做法是拆了一批公开案例、再复刻验证以后整理出来的,感谢这些把作品和做法公开出来的作者:
- @twoclipping 开源的界面动效提示词模板(seek(t)、闭式弹簧、节拍网格、子帧运动模糊)
- @kimmonismus 公开的 AI 发展史提示词(先写分镜、每个场景出静帧自检)
- @majidmanzarpour 公开的像素巫师提示词
- @prasenx、@aiwarts、@Gorden_Sun、@AbaneChan 公开的作品和做法
License
MIT
// HOW IT'S BUILT
// FILES
10 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
skills/xilo-opus-video/SKILL.md9.9 KB9d53cb5344c3upstream ↗
--- name: xilo-opus-video description: >- Make videos with code (Canvas / HTML-CSS-SVG / WebGL shaders / Three.js / Remotion / HyperFrames / Manim + code-synthesized sound), rendered frame by frame with Playwright + FFmpeg. Asks what the user wants to make (an idea, source content such as an article, script, product page or codebase, or a reference video), proposes three distinct video plans with shot-by-shot visual summaries, renders a key-frame still or a few-second preview for each, and after the user confirms one, writes the full brief and builds the finished MP4. Use whenever someone wants Claude to make, animate or render a video, motion graphic, animated explainer, product promo, kinetic-typography piece, pixel-art or retro animation, UI motion demo, or wants to recreate the look of a reference video in code — including Chinese requests like「做个视频」「用代码做视频」「做个动效」「做个宣传片」「帮我复刻这个视频」 「Opus 做视频」. Also use when the user has AI-generated character clips (green screen) and wants code-built scenes around them. Not for generating footage with video models, editing in Premiere/CapCut/AE, or subtitling an existing video. --- # xilo-opus-video:用代码做视频 Opus 自己不输出视频。这个 skill 让它写一个会自己动的网页(或 Manim 场景),网页暴露 `render(t)`,由脚本一帧一帧截图,再用 FFmpeg 合成 MP4。声音也用代码合成或接语音模型。 一句话提示词做视频是在抽卡:出来什么样、为什么这样、下次能不能再做出来,都不可控。这个 skill 的做法是**先把规划摆到用户面前,确认了再动手**:三个方案 → 每个方案一张关键帧或几秒预览 → 用户确认 → 写成 `brief.md` → 按 brief 逐镜头制作、逐镜头自检 → 交付。 ## 工作目录 在当前目录下建 `opus-video/<slug>/`,所有东西放在里面: ``` opus-video/<slug>/ source/ 用户给的原材料、参考视频抽帧、分析笔记 previews/ 三个方案的预览(plan-a.png / plan-b.mp4 ...) brief.md 用户确认后的完整方案,也是可以复用的提示词 index.html 成片的画面代码(或 Remotion / HyperFrames / Manim 工程) audio/ 合成的配乐、音效、配音 qa/ 自检用的静帧和抽帧图 out/final.mp4 成片 ``` ## 第 0 步:检查环境 运行一次 `python3 scripts/check_env.py`(路径相对本 skill 目录)。它会检查 python3、ffmpeg、Playwright 以及可用的浏览器,缺什么会告诉你怎么装。缺依赖时先告诉用户要装什么,得到同意再装。 ## 第 1 步:问清楚要做什么 先问用户想做什么,接受三种原材料,给了哪种就用哪种,可以混着给: - **想法**:一句话主题也行,越具体越好 - **原内容**:文章、口播稿、产品网址、产品代码库、数据表 - **参考视频**:本地文件或链接 用户给了现成的音乐时,先运行 `python3 scripts/audio_tools.py beats <音乐文件> > source/beats.json` 测出节拍、重拍和鼓点,方案和分镜都按这张节拍表来排。 只追问会改变方案的信息,一次最多问 3 个:时长、画幅(16:9 / 9:16 / 1:1)、要不要配音、有没有指定的品牌色或字体。用户没说的用合理默认值(30 秒、1920×1080、30fps、代码合成配乐、不配音),在方案里写明,让用户改。 处理原材料: - **原内容**:提炼出核心信息、受众和必须出现的事实。事实只能来自原材料,不确定的就不写,不要替用户编功能、数字、年份。 - **参考视频**:链接需要下载时,先告诉用户文件来源并征得同意再下载。然后运行 `python3 scripts/analyze_video.py <视频> --out source/ref`(`--out` 是文件名前缀,会生成 `source/ref-sheet.png`、`source/ref-info.txt`),它会输出时长、分辨率、帧率、镜头切换时间点和一张抽帧拼图。看拼图,写下参考视频的镜头结构、节奏、配色、字体和用到的代码类型(对照 [references/code-stack.md](references/code-stack.md))。参考视频只学结构和手法,不照搬别人的素材和文案。 ## 第 2 步:给三个方案 读 [references/code-stack.md](references/code-stack.md) 选技术组合,按 [references/plan-format.md](references/plan-format.md) 的格式写三个方案。 三个方案要有明显差别,差别在风格、叙事结构或技术组合上,不能只是换个配色。常见的拉开方式:一个稳妥(最贴近原材料和参考),一个风格化(换一种画面语言),一个结构上大胆(换一种讲法,比如用一个贯穿全片的主角或者一个不切镜头的长镜头)。 每个方案都要写画面概括(逐镜头的一两句话)、技术组合、声音、预计渲染耗时和风险。 ## 第 3 步:给每个方案做预览 预览是为了让用户在花大量时间渲染之前,先看到画面长什么样。预览页面也是 `render(t)` 页面,动手前先读 [references/craft-rules.md](references/craft-rules.md) 的页面骨架和字体两节,后面正式制作时可以直接在预览代码上接着做。 每个方案的预览页只搭一个镜头,时间用这个镜头自己的时间(从 0 开始),不用搭整条时间轴。 - 默认每个方案做 **一张关键帧**:只搭这个方案最有代表性的那一个镜头,用 `python3 scripts/render.py previews/plan-a.html previews/plan-a.png --still 2.0 --size 1920x1080`。 - 方案的卖点在运动本身时(界面变形、节拍卡点、转场),改做 **2–4 秒的小样**:`python3 scripts/render.py previews/plan-b.html previews/plan-b.mp4 --size <方案画幅> --fps 30 --duration 3`。 - 预览做出来后自己先看一遍图,明显的问题(字溢出、元素挤在一起、画面太空)先修,再给用户。 - 方案里的「预计渲染耗时」用预览来估:渲染脚本会打印用时,单帧耗时 × 总帧数 × 子帧数,再乘 1.3 左右留余量。 把三个方案和预览路径一起给用户,请他选一个,或者说要怎么混合、修改。用户要改就回到第 2 或第 3 步,直到确认。 ## 第 4 步:写 brief.md 用户确认后,按 [references/brief-template.md](references/brief-template.md) 写 `brief.md`。它就是这支视频完整的结构化提示词,分 `<role>` `<inputs>` `<direction>` `<structure>` `<build>` `<gotchas>` `<start>` 七块,已经确认的内容全部填实。 这份文件有两个用处:接下来的制作严格按它来;用户以后想复用、换主题、或者拿到别的工具里跑,直接用这份。写完告诉用户文件位置。 ## 第 5 步:制作 制作规则在 [references/craft-rules.md](references/craft-rules.md),动手前把整份读完。最要紧的几条: 1. **画面只由时间决定**。`window.render(t)` 画出第 t 秒;不用 `requestAnimationFrame`、`setTimeout`、CSS transition,随机数带固定种子,帧和帧之间不保存状态。这样任何一帧都能单独重渲,改一个镜头不会影响别的镜头。 2. **一个镜头一个镜头做**。每做完一个镜头,用 `render.py --still` 渲 3 张静帧,自己看:文字有没有溢出、元素有没有重叠、主体够不够大、字停留够不够久。修好再做下一个。30 秒以上的片子,所有镜头搭完后先渲一版 960×540、不加运动模糊的低清小样,节奏和转场对了再精修,精修前别花时间在细节上。 3. **声音和画面用同一张时间表**。先定节拍网格或旁白时间轴,镜头切换和关键动作落在上面;音效放在画面动作发生的那一帧。配音整段合成,不要一句一句拼。 4. **镜头要动**。推、拉、跟随,让主体在画面里足够大;brief 没写镜头的时候,Opus 默认会固定机位,画面容易显得空。 用户点名框架时按框架来(Remotion / HyperFrames / Manim),没点名默认单个 HTML 文件,具体选择见 code-stack.md。 ## 第 6 步:渲染和验收 - 渲染:`python3 scripts/render.py index.html out/video.mp4 --size 1920x1080 --fps 30 --duration 30 --audio audio/mix.wav`,要运动模糊加 `--subframes 4`(渲染时间也会变成 4 倍,先告诉用户)。 - 声音:音效用 `python3 scripts/audio_tools.py sfx timeline.json audio/sfx.wav` 按时间点合成,混好后 `audio_tools.py normalize` 到 -14 LUFS,再用 `audio_tools.py check audio/mix.wav --out qa/audio` 看响度和波形图。 - 验收:`python3 scripts/analyze_video.py out/final.mp4 --out qa/final` 出抽帧图,再加一张手机尺寸的(`--cell-width 360`)。按 craft-rules.md 的「自检打分」给自己打分,列出最严重的 3 个问题和时间点,改完只重渲那几秒,重复到每项 8 分以上,再对照验收清单核对。把每一轮的分数和问题记在 `qa/review_log.md` 里,交付时一起给用户。 - 有问题就回到对应镜头修,只重渲那一段也可以(`--start` / `--duration`),最后再整片合成。 ## 交付 告诉用户:成片路径、`brief.md` 路径、工程目录,以及一段简短说明,包括这次的关键创作决定、已知的不足(比如某个镜头可以更好)、渲染用时。事实类内容里有不确定的地方,单独列出来让用户核对。 ## 遇到这些情况 - **用户想要真人或写实角色**:代码画不出来。可以建议用户先用视频模型生成**纯绿幕背景**的人物片段,交给本 skill 抠像,再用代码搭场景、大字和动效,做法见 code-stack.md 的「视频模型角色 + 代码场景」。 - **渲染太慢**:先降分辨率或帧率出小样,确认后再出正式版;运动模糊和 WebGL 后期是最耗时的两项。 - **浏览器里 WebGL 不可用**:`check_env.py` 会提示;先渲一帧确认着色器真的生效了,再渲整片。 - **用户只想要提示词**:跳过第 5、6 步,把 `brief.md` 交给用户即可。skills/xilo-opus-video/scripts/analyze_video.py3.3 KBb951703d93e3upstream ↗
#!/usr/bin/env python3 """Inspect a video: metadata, shot-change timestamps, an evenly spaced contact sheet and optional single frames. Works for reference videos and for checking your own render. analyze_video.py ref.mp4 --out source/ref # sheet + scenes + info analyze_video.py out/final.mp4 --out qa/final --cells 30 analyze_video.py ref.mp4 --out source/ref --frames 1.5 4 9.2 # also export these seconds as PNG analyze_video.py out/final.mp4 --out qa/phone --cells 15 --cell-width 360 # phone-size readability test Writes <out>-sheet.png, <out>-info.txt and prints the same summary. The contact sheet is read left-to-right, top-to-bottom; cell k is at k * step seconds. """ import argparse, json, pathlib, re, subprocess def run(cmd): return subprocess.run(cmd, capture_output=True, text=True) def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("video"); ap.add_argument("--out", required=True, help="output prefix, e.g. source/ref") ap.add_argument("--cells", type=int, default=20, help="frames in the contact sheet") ap.add_argument("--scene", type=float, default=0.3, help="shot-change threshold (0-1)") ap.add_argument("--frames", type=float, nargs="*", default=[], help="seconds to export as full-size PNG") ap.add_argument("--cell-width", type=int, help="width of each sheet cell; 360 = phone test") a = ap.parse_args() out = pathlib.Path(a.out); out.parent.mkdir(parents=True, exist_ok=True) probe = json.loads(run(["ffprobe", "-v", "error", "-print_format", "json", "-show_format", "-show_streams", a.video]).stdout) v = next(s for s in probe["streams"] if s["codec_type"] == "video") has_audio = any(s["codec_type"] == "audio" for s in probe["streams"]) dur = float(probe["format"]["duration"]) num, den = map(int, v["r_frame_rate"].split("/")) fps = num / den if den else 0 cols = 5 if a.cells > 12 else 4 rows = -(-a.cells // cols) step = dur / a.cells width = a.cell_width or 1600 // cols sheet = f"{out}-sheet.png" run(["ffmpeg", "-v", "error", "-y", "-i", a.video, "-vf", f"fps={a.cells}/{dur},scale={width}:-2,tile={cols}x{rows}", "-frames:v", "1", sheet]) det = run(["ffmpeg", "-v", "info", "-i", a.video, "-vf", f"select='gt(scene,{a.scene})',showinfo", "-an", "-f", "null", "-"]) cuts = [round(float(m), 2) for m in re.findall(r"pts_time:([\d.]+)", det.stderr)] for t in a.frames: run(["ffmpeg", "-v", "error", "-y", "-ss", str(t), "-i", a.video, "-frames:v", "1", f"{out}-t{t:g}.png"]) lines = [ f"file: {a.video}", f"duration: {dur:.2f}s size: {v['width']}x{v['height']} fps: {fps:.2f} audio: {'yes' if has_audio else 'no'}", f"contact sheet: {sheet} ({cols}x{rows}, one cell every {step:.2f}s)", f"shot changes ({len(cuts)}): {', '.join(map(str, cuts)) or 'none detected'}", ] if cuts: bounds = [0.0] + cuts + [dur] lens = [round(b - a_, 2) for a_, b in zip(bounds, bounds[1:])] lines.append(f"average shot length: {sum(lens) / len(lens):.2f}s") if a.frames: lines.append("frames: " + ", ".join(f"{out}-t{t:g}.png" for t in a.frames)) text = "\n".join(lines) pathlib.Path(f"{out}-info.txt").write_text(text + "\n") print(text) if __name__ == "__main__": main()skills/xilo-opus-video/scripts/audio_tools.py8.7 KB6d9e1de5a9c2upstream ↗
#!/usr/bin/env python3 """Small audio toolkit: synthesize UI/motion sound effects on a timeline, normalize loudness, and draw waveform/spectrum images so the model can check audio it cannot hear. sfx: audio_tools.py sfx timeline.json audio/sfx.wav normalize: audio_tools.py normalize audio/mix.wav audio/mix_norm.wav (-14 LUFS, -1 dBTP) check: audio_tools.py check audio/mix_norm.wav --out qa/audio beats: audio_tools.py beats music.mp3 > audio/beats.json (measure a supplied track) beats.json: {"bpm": 120.0, "beats": [...], "downbeats": [...], "hits": [...]} beats = where state changes go, downbeats = where the big moments go, hits = where SFX go. Uses librosa when installed, otherwise a numpy-only tracker (fine for steady-tempo music). timeline.json: {"duration": 12, "bpm": 120, "beat": "kick", # optional soft pulse on every beat "events": [{"t": 1.0, "sound": "click"}, {"t": 2.0, "sound": "success", "gain": 0.8}, {"t": 3.5, "sound": "whoosh"}, {"t": 4.0, "sound": "pop"}, {"t": 6.0, "sound": "impact"}]} sounds: click, pop, success, whoosh, impact, tick, kick, riser Music itself is better written per project (see references/craft-rules.md); this covers the effects layer. """ import argparse, json, re, subprocess, sys, wave import numpy as np SR = 48000 def env(n, attack=0.002, decay=0.1): x = np.arange(n) / SR return np.minimum(1, x / max(attack, 1e-4)) * np.exp(-x / decay) def tone(freqs, length, decay, attack=0.003): n = int(length * SR); x = np.arange(n) / SR return sum(np.sin(2 * np.pi * f * x) for f in freqs) / len(freqs) * env(n, attack, decay) def noise(length, seed=1): return np.random.default_rng(seed).standard_normal(int(length * SR)) def sweep(f0, f1, length): n = int(length * SR); f = np.geomspace(f0, f1, n) return np.sin(2 * np.pi * np.cumsum(f) / SR) def lowpass(sig, cutoff): a = np.exp(-2 * np.pi * cutoff / SR); out = np.zeros_like(sig); y = 0.0 for i, s in enumerate(sig): y = (1 - a) * s + a * y; out[i] = y return out SOUNDS = { "click": lambda: noise(0.04) * env(int(0.04 * SR), 0.0005, 0.005) * 0.6 + tone([2400], 0.04, 0.008) * 0.6, "tick": lambda: tone([3200], 0.03, 0.006), "pop": lambda: np.concatenate([tone([880], 0.06, 0.03), tone([1175, 1760], 0.4, 0.12)]), "success": lambda: np.concatenate([tone([1318.5], 0.09, 0.06), tone([1318.5, 1975.5], 0.5, 0.15)]), "whoosh": lambda: lowpass(noise(0.45, 7), 2500) * np.hanning(int(0.45 * SR)) * 2.2, "impact": lambda: sweep(160, 38, 0.6) * env(int(0.6 * SR), 0.001, 0.18) + lowpass(noise(0.6, 3), 900) * env(int(0.6 * SR), 0.001, 0.05), "kick": lambda: sweep(140, 45, 0.35) * env(int(0.35 * SR), 0.001, 0.12), "riser": lambda: sweep(200, 1800, 1.2) * np.linspace(0, 1, int(1.2 * SR)) ** 2 * 0.5 + lowpass(noise(1.2, 5), 4000) * np.linspace(0, 1, int(1.2 * SR)) ** 2 * 0.4, } def write_wav(path, sig): peak = np.abs(sig).max() or 1 sig = sig / peak * 0.89 with wave.open(path, "wb") as w: w.setnchannels(1); w.setsampwidth(2); w.setframerate(SR) w.writeframes((sig * 32767).astype(np.int16).tobytes()) def cmd_sfx(a): spec = json.load(open(a.timeline)) out = np.zeros(int(spec["duration"] * SR) + SR) if spec.get("beat"): for t in np.arange(0, spec["duration"], 60 / spec.get("bpm", 120)): s = SOUNDS[spec["beat"]](); i = int(t * SR); out[i:i + len(s)] += s[:len(out) - i] * 0.3 for ev in spec["events"]: if ev["sound"] not in SOUNDS: sys.exit(f"unknown sound {ev['sound']}; choose from {', '.join(SOUNDS)}") s = SOUNDS[ev["sound"]]() i = int(ev["t"] * SR); n = min(len(s), len(out) - i) out[i:i + n] += s[:n] * ev.get("gain", 0.7) write_wav(a.out, out[: int(spec["duration"] * SR)]) print(f"{a.out}: {len(spec['events'])} events, {spec['duration']}s") def cmd_normalize(a): r = subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", a.inp, "-af", "loudnorm=I=-14:TP=-1:LRA=11", "-ar", str(SR), a.out]) sys.exit(r.returncode) def cmd_check(a): st = subprocess.run(["ffmpeg", "-hide_banner", "-i", a.inp, "-af", "ebur128=peak=true", "-f", "null", "-"], capture_output=True, text=True).stderr summary = st[st.rfind("Summary:"):] lufs = re.search(r"I:\s+(-?[\d.]+) LUFS", summary); peak = re.search(r"Peak:\s+(-?[\d.]+) dBFS", summary) subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", a.inp, "-filter_complex", "showwavespic=s=1600x300:split_channels=0", "-frames:v", "1", f"{a.out}-wave.png"]) subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", a.inp, "-lavfi", "showspectrumpic=s=1600x500:legend=1", f"{a.out}-spectrum.png"]) print(f"integrated loudness: {lufs.group(1) if lufs else '?'} LUFS (target -14) true peak: {peak.group(1) if peak else '?'} dBFS (keep below -1)") print(f"images: {a.out}-wave.png, {a.out}-spectrum.png (look for clipping, silence gaps, low-frequency rumble)") def load_mono(path, sr=22050): raw = subprocess.run(["ffmpeg", "-v", "error", "-i", path, "-ac", "1", "-ar", str(sr), "-f", "f32le", "-"], capture_output=True).stdout return np.frombuffer(raw, dtype=np.float32), sr def beats_numpy(y, sr): hop, n_fft = 256, 1024 frames = 1 + (len(y) - n_fft) // hop win = np.hanning(n_fft) spec = np.abs(np.fft.rfft(np.stack([y[i * hop:i * hop + n_fft] * win for i in range(frames)]), axis=1)) flux = np.maximum(0, np.diff(np.log1p(spec), axis=0)).sum(axis=1) onset = np.concatenate([[0], flux]); onset = (onset - onset.mean()) / (onset.std() + 1e-9) fps = sr / hop # tempo: autocorrelation of the onset envelope, 60-180 BPM, mild preference around 120, # refined to a fractional period so the grid does not drift over long tracks ac = np.correlate(onset, onset, mode="full")[len(onset) - 1:] lags = np.arange(int(fps * 60 / 180), int(fps * 60 / 60) + 1) score = ac[lags] * np.exp(-0.5 * (np.log2(60 * fps / lags / 120) / 0.9) ** 2) i = int(np.argmax(score)); period = float(lags[i]) if 0 < i < len(score) - 1: l, c, r = score[i - 1], score[i], score[i + 1] period += 0.5 * (l - r) / (l - 2 * c + r) if (l - 2 * c + r) != 0 else 0 n = len(onset) grid = lambda o: [int(round(o + k * period)) for k in range(int((n - o) / period) + 1) if round(o + k * period) < n] phase = max(range(int(period)), key=lambda o: onset[grid(o)].sum()) # track: predict the next beat from the previous one, snap to a strong onset nearby beats, t, w = [], float(phase), max(2, int(period * 0.12)) while t < n: c = int(round(t)); lo, hi = max(0, c - w), min(n, c + w + 1) j = lo + int(np.argmax(onset[lo:hi])) pos = j if onset[j] > 0.5 else c beats.append(pos); t = pos + period lag = n_fft / 2 / sr # frame index -> time at the window centre beat_t = np.array(beats) / fps + lag down0 = max(range(4), key=lambda k: onset[beats[k::4]].sum()) if len(beats) >= 4 else 0 peaks = [i for i in range(1, n - 1) if onset[i] > 2 and onset[i] >= onset[i - 1] and onset[i] >= onset[i + 1]] hits, last = [], -10**9 for i in peaks: if i - last > fps * 0.1: hits.append(i / fps + lag); last = i return 60 * fps / period, beat_t.tolist(), beat_t[down0::4].tolist(), hits def cmd_beats(a): try: import librosa y, sr = librosa.load(a.inp, sr=None, mono=True) tempo, fr = librosa.beat.beat_track(y=y, sr=sr, units="frames") beats = librosa.frames_to_time(fr, sr=sr).tolist() env_ = librosa.onset.onset_strength(y=y, sr=sr) pk = librosa.util.peak_pick(env_, pre_max=3, post_max=3, pre_avg=3, post_avg=5, delta=0.5, wait=10) bpm, downs, hits = float(np.atleast_1d(tempo)[0]), beats[::4], librosa.frames_to_time(pk, sr=sr).tolist() except ImportError: y, sr = load_mono(a.inp) bpm, beats, downs, hits = beats_numpy(y, sr) r = lambda xs: [round(x, 3) for x in xs] json.dump({"bpm": round(bpm, 2), "beats": r(beats), "downbeats": r(downs), "hits": r(hits)}, sys.stdout, indent=1) print(f"\nbpm {bpm:.1f}, {len(beats)} beats, {len(hits)} hits", file=sys.stderr) ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) sp = ap.add_subparsers(dest="cmd", required=True) p = sp.add_parser("sfx"); p.add_argument("timeline"); p.add_argument("out"); p.set_defaults(fn=cmd_sfx) p = sp.add_parser("normalize"); p.add_argument("inp"); p.add_argument("out"); p.set_defaults(fn=cmd_normalize) p = sp.add_parser("check"); p.add_argument("inp"); p.add_argument("--out", required=True); p.set_defaults(fn=cmd_check) p = sp.add_parser("beats"); p.add_argument("inp"); p.set_defaults(fn=cmd_beats) args = ap.parse_args(); args.fn(args)skills/xilo-opus-video/scripts/check_env.py2.5 KB24c0fc895988upstream ↗
#!/usr/bin/env python3 """Check the tools this skill needs and say how to install what is missing.""" import importlib.util, shutil, subprocess, sys ok = True def report(name, good, fix=""): global ok ok &= good print(f"[{'ok' if good else 'missing'}] {name}" + ("" if good else f" -> {fix}")) report("python3 >= 3.9", sys.version_info >= (3, 9), "install Python 3.9+") report("ffmpeg", bool(shutil.which("ffmpeg")), "macOS: brew install ffmpeg | Windows: winget install ffmpeg | Linux: apt install ffmpeg") report("ffprobe", bool(shutil.which("ffprobe")), "comes with ffmpeg") report("numpy (audio synthesis)", importlib.util.find_spec("numpy") is not None, "python3 -m pip install numpy") has_pw = importlib.util.find_spec("playwright") is not None report("playwright (python)", has_pw, "python3 -m pip install playwright") if has_pw: sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent)) from render import GPU_ARGS # same flags the renderer uses from playwright.sync_api import sync_playwright browser_ok, webgl, skipped = False, False, [] with sync_playwright() as p: for kw in ({}, {"channel": "chrome"}, {"channel": "msedge"}): name = kw.get("channel", "playwright chromium") try: b = p.chromium.launch(headless=True, args=GPU_ARGS, **kw) except Exception: skipped.append(name); continue pg = b.new_page() pg.set_content("<canvas id=c></canvas>") webgl = pg.evaluate("!!document.getElementById('c').getContext('webgl2')") if skipped: print(f"[info] not available: {', '.join(skipped)} -> using {name}") print(f"[ok] browser: {name} {b.version}, WebGL2: {'yes' if webgl else 'no'}") b.close(); browser_ok = True break report("headless browser", browser_ok, "python3 -m playwright install chromium (or install Google Chrome)") if browser_ok and not webgl: print(" note: WebGL2 unavailable, shader and three.js plans will fall back to Canvas 2D") try: subprocess.run(["ffmpeg", "-hide_banner", "-filters"], capture_output=True, text=True).stdout.index("chromakey") print("[ok] ffmpeg chromakey (green-screen compositing)") except ValueError: print("[warn] ffmpeg has no chromakey filter; green-screen plans need a fuller ffmpeg build") print("\nready" if ok else "\nsome tools are missing, see above") sys.exit(0 if ok else 1)skills/xilo-opus-video/scripts/render.py4.4 KB4a7604880506upstream ↗
#!/usr/bin/env python3 """Frame-by-frame renderer for pages that expose window.render(t). The page must define `window.render = (t) => {...}` that draws the frame at t seconds. Optionally it can set `window.ready = false` while loading assets and flip it to true. Examples still: render.py page.html shot.png --still 2.5 --size 1920x1080 video: render.py page.html out.mp4 --size 1920x1080 --fps 30 --duration 12 --audio mix.wav blur: render.py page.html out.mp4 --size 1440x1440 --fps 60 --duration 14 --subframes 4 segment: render.py page.html seg.mp4 --size 1920x1080 --fps 30 --start 8 --duration 4 Query strings are allowed: render.py "page.html?raw=1" out.mp4 ... """ import argparse, pathlib, subprocess, sys, time from playwright.sync_api import sync_playwright GPU_ARGS = ["--enable-gpu", "--ignore-gpu-blocklist", "--enable-unsafe-swiftshader"] if sys.platform == "darwin": GPU_ARGS.append("--use-angle=metal") def launch(p): """Prefer Playwright's own Chromium; fall back to an installed Chrome / Edge.""" errors = [] for kw in ({}, {"channel": "chrome"}, {"channel": "msedge"}): try: return p.chromium.launch(headless=True, args=GPU_ARGS, **kw) except Exception as e: # try the next browser errors.append(f"{kw or 'bundled chromium'}: {str(e).splitlines()[0]}") sys.exit("No usable browser. Run `python3 -m playwright install chromium` or install Google Chrome.\n" + "\n".join(errors)) def page_url(arg): path, _, query = arg.partition("?") return pathlib.Path(path).resolve().as_uri() + (f"?{query}" if query else "") def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("page"); ap.add_argument("out") ap.add_argument("--size", default="1920x1080", help="WIDTHxHEIGHT") ap.add_argument("--fps", type=int, default=30) ap.add_argument("--duration", type=float, help="seconds to render (video mode)") ap.add_argument("--start", type=float, default=0.0, help="first second to render") ap.add_argument("--still", type=float, help="render a single PNG at this time") ap.add_argument("--subframes", type=int, default=1, help="samples per frame blended into motion blur") ap.add_argument("--audio", help="audio file to mux (trimmed to the video)") ap.add_argument("--crf", type=int, default=16) a = ap.parse_args() W, H = map(int, a.size.lower().split("x")) with sync_playwright() as p: browser = launch(p) pg = browser.new_page(viewport={"width": W, "height": H}, device_scale_factor=1) pg.goto(page_url(a.page)) pg.wait_for_function("typeof window.render === 'function' && (window.ready === undefined || window.ready === true)", timeout=60000) pg.evaluate("document.fonts ? document.fonts.ready.then(() => true) : true") if a.still is not None: pg.evaluate("t => window.render(t)", a.still) pg.screenshot(path=a.out, type="png") print(f"{a.out}: still at t={a.still}s") browser.close(); return if not a.duration: sys.exit("--duration is required for video output") sub = max(1, a.subframes) frames = round(a.fps * a.duration) blur = f"tmix=frames={sub}:weights={' '.join(['1'] * sub)},select='not(mod(n\\,{sub}))'," if sub > 1 else "" cmd = ["ffmpeg", "-v", "error", "-y", "-f", "image2pipe", "-framerate", str(a.fps * sub), "-i", "-"] if a.audio: cmd += ["-ss", str(a.start), "-i", a.audio] cmd += ["-vf", f"{blur}setpts=N/({a.fps}*TB),format=yuv420p", "-r", str(a.fps), "-c:v", "libx264", "-crf", str(a.crf)] if a.audio: cmd += ["-c:a", "aac", "-b:a", "192k", "-shortest"] cmd.append(a.out) ff = subprocess.Popen(cmd, stdin=subprocess.PIPE) t0 = time.time() total = frames * sub for i in range(total): pg.evaluate("t => window.render(t)", a.start + i / (a.fps * sub)) ff.stdin.write(pg.screenshot(type="png")) if i and i % max(1, total // 10) == 0: print(f" {i}/{total} samples, {time.time() - t0:.0f}s", flush=True) browser.close() ff.stdin.close() if ff.wait() != 0: sys.exit("ffmpeg failed") print(f"{a.out}: {frames} frames x {sub} samples, {a.size} @ {a.fps}fps, rendered in {time.time() - t0:.1f}s") if __name__ == "__main__": main()skills/xilo-opus-video/references/brief-template.md2.6 KB3b0ba7e87aceupstream ↗
# brief.md 模板 用户确认方案后,把确认的内容全部填进来。它既是这次制作的依据,也是一份可以复用的提示词:用户拿去换主题、或者放到别的工具里跑,都能直接用。 填写要求:已经确认的内容写实,不留【】;用户没提、用了默认值的,写明是默认值。 ```text <role> 你是一位动态设计师,也是一位创意程序员,擅长用代码做出有设计感的视频。 </role> <inputs> 主题:…… 想让观众记住的一句话:…… 原材料:……(文件路径或链接;参考视频只学结构和手法) 规格:…秒,…×…,…fps 品牌:主色 …,辅色 …,字体 … 声音:配乐 …(BPM …),音效 …,配音 … </inputs> <direction> 风格:…… 整片只用一套风格、一套配色,同一个角色或元素在每个镜头里的样子都一致。 每个镜头只讲一件事,画面上的字少而大,每段文字至少停留 2.5 秒。 动画用缓动或弹簧,不用匀速运动;转场从画面内容里长出来,不用默认的淡入淡出。 镜头:……(推、拉、跟随,主体在画面里足够大) 禁止:……(按这支片子列具体的,比如居中大字加渐变背景的默认风格、所有元素同时淡入、满屏小字) </direction> <structure> 节拍网格 / 旁白时间轴:…… 镜头 1|0.0–3.0s 画面:…… 动作:进场 …,主要动作 …,出场 … 镜头:…… 声音:…… 转场:…… 镜头 2|…… …… </structure> <build> 1. 画面:……(技术组合),不用外部图片和素材(用户提供的除外)。 2. 页面暴露 window.render(t),画出第 t 秒;所有画面只由 t 算出来,随机数带固定种子,不用计时器,帧和帧之间不保存状态。 3. 渲染:Playwright 逐帧调用 render(t) 截图,ffmpeg 合成 MP4。(需要运动模糊:每帧 4 个子帧混合) 4. 声音:……;音效放在画面动作发生的那一帧;配音整段合成;混音后响度 -14 LUFS,峰值低于 -1 dBTP。 5. 每做完一个镜头渲 3 张静帧自己检查:文字溢出、元素重叠、主体大小、文字停留时间,修好再做下一个。 </build> <gotchas> ……(这支片子特有的坑,比如:字体加载完再截图;WebGL 先渲一帧确认生效;绿幕先抠一帧看边缘;循环视频首尾帧完全一致) </gotchas> <start> 按镜头顺序制作,每个镜头完成后先出静帧检查;全部完成后渲染整片,出一张抽帧图验收,再交付。 </start> ```skills/xilo-opus-video/references/code-stack.md4.4 KB013365cb4221upstream ↗
# 代码类型和组合 选技术的原则:**先定画面风格,再选能做出这种风格、最简单的那一种代码**。能用一种做完就不要混三种;要混的时候,按「内容层 → 质感层 → 声音层」叠,每一层单独能跑、单独能检查。 ## 八种代码 | 代码 | 擅长 | 典型画面 | 不适合 | |---|---|---|---| | Canvas 2D | 一笔一笔画的二维画面 | 像素风、扁平插画、手绘线条、粒子、图表 | 大量需要清晰排版的文字(放大会糊,要按设备像素比设画布尺寸) | | HTML / CSS / SVG | 界面和文字 | 界面动效、大字排版、卡片、数据图表、图标描边动画 | 成千上万个粒子、复杂质感 | | WebGL 着色器 | 每个像素单独算颜色的质感 | 老电视弧面和扫描线、胶片颗粒、网点、水面反光、光晕 | 直接画内容(一般先用 Canvas 画内容,再送进着色器) | | Three.js | 3D 场景 | 产品转台、3D 文字、点云、低多边形场景、体素世界 | 写实人物 | | p5.js + p5.brush | 手绘笔触 | 彩铅、水彩、蜡笔绘本 | 需要很快渲染的长片(笔刷很慢,先测单帧耗时) | | GSAP / HyperFrames | 时间轴动画、快节奏动效短片 | 发布会风格、卡点动效 | 用户没装也没点名的时候不要主动引入 | | Remotion(React) | 长片、多场景、需要读产品代码库 | 产品宣传片、知识讲解、历史回顾类短片 | 一次性的十几秒小动效(单个 HTML 更快) | | Manim(Python) | 数学和原理讲解 | 公式推导、坐标轴、图形变换 | 设计感强的品牌动效 | 声音层:配乐和音效用 Python(numpy / scipy)从零合成,或者用用户提供的音乐;配音接语音模型(edge-tts、Kokoro,或用户自己的付费语音),整段合成。 ## 默认选择 - 用户没点名:**单个 HTML 文件 + render(t)**,内容用 Canvas 或 HTML/CSS/SVG,需要质感再加一层 WebGL。 - 用户有产品代码库、要多场景长片、或者点名 React:Remotion。每个场景一个组件,动画全部用当前帧号算。 - 用户点名 HyperFrames:先安装它的 skill(`npx skills add heygen-com/hyperframes`),按它的规范写。 - 数学、物理、算法讲解:Manim,渲染不走浏览器,用 Manim 自己的命令出视频,再用 FFmpeg 混声音。 ## 风格 → 组合速查 | 想要的效果 | 组合 | 参考的公开案例(学手法,不照搬) | |---|---|---| | 像素动画 | Canvas 2D 小画布(如 128×96)整数倍放大 + 姿势按 8–12fps 量化 | @majidmanzarpour 的像素巫师 | | 高级感界面动效 | HTML/CSS/SVG + 闭式弹簧 + 节拍网格 + 4 子帧运动模糊 + 合成界面音效 | @twoclipping 开源的界面变形模板 | | 动效作品集 / 片头 | HTML 大字排版 + SVG 手写标注 + Canvas 粒子 + 合成音效 | 「15 秒动效作品集」一句话提示词的一批作品 | | 复古游戏 / 老电视 | Canvas 像素内容 → WebGL CRT 着色器(弧面、扫描线、荧光点、光晕) | @prasenx 的游戏史短片 | | 年代跨度大的历史片 | 每个年代换一种画法:Canvas 像素、着色器质感、Three.js 3D,统一配乐贯穿 | @prasenx 的游戏史短片 | | 知识叙事长片 | Remotion + SVG/Canvas 场景 + 一个贯穿全片的视觉主角 + 旁白 + 合成配乐 | @kimmonismus 的 AI 发展史 | | 产品宣传片 | Remotion 或 HTML + Playwright 实拍产品网页截图并记录元素坐标 + 镜头推到真实按钮上 | @aiwarts 的 GoodCase 宣传片 | ## 视频模型角色 + 代码场景 代码画不好写实人物和复杂的舞蹈动作。这时候让视频模型只负责人物,其他全部用代码: 1. 用户用视频模型(Grok、即梦、可灵、Seedance 等)生成人物片段,**要求纯绿色背景**,人物全身入镜、不要出画。 2. 抠像:`ffmpeg -i dancer.mp4 -vf "chromakey=0x19FF0A:0.16:0.08,despill=type=green" ...`,颜色值用抽帧里绿幕的实际颜色;先抠一帧给用户看边缘。 3. 背景、大字、贴纸、分屏、3D 环绕文字用代码做成一层视频(render.py 渲染)。 4. 用 FFmpeg `overlay` 把人物叠上去;分屏就是同一段人物错开几帧叠多次。 5. 节拍:分析音乐节拍,背景和大字每一拍变一次,人物片段本身不用改。 公开案例:@Gorden_Sun 的甜酷舞蹈(Grok 绿幕人物 + 网页动效背景)、@AbaneChan 的股票主题自我介绍(Grok 生成三段舞蹈 + 作品集提示词)。skills/xilo-opus-video/references/craft-rules.md7.4 KB7e03b959ce77upstream ↗
# 制作规则 ## 页面骨架 ```html <script> window.ready = false; // 字体、图片、模型加载完再置为 true window.render = function (t) { // t 单位是秒 // 1. 由 t 算出每个元素的状态(位置、缩放、透明度、颜色……) // 2. 画出来 / 写进 style }; document.fonts.ready.then(() => { window.render(0); window.ready = true; }); </script> ``` ## 字体 - 中文字体按系统有差别:macOS 有 PingFang SC,Windows 有 Microsoft YaHei,Linux 常见 Noto Sans CJK。CSS 里写成一串兜底:`"PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif`。 - 要在不同机器上渲染出一样的效果,就把字体文件放进项目目录用 `@font-face` 本地加载(比如开源的思源黑体 / Noto Sans SC),不要依赖网络字体;`window.ready` 等 `document.fonts.ready` 之后再置为 true。 - 像素风里的中文:先在小画布上用正常字体画,再按透明度取阈值(比如 alpha > 0.5 算实心)变成硬边像素;中文字号在逻辑画布上至少 18px,否则笔画会糊成一团。 - Canvas 里写字要等字体加载完,否则前几帧会用默认字体。 为什么画面只能由 t 决定:渲染脚本会按任意顺序、任意次数调用 render(t)(单帧预览、只重渲某一段、运动模糊的子帧)。只要有一点状态藏在上一帧里(累加的位置、计时器、未设种子的随机数),重渲出来的画面就会跟上一次不一样。 - 随机:用 `rnd(seed)` 这种由种子算出来的伪随机,不用 `Math.random()`。 - 需要累积的模拟(粒子物理、水面):用固定步长从 0 推算到 t,或者改成解析公式;按顺序渲染时可以缓存,但单帧预览必须也能算对。 - CSS:不用 transition 和 animation,所有样式在 render(t) 里直接写。 - 手绘质感:笔触的随机种子用 `floor(t * 12)`,笔触每秒只变 12 次,看起来像手绘动画;镜头运动仍然每帧平滑。 ## 常用动画工具 - 缓动:`smoothstep` 或 cubic in-out 就够,匀速运动看起来很机械。 - 弹簧(闭式解,不依赖上一帧): ```js function spring(x, w = 16, z = 0.72) { // x = 距离目标改变的时间(秒) if (x <= 0) return 0; const wd = w * Math.sqrt(1 - z * z); return 1 - Math.exp(-z * w * x) * (Math.cos(wd * x) + (z * w / wd) * Math.sin(wd * x)); } // 值多次改变目标:v(t) = v0 + Σ (v_i − v_{i−1}) · spring(t − t_i) ``` 按用途分四档,同一支片子里同类元素用同一档: | 用途 | 手感 | 参考参数 | |---|---|---| | 按钮、开关、指示条的前沿 | 快、利落 | w 22–26,z 0.75–0.85 | | 卡片、容器、镜头 | 默认 | w 14–16,z 0.7–0.75 | | 大字、3D 物体、Logo 定版 | 沉、几乎不回弹 | w 9–11,z 0.85–1 | | 吉祥物、贴纸 | 活泼、明显回弹 | w 16–20,z 0.4–0.5 | 一个值会多次改变目标(光标位置、容器宽度)时,不要重启弹簧,用上面的叠加写法,这样动作是连续的,而且第 812 帧也能单独算出来。 - 节拍:BPM → 每拍秒数 `60 / BPM`;关键动作放在拍点上,重拍(每小节第一拍)放最大的变化。 - 运动模糊:`render.py --subframes 4`,渲染时间变成 4 倍,只在快速运动多的片子里用。 ## 画面 - 镜头:写清楚推、拉、跟随,主体至少占画面三分之一;没写的话默认会固定机位,画面容易空。 - 文字:一屏最多一句,至少停留 2.5 秒;在变形容器里切换的文字要有自己的进场和出场时间,否则新旧文字会叠在一起。 - 被缩放的元素、会渲染文字的元素,不要加 `will-change`,文字会糊。 - Canvas:画布尺寸按设备像素比设置;像素风关闭平滑(`imageSmoothingEnabled = false`),坐标取整。 - WebGL:`getContext('webgl2', { preserveDrawingBuffer: true })`,每帧画完调用 `gl.finish()`;先渲一帧确认着色器真的生效了,再渲整片。 - 循环视频:最后一帧和第一帧完全一样,包括光标位置和速度。 - 多画幅(9:16 / 1:1 / 16:9):场景按版式函数排,不要写死像素;每个画幅单独调整文字和界面的位置,再从同一条时间轴各渲一版。不要把 16:9 的成片直接裁成竖屏。 - 默认风格要主动避开:深色背景 + 居中大字 + 所有元素淡入淡出,这是没有任何限制时最容易出来的样子。风格本身需要深色时(CRT、夜景、霓虹)照用,但排版和运动要有自己的设计。在 brief 的禁止清单里写明要避开什么。 ## 声音 - 音效:`scripts/audio_tools.py sfx timeline.json audio/sfx.wav`,时间点直接从画面代码里的关键帧时间抄过来,保证对得上。 - 用户给了音乐:先 `audio_tools.py beats` 测出节拍表,状态变化放在 beats 上,大的变化放在 downbeats 上,音效放在 hits 上。 - 配乐:按项目用 numpy 写,鼓(下扫频正弦 + 快衰减)、贝斯、和弦铺底、旋律分轨合成再混;纯正弦很单薄,和弦和旋律叠上泛音、加一点失谐和混响。 - 配音:整段合成,拿到逐句时间戳,再让画面去对旁白;不要一句一句分开合成再拼。 - 混音:配音出现时音乐压低;最后 `audio_tools.py normalize` 到 -14 LUFS。10 秒以内的短音频,单遍标准化的结果可能和目标差 1–2 LU,属于正常范围。 - 检查:`audio_tools.py check` 出响度数值、波形图和频谱图。模型听不到声音,只能看图:看有没有削顶、有没有意外的静音段、低频有没有一直轰着。 ## 自检打分 整片(或一个长片的一章)渲完后,先出抽帧图和手机尺寸抽帧图,用挑毛病的眼光看,别当自己是作者。按下面几项打 1–10 分: | 项 | 看什么 | |---|---| | 开场 | 前 2 秒有没有一个抓人的画面 | | 手机可读 | 缩到 360 像素宽,字还看不看得清 | | 动作 | 有没有匀速滑动、有没有什么都不动的空拍 | | 变化 | 每 2–4 秒有没有新东西出现 | | 构图 | 主体够不够大,画面有没有空一大块或挤成一团 | | 贴合原材料 | 品牌色、字体、事实和 brief 一致 | | 声画同步 | 重拍和音效是不是落在动作上 | 列出最严重的 3 个问题并标上时间点。重点找:切换时新旧文字叠在一起、居中大字加渐变背景的默认画面、角落里多余的标签和边框、缩放后变糊的字、循环接缝处的卡顿。 快速动作附近的问题在抽帧图里容易漏掉,可以把那一段连续 12 帧拼成一条来看: `ffmpeg -ss 4.1 -i out/final.mp4 -vf "scale=320:-1,tile=12x1" -frames:v 1 qa/strip.png` 循环视频把成片连播两遍看接缝:`ffmpeg -stream_loop 1 -i out/final.mp4 -c copy qa/loop_check.mp4` 改完只重渲有问题的那几秒,再出新的抽帧图和新的分数,重复到每项 8 分以上。一般要两三轮,这是正常的。 ## 验收清单 - [ ] 时长、画幅、帧率和 brief 一致,有声音轨 - [ ] 抽帧图里没有空白帧、没有残留在下一个镜头的元素 - [ ] 所有文字都在安全区内,没有溢出、没有被遮挡 - [ ] 同一个角色或元素在每个镜头里样子一致 - [ ] 事实类内容和原材料一致,不确定的已单独列给用户 - [ ] 响度约 -14 LUFS,峰值低于 -1 dBTPskills/xilo-opus-video/references/plan-format.md2.3 KB704d63f6ea88upstream ↗
# 三个方案的写法 三个方案一起给,方便用户对比。每个方案控制在一屏以内,用户扫一眼就能判断喜不喜欢。 ## 格式 ```markdown ### 方案 A:【一个好记的名字】 **一句话**:【这支视频怎么讲、看完留下什么】 **风格**:【画面语言 + 配色(2–4 个色值)+ 字体】 **规格**:【时长】秒 · 【画幅】 · 【帧率】fps **技术组合**:【比如 HTML/CSS/SVG + 弹簧动画 + 代码合成音效】 **画面概括** 1. 0–3s 【开场画面,一两句话】 2. 3–8s 【……】 3. …… (镜头数按时长来,每个镜头至少 2–3 秒:15 秒以内 4–5 个,30 秒 6–10 个,更长的按段落分组;写画面里有什么、怎么动、怎么转到下一个镜头) **声音**:【配乐风格和 BPM / 音效 / 是否配音】 **预计**:渲染约【X】分钟 · 难点【一句话】 **适合**:【为什么这个方案适合这份原材料】 预览:previews/plan-a.png ``` ## 三个方案怎么拉开 - **A 稳妥**:最贴近原材料和参考视频,信息最完整。 - **B 换画面语言**:同样的内容换一种风格,比如从扁平换成像素、从深色科技感换成彩铅手绘。 - **C 换讲法**:结构上大胆一点,比如全片一个贯穿的视觉主角、一个不切镜头的长镜头、倒叙、用一个比喻把整件事讲完。 三个方案的技术组合最好不完全一样,这样预览出来差别明显,用户才好选。 ## 写画面概括要注意 - 写具体画面,「一个黑色胶囊按钮被光标点击,缩成加载圈」,别写「展示产品功能」。 - 原材料里的事实要对得上,数字、名称、功能不要编。 - 每个镜头只讲一件事;字少而大,每段文字至少停留 2.5 秒。短视频放不下那么多字时,减少镜头或让画面自己讲,不要压缩停留时间。 ## 预览 - 默认一张关键帧:挑这个方案里最能代表风格的镜头,只把这一个镜头搭出来(时间从 0 开始算),渲染一张 PNG,画幅用方案的画幅。 - 卖点在运动的方案(变形、卡点、转场)做 2–4 秒小样。 - 预览只是为了看风格,不追求完整,但文字、配色、字体要是真的,不要用占位色块,否则用户没法判断。 - 给用户看之前自己先看一遍预览图。README.mdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/kianzzz-xilo-opus-video-skills-xilo-opus-video.md