Communitygithub.com

风格蒸馏

将一组参考视频测量并打包为可复用的风格包——颜色分级生成3D LUT、剪辑节奏生成镜头长度分布、提取关键帧、屏幕混合叠加层以及用于生成模型的文本描述。适用于用户希望捕获参考素材的风格、构建可复现的风格、从参考素材中提取资产或复制他人风格时。

风格蒸馏 是什么?

这是一个名为「风格蒸馏」的AI技能,设计用于将参考视频集转化为结构化的「风格包」(style pack),包含颜色分级(3D LUT)、剪辑节奏分布、关键帧、屏幕混合叠加层以及生成模型文本描述。其核心洞察是:**提示词无法精确传递颜色分级**,而基于测量的方法可以。通过测量参考素材的亮度区域色度、中位数与MAD(而非均值与标准差)、对比度(标准差L*而非白减黑)、背景占比、界面遮罩自适应阈值以及剪辑节奏检测,该技能生成一个可被后续阶段确定性消耗的文件夹。支持平台包括命令行(Python脚本),可离线运行(`mint.py`无需网络或API密钥),也可调用VLM(`distill.py`需要一个API调用)。该技能还包含详细的LUT烘焙说明、反模式警告以及避免常见陷阱(如绝对阈值失败、未遮罩的界面噪声)的覆盖层提取策略。最终输出是一个风格包,可直接用于颜色分级软件(如DaVinci Resolve)或与同系列技能「风格应用」(taste-application)配合使用。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/taste-distillation

在你喜欢的 AI 中提问

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

文档

风格蒸馏 是做什么的?

此独立技能在 scripts/ 中实现了其脚本;后续生成的或本地拍完的剪辑应使用 taste-application 技能。每个命名流派应存放在独立的包中。来自流光幻彩(Flash Ethereal)的测量结果不得静默复用于流墨素描(Fluid Sketch)或3D赛博故障(3D Cyber Glitch)。测量的零值是有效数据;需与缺失字段区分。

本地依赖位于 scripts/requirements.txt 中。单独授权的提供商工作还需要 scripts/requirements-live.txt、凭据和显式的 TASTE_FORGE_ALLOW_LIVE=1。--dry-run 不读取凭据或提交任务。切勿根据本地端点名称推断工作流已保存;应使用实际的提供商端工作流或请求凭证。

将参考视频转化为风格包:一个文件夹,包含后续阶段可确定性消费的测量结果和资产。

何时激活

  • “捕获这些片段的风格” / “提取氛围” / “使其可复现”
  • 用户拥有参考素材,需要LUT、颜色分级或匹配节奏
  • 建立按流派划分的风格库
  • 任何本应回答“在提示词中描述风格”的请求

核心发现

提示词无法传递颜色分级。测量可以。

在真实素材上测量得出:三次付费生成中,颜色方向不断变化(从+1.9 → +2.8 → +0.3),但目标却是**+24.9**;对比度从未超过~19,而目标是34.7。而将测量后的风格包应用于同一素材,一次确定性过程即达到色度MAE为1.88,对比度为33.7,且免费。

因此划分是:模型提供内容、运动和光照结构;风格包提供外观。 生成提示词中的颜色词汇比无用更糟——它们浪费钱,并将渲染推向LUT所需的中性基础之外。在提示词中明确说明:“颜色:无。渲染中性。分级后续应用。”

风格包包含内容

stylepacks/<genre>/
  grade.json      测量的颜色统计(见下文)
  cadence.json    每个检测到的镜头边界及推导出的分布
  look.cube       33^3 LUT,直接拖入Resolve作为节点LUT
  spec.json       VLM描述,基于测量结果
  grounding.txt   提供给VLM的测量事实
  stills/         最长镜头的全分辨率帧(条件图像)
  plates/         提升到黑色背景上的屏幕混合叠加元素
  props/          铸造的GLB网格
  pack.json       清单

运行方式

python mint.py --genre <名称> --refs a.mov b.mov c.mov     # 离线,无需API密钥
python distill.py --genre <名称>                            # 一次VLM调用

mint.py 是纯数值分析——无需网络,无需密钥,确定性,因此风格包可以重新生成而无需备份。

重要的测量指标

按亮度区域而非全局的色度

颜色特征通常只存在于一个亮度波段。全局a(*)/b(*)偏移在数学上无法表示分色调。测量亮度区域内的色度(L* 边缘 [0,15,35,55,75,100])。

一个真实特征:在L(*)25处为紫色(a(*) +24.9,b(*) −17.5),两端接近中性。仅报告最深和最浅区域会将其称为“均匀色偏”——始终输出完整曲线。

中位数 + MAD,而非均值 + 标准差

真实参考集中的色度强烈右偏。在某测量片段上,中间亮度区域的均值色度为36.9,而中位数为17.5,因此基于均值的LUT推送的色度强度是素材实际所需的约3倍。

对比度是L(*)的标准差,而非白减黑

几乎所有真实素材的白减黑范围约为100,无法区分任何内容。

背景占比是首要统计量

记录低于L(*)10的像素比例。分布的任何一个矩都无法捕捉到:一个片段可以拥有正确的均值、标准差和色度,但其黑色部分已被提升为灰色。这正是为什么一个颜色分级在MAE 1.88/对比度33.7时得分,而实际帧却是一片泥泞的紫色混乱。

测量前遮罩界面

屏幕录制的参考素材包含静态元素——黑边、状态栏、点赞图标、字幕文本。所有这些都会像风格一样进入统计量:黑条增加阴影权重,红色心形使a(*)偏紫。时间方差可以干净地分离它们——素材在动,界面不动——因此无需手动裁剪。在真实素材上,这大约保留了65%的像素。

剪辑节奏需要自适应阈值

正确的内容检测阈值取决于素材:高对比度动作参考素材在阈值30时就能清晰切割,而阴郁素材的切割则隐藏其下。从高到低扫描阈值,取能恢复最敏感设置找到的镜头数≥90%的最高阈值——这偏向于真实切割而非噪声。拒绝暗示荒谬剪辑速率(>100/分钟)的阈值;连续摄像机运动会在每一帧触发检测器。

在一次解码过程中运行完整扫描,共享一个StatsManager。朴素版本会为每个阈值重新解码,在60fps源素材上,这意味着数秒与数分钟的区别。

叠加层:资产,而非截图

静帧是整个帧——合成一个静帧只是将第二张图片放在上面。叠加层是将参考素材的图形词汇(光晕、条纹、故障碎片)提升到黑色背景上,使其无需键控即可屏幕混合。

两个陷阱,均在真实素材上遇到:

  1. 绝对阈值失败。 在明亮参考中,L>55 AND 色度>12的选择覆盖约90%的帧,“叠加层”就是整个画面——包括可识别的人脸。按百分位数选择(约前3%),并拒绝任何覆盖超过约22%帧的叠加层。
  2. 按分离度而非亮度排名。 “亮且饱和像素的比例”会将褪色帧排到最前,而将含有一个强烈光晕——实际特征——的黑色帧排到末尾。评分 p99.5(能量)/中位数(能量)。

同时,在评分前进行遮罩:烧入的排版文字明亮、饱和且高对比度,因此未遮罩的运行会产生一个完美的他人标题卡片叠加层。

为VLM提供基础事实

在要求描述之前,将测量结果注入系统提示。没有基础事实时,VLM会在具有+24.9 a(*)色偏的素材上报告“无明显颜色分级,中性”。有基础事实时,它会正确描述色偏并独立推断次要强调色。

禁止模棱两可的词汇(变化多样、混合、动态、一些、常常、中性、或)——模型无法渲染“变化多样的光照”。在代码而非仅提示词中禁止这些词: 大约每三次运行中有一次违反。对每个字段重新询问,在N次尝试后保留最不含糊的答案,而非失败。

值得向用户说明的警告:一旦描述基于测量结果,它就不再是对测量结果的独立检查。

LUT烘焙注意事项

  • LUT只能编码每像素RGB函数。任何依赖于分布的(直方图匹配、百分位锚点)必须在烘焙前简化为常数,否则它会静默测量均匀LUT网格而非素材。
  • cv2.cvtColor(LAB2RGB)内部会进行裁剪,因此使用它的色域外测试报告为0%。手动将Lab→线性sRGB;一个真实测量结果为83.3%超出色域。
  • 使用偏移传输色度,而非仿射。仿射除以源σ会导致过冲——在真实素材上,它将b(*)翻转为+11.6,而目标是−17.5。偏移将MAE从6.23降至2.13。
  • 色域压缩消耗3.8倍运行时间,但MAE相同。设为可选。

反模式

不要原因
用合成测试素材调优在一个项目中导致四个完全错误的结论;真实素材推翻了每一个
仅信任MAE1.88 MAE看起来成功,但帧明显损坏
使用均值/标准差处理色度右偏;推送约3倍过强
仅比较端点区域两端都是近中性,天然如此
描述外观就停止描述用于内容和结构;风格包用于颜色

交接

风格包是接口。一旦存在,使用taste-application技能生成并组合,或将look.cube直接交给调色师。

捆绑代码

此技能中的 scripts/ 是工作实现,而非伪代码。它没有项目特定假设:指向任何参考视频,就能生成风格包。

pip install -r scripts/requirements.txt
export FAL_KEY=...            # 仅在需要调用fal的阶段需要

每个网络调用在TASTE_FORGE_DRY_RUN=1或--dry-run下被存根化,因此无需消耗即可检查计划、提示词、轨道布局和清单。

Individual skills in this repo

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

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能