Create Template Video(中文版) は何をしますか?
把一條中文內容做成 9:16 豎屏短視頻。設計/動效全部由 templates/ 裡的 HyperFrames 模板負責,你只負責寫文字槽位和 script.json。
本機安裝資訊(DSH 環境,務必先讀)
-
PROJECT_DIR =
/Users/ming/.agents/skills/create-template-video-zh(skill 本體 + 流水線 + 模板;node_modules軟鏈到越南語版,依賴共用) -
目錄結構:
SKILL.md、templates/(11 個模板 +CATALOG.md)、src/(CLI/流水線)、package.json、.env(中文 TTS 端點)。 -
工具映射:原文用 Claude Code 工具名,這裡對應 DSH:
WebFetch→web_fetch,Read→read,Write→write,Bash→bash。 -
環境依賴:
ffmpeg/ffprobe✓、Chrome ✓、Node ✓。 -
中文 TTS 已本機部署:OmniVoice(MPS)+ 普通話克隆音色
voice-zh.pt, 跑在 8124 端口(越南語版固定用 8123,兩版互不干擾):bash "$HOME/.agents/skills/create-template-video-zh/scripts/start-tts-zh.sh"腳本會檢查
/health、背景拉起服務並等到就緒(約 4 s),日誌在/tmp/omnivoice-zh.log。起來後先用中文探針確認:curl -s -X POST http://127.0.0.1:8124/tts -H 'Content-Type: application/json' \ -d '{"text":"大家好,這是中文配音測試。"}' -o /tmp/zh-probe.mp3 && ls -l /tmp/zh-probe.mp3000/連不上 = 沒啟動;起不來就停下告訴用戶,不要偽造音訊。 服務目錄與部署筆記:/Users/ming/Documents/dsh_workspace/omnivoice(SETUP.md)。 -
首次渲染會由
npx -y [email protected]下載 HyperFrames(需連網, 每個 scene 約 15–20s;8–10 個 scene 合計 3–5 分鐘)。 -
語言:全片中文。螢幕文案可中英混排(
AI、GPT、Apple保留原文), 但voiceText必須是中文,數字按下面的規則寫成漢字。
Input
1 個參數:新聞 URL(http:///https://)或 .txt 檔案路徑。
Workflow(嚴格按順序)
Step 1–3:取內容 + 建輸出目錄
- URL →
web_fetch抓正文,抽出title、content(正文 800–2000 字)、ogImage(og:image 或 null)、domain。 失敗(付費牆/純 JS/4xx)→ 讓用戶把正文存成.txt再跑,然後停止。 .txt→read讀取;title= 第一行(≤40 字),content= 餘下正文,ogImage=null,domain="local"。slug:優先使用英文或拼音關鍵詞(≤40 字元,[a-z0-9-]),例如xiaomi-17-price、ai-coding-jobs。純中文標題無法直接轉 ASCII 時由你寫拼音; 實在沒有就用zh-video(程式碼裡也有同名回退)。timestamp=YYYYMMDD-HHmm;outputDir=<目前工作區>/videos/<slug>-<timestamp>/—— 放工作區內: 交付方便,也不會污染技能目錄(DSH 沙箱通常只允許寫工作區)。mkdir -p。 音效庫位置由.env的SFX_DIR指向技能內assets/sfx,與輸出目錄解耦; 音效庫為空時該層自動跳過,不影響主流程。
Step 4:讀模板目錄
讀 PROJECT_DIR/templates/CATALOG.md,確認模板與槽位。
只能使用 CATALOG 裡的 templateId。 現有:
HOOK(只用這一個): frame-liquid-bg-hero —— aurora 光斑 + 大標題 + CTA。
BODY(按內容自選,見 Step 5):
frame-vignelli—— 1 個數字,暗炭底 + 紅。frame-pentagram-stat—— 1 個數字/基準,暗底霓虹(瑞士網格、橙色發光數字 + 青色點綴 + 柱狀圖)。frame-bold-poster—— 多行強聲明 + 大字數字。frame-build-minimal—— 短促金句,暗底 + 一個超大加粗詞(橙色 glow,逐字出現)。frame-creative-voltage—— 創意標語,電光藍分割 + 手寫體。frame-glitch-title—— cyberpunk RGB 錯位故障(噪點底),適合突發/科技。frame-aicoding-list—— 清單 2–5 條(每條 icon + 等級標籤),暗色漸變底。frame-aicoding-comparison—— A vs B 對比(兩個漸變卡片 + WIN 徽章 + 數據)。
OUTRO: frame-logo-outro(預設:logo glow + 品牌 + tagline + url);
frame-statement-outro(替代:紙底紅卡)。
11 個模板內建的示例值(
data-composition-variables)已全部換成中文範例, 可以直接在預覽裡看到成片效果,也可以照抄進script.json改。 但渲染時請顯式傳inputs:不傳參數時執行階段拿不到變數,文字會是空的。
Step 5:生成 script.json
{
"version": "1.0",
"renderer": "hyperframes",
"aspect": "9:16",
"metadata": {
"title": "...",
"source": { "url": "...", "domain": "...", "image": null },
"channel": "中文頻道名"
},
"voice": { "provider": "omnivoice", "speed": 1.0 },
"scenes": [
/* 8–12 個 scene:1 hook + 6–10 body + 1 outro */
]
}
provider固定omnivoice(本機 TTS,無需 voiceId/API key)。- 每個 scene:
{ id, type, voiceText, templateId, inputs };inputs必須覆蓋 CATALOG 中該模板的必填槽位。 scenes[0].type = "hook";scenes[-1].type = "outro"(frame-logo-outro)。- 8–12 個 scene;
voiceText合計約 350–450 字(≈90–120s,中文語速約 4.5 字/秒;最終時長以配音為準,流水線按配音對齊)。每個 body scene 30–45 字、只講一個點;一個段落有兩個點就拆成兩個 scene。 目標:每個 scene 停留 6–10s。
內容 → 模板映射:
- hook → 固定
frame-liquid-bg-hero(槽位:kicker, headline, subheadline, cta, brand)。headline預設黃→紫漸變,可用headline_from/headline_to(兩個 hex)改色調。 - body → 由你按內容挑最合適的模板,並且盡量多樣,不要所有 body 用同一個:
frame-vignelli:場景有 1 個要強調的數字(kicker, number, label, note, brand)。frame-pentagram-stat:有 1 個基準/百分比數字 + 柱狀圖感 (label, headline=數字, subtitle, anchor, footer_left, footer_right)。frame-build-minimal:短金句/一個關鍵詞(eyebrow, hero=單個詞, desc, side_left, side_right)。frame-bold-poster:多行強聲明 + 大數字(kicker, date, figure, headline[], standfirst, footer_left, footer_right)。headline第 2 行自動變紅。frame-creative-voltage:創意口號(meta, display_lines, accent_index, script, caption)。frame-glitch-title:突發/科技/驚悚感(title, subtitle)。frame-aicoding-list:清單/對比 2–5 條(title, accent, accent_from, accent_to, subtitle, items[])。每條{icon, title, desc, tag, level}:icon由你挑 emoji (🚫 ⚠️ ✅ ❌ 📈 💡 🔒 🚀 …);level∈danger|warn|good|info決定顏色;tag用中文短標籤(高危 / 注意 / 利好 / 穩健);accent_from/accent_to由你挑兩個 hex。frame-aicoding-comparison:正好對比兩樣(badge, pre, vs, post, left{}, right{})。 每邊{label, from, to, icon?, bullets[], stat?, stat_label?, win?};from/to是漸變兩色 hex(兩邊冷暖對照更好);win: true標出勝者。- 節奏建議:數字場景多時,
frame-vignelli(炭黑+紅/黃)與frame-pentagram-stat(暗霓虹橙/青)交替;非數字場景用frame-build-minimal。
- outro →
frame-logo-outro(brand_name, tagline, primary_url)。
中文排版規則(螢幕文案 inputs)
- **中文比英文/越南語更