andyhuo520/vibe-knowledge / skills/ai-teardown
ai-teardown
Unverified「AI 拆机课」系列课工作室:输入一个主题(AI 产品、开源项目/书、人物历史、软件教程),产出由浅入深、每句话有出处的中文讲解视频系列 + 每节互动版 + 课程总页。流水线:收集资料 → 确认对象与课时 → 大纲 → 逐节旁白(MiMo 克隆音色 + 逐字对齐)→ scenes.json 画面编排(Notion 极简手绘引擎 / 马卡龙模板引擎,IconPark 图标与插画、Noto 动态 emoji、AntV X6 流程图、像素讲解小人、截图圈注、终端录屏)或 film.js 代码成片(cine 引擎:Three.js、粒子、着色器、真片段叠加、曲库配乐)→ Hyperframes / 无头 GPU 逐帧 1080p 渲染 → Artifact 发布 → 课程总页 + 导学视频。触发:做系列课 / 做课程视频 / 把某本书或某个开源项目做成课 / 科普讲解视频 / 教学视频 / 课程地图 / 导学视频 / 互动课件 / 「拆机课」「上手课」「实战课」「编排课」/ 王炸讲解片 / 用真实会话和成片教人做视频。不用于:单支宣传片(用 promo-video)、单张信息图、纯文章写作。
engine/cine/tools/clips.py
View on GitHub#!/usr/bin/env python3
"""从镜头表读出案例片段(film.js 导出的 clips),裁好放进 lessons/<课号>/assets/clips/:<id>.mp4(只取那一段、缩到框的大小、60 帧)+ <id>.jpg(封面,给预览和接触表)。
用法:python3 cine/tools/clips.py <课号> [--port 8964]
clips 每项:{id, src(绝对路径), from(源片起点秒), dur, at(本课第几秒出现), x, y, w, h, audio: "full"|"duck"|"mute", gain?(dB), fade?(秒,0=硬切), poster_at?(秒), seg?(只放源片前 seg 秒,剩下定格)}"""
import subprocess
import sys
from pathlib import Path
from playwright.sync_api import sync_playwright
from browser import launch
ROOT = Path(__file__).resolve().parent.parent.parent
def film_clips(lesson, port):
with sync_playwright() as p:
b = launch(p)
pg = b.new_page(viewport={"width": 1920, "height": 1080})
pg.goto(f"http://127.0.0.1:{port}/cine/index.html?lesson={lesson}&capture")
pg.wait_for_function("window.__film && window.__film.ready", timeout=180000)
c = pg.evaluate("__film.clips")
b.close()
return c
def main():
lesson = sys.argv[1]
port = sys.argv[sys.argv.index("--port") + 1] if "--port" in sys.argv else "8964"
out = ROOT / "lessons" / lesson / "assets" / "clips"
out.mkdir(parents=True, exist_ok=True)
clips = film_clips(lesson, port)
for c in clips:
mp4, jpg, sig = out / f"{c['id']}.mp4", out / f"{c['id']}.jpg", out / f"{c['id']}.sig"
w, h = int(c["w"]) // 2 * 2, int(c["h"]) // 2 * 2
seg = float(c.get("seg", c["dur"])) # seg < dur:源片只放 seg 秒,之后定格在最后一帧
key = f"{c['src']}|{c['from']}|{c['dur']}|{seg}|{w}x{h}" # 起点、时长、框大小变了就重裁
if not mp4.exists() or mp4.stat().st_mtime < Path(c["src"]).stat().st_mtime or not sig.exists() or sig.read_text() != key:
hold = max(0.0, float(c["dur"]) - seg)
vf = f"scale={w}:{h}:force_original_aspect_ratio=increase,crop={w}:{h},fps=60" + (f",tpad=stop_mode=clone:stop_duration={hold:.3f}" if hold > 0.01 else "")
af = ["-af", f"apad=pad_dur={hold:.3f}"] if hold > 0.01 else []
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-ss", str(c["from"]), "-i", c["src"], "-t", f"{seg:.3f}",
"-vf", vf, *af, "-c:v", "libx264", "-preset", "slow", "-crf", "16",
"-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "192k", "-ar", "48000", "-ac", "2", str(mp4)], check=True)
sig.write_text(key)
# 封面:默认取片段第 0.4 秒;poster_at=0 取第一帧(画面里先用封面做飞入动画、落位后无缝换成真视频)
pa = float(c.get("poster_at", min(0.4, c["dur"] / 2)))
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-ss", f"{pa:.3f}", "-i", str(mp4), "-frames:v", "1", "-q:v", "2", str(jpg)], check=True)
print(f"✓ {c['id']} {Path(c['src']).name} {c['from']}s+{c['dur']}s → {w}×{h}")
print(f"→ {out}({len(clips)} 段)")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |