Communitygithub.com

風格萃取 (taste-distillation)

將一組參考影片測量分析,轉換為可重複使用的風格套件 — 包含色彩分級用的 3D LUT、剪輯節奏的鏡頭長度分佈、關鍵影格、疊印合成素材,以及供生成模型使用的文字規格。適用於使用者想捕捉參考影片的視覺風格、建立可重複使用的調性、從參考中萃取資產,或復刻他人風格。

風格萃取 (taste-distillation) 是什麼?

「風格萃取」技能專為 AI 代理設計,能將參考影片自動化分析,產出結構化的「風格套件」資料夾,包含色彩統計 (grade.json)、剪輯節奏 (cadence.json)、33^3 的 3D LUT (look.cube)、由量測資料驅動的 VLM 描述 (spec.json)、關鍵影格、疊印合成素材 (plates/),以及 3D 網格 (props/)。其核心發現是:以提示詞 (prompt) 無法精準傳達調色,實際量測才能做到。技能強調查亮度區塊而非全域的平均值色度分析、使用中位數與中位數絕對偏差 (MAD) 而非平均值與標準差來處理色度分佈的右偏特性,並透過時間變異性自動遮罩靜態介面元素以獲得純淨的量測資料。支援 `mint.py` (純數值分析,無需 API 金鑰,可重現) 與 `distill.py` (調用一次 VLM) 兩個階段。程式碼提供 `--dry-run` 模式,可在不耗費 API 費用的情況下檢查計畫與提示詞。適用於 Claude Code、Codex 等支援檔案系統操作的代理平台。

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

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

風格萃取 (Taste Distillation)

此獨立技能其實作位於 scripts/ 目錄中;後續的生成或本地剪輯請使用 taste-application 技能。請將每個命名風格類型保留在各自的套件中。來自「Flash Ethereal」的量測結果不得被靜默地重複用於「Fluid Sketch」或「3D Cyber Glitch」。量測值為零是有效資料;須將其與欄位缺失區分開來。

本地相依套件位於 scripts/requirements.txt。另外授權的供應商作業還需要 scripts/requirements-live.txt、憑證以及明確的 TASTE_FORGE_ALLOW_LIVE=1。--dry-run 模式不會讀取憑證或提交任務。絕不可因為工作流程儲存在本機端點名稱,就推斷它已被儲存;必須使用實際的供應商方工作流程或請求證據。

將參考影片轉換為風格套件:一個包含量測資料與資產的資料夾,後續階段可確定性地使用。

啟用時機

  • 「捕捉這些片段的外觀」/「萃取氛圍」/「讓這個風格可重複使用」
  • 使用者有參考影片,想要取得 LUT、調色或匹配節奏
  • 建立按類型分類的風格庫
  • 任何若只用「用提示詞描述風格」回答會不足的請求

核心發現

提示詞無法傳達調色。量測可以。

在真實影片上量測:三次付費生成,隨著色彩方向逐步加強,中間調 a* 從 +1.9 → +2.8 → +0.3,而目標是 +24.9;對比度從未離開約 19,目標是 34.7。對同一段影片套用量測好的套件,一次確定性處理就達到色度 MAE 1.88,對比度 33.7,而且免費。

因此區分方式為:模型提供內容、動態與光影結構;套件提供風格。 生成提示詞中的色彩詞彙比無用還糟——它們既花錢,又將渲染推向 LUT 所需的中性基底的反方向。請在提示詞中明確說明:「色彩:無。渲染中性。調色在之後套用。」

套件內容

stylepacks/<類型>/  
  grade.json      量測的色彩統計(見下方)  
  cadence.json   每個偵測到的鏡頭邊界與衍生的分佈  
  look.cube       33^3 LUT,可直接拖入 DaVinci 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* 偏移數學上無法代表分區調色 (split-toning)。請在亮度區塊內量測色度(L* 邊界 [0,15,35,55,75,100])。

一個真實的特徵:在 L25 處呈現紫色 (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 chroma>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。
  • 色域壓縮在 MAE 相同的情況下,耗時增加了 3.8 倍。請設為可選。

反模式

避免做法原因
針對合成測試影片調整一個專案上導致四個不同的錯誤結論;真實影片推翻了每一個
只相信 MAE在一個明顯有問題的影格上,1.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.

相關技能