Communitygithub.com

akshayDev17/ai-解說影片-語音

合成旁白並建立一個影片的精確時間軸。這是「從課程製作解說影片」流程的第四階段——一次性 TTS 基礎元件。

ai-解說影片-語音 是什麼?

這個技能負責整個解說影片製作流程中最關鍵的網路密集型步驟:文字轉語音(TTS)合成與精確時間軸建立。作為「從課程製作解說影片」管線的第四階段(共八階段),它是一個一次性基礎元件:為單一影片生成所有音訊與時間資料後即停止。技能以腳本階段產生的 JSON 腳本為輸入,使用 Gemini TTS API 為每個段落合成 WAV 音訊檔,然後透過 ffprobe 精確測量每個音訊檔的實際持續時間,產生多種輸出:個別段落音訊檔(narration/<seg>.wav)、合併的完整旁白檔(narration.wav)、以及後續階段(畫面時間編排)所需的時間軸 JSON/JS 檔。它具有智慧文字鍵值快取功能:如果旁白文字未改變,重新執行時不會消耗 API 配額,但變更語音、風格或模型參數時需注意舊音訊可能被重複使用。在 Cursor、Claude Code 等支援節點腳本的開發者工具環境中執行,使用方式為 node 命令調用工具有關腳本。

相容平台~Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/akshayDev17/ai-explainer-video/tree/HEAD/skills/craft-video-audio

在你喜歡的 AI 中提問

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

說明文件

製作影片音訊 — TTS 與精確時間軸

屬於 explainer-video-from-coursework 管線的一部分 — 8 個階段中的第 4 階段。這是 基礎元件:它只建立音訊一次然後停止。畫面階段會在需要停留時重新調用它; 這個技能本身永遠不會循環。

管線的工具與畫面主機位於同級的 explainer-video-from-coursework 技能中:請以 node ../explainer-video-from-coursework/tools/<工具>.mjs 的方式執行, 路徑解析會以這個技能所在的資料夾為基準。請從專案根目錄執行,這樣 out/ 暫存區 才會與你的筆記在同一層。

前置需求: out/<名稱>/scripts/<NN>-*.json(來自腳本階段);在機器上,Gemini 金鑰需存放在作業系統的安全儲存區(請參閱 SETUP.md)。

No API key found 錯誤表示金鑰不在 OS 安全儲存區中 — 請將對應的 SETUP.md 步驟告知使用者並重新執行。

node ../explainer-video-from-coursework/tools/build-audio.mjs --script out/<名稱>/scripts/<NN>-*.json \
                           --out out/<名稱>/<NN> --voice Aoede

將 narration/<段>.wav、narration.wav、timeline.json 和 timeline.js 寫入 每個影片的工作目錄。這是唯一需要網路的階段 — 它會消耗 Gemini TTS 金鑰配額。

完成條件: 執行以 0 結束,並為每個段落顯示一個視窗,最後一行輸出 [out] …/timeline.json。

  • 持續時間是測量值,而非估計值 — 每個 WAV 檔都使用 ffprobe 測量;腳本中的 Min 僅作為防護值,這裡的實際數字才是後續階段所繫結的真實長度。
  • 快取以文字為鍵值 — narration/<鍵>.src 儲存了實際念出的文字,因此 在修改措辭後重新執行不會消耗 API 呼叫次數。但快取不涵蓋 --voice、style 或 --model:只要變更其中一個參數,舊音訊就會被靜默重複使用。使用 --force 可 強制重新合成。

維護

如果你修改了這個檔案,或者使用者要求變更這個階段,請告知使用者必須將主要的 explainer-video-from-coursework 技能中**「Stage 4 — /audio」**章節同步更新, 並且在回覆中指名該章節。

Individual skills in this repo

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

akshayDev17/ai-explainer-video

Assemble one video from its segments — render each window silent, concatenate, mux the narration once, and verify. Stage 8 of explainer-video-from-coursework.

akshayDev17/ai-explainer-video

Retitle and curate the videos in an explainer-video plan — write enrichment.json and merge it. Stage 2 of explainer-video-from-coursework; run it alone to retitle an existing plan.

akshayDev17/ai-explainer-video

Decompose a coursework notes directory into an explainer-video plan and prove no content-bearing section is dropped. Stage 1 of explainer-video-from-coursework; run it alone to (re)plan a directory.

akshayDev17/ai-explainer-video

Generate YouTube chapters and English captions for one finished video. Stage 6 of explainer-video-from-coursework.

akshayDev17/ai-explainer-video

Render one scene config over one time window to an MP4 (or a handful of QA stills). Stage 7 of explainer-video-from-coursework — the render primitive.

akshayDev17/ai-explainer-video

Author and iterate the animated visuals for one video's segments. Stage 5 of explainer-video-from-coursework; it re-invokes the audio stage when a beat needs a hold.

akshayDev17/ai-explainer-video

Write and validate the spoken narration for one explainer-video. Stage 3 of explainer-video-from-coursework; run it alone to (re)write a video's script.

akshayDev17/ai-explainer-video

Plan an explainer-video series from a directory of coursework notes — decompose into videos (proving nothing is dropped), retitle and curate, write the narration, synthesize the audio, author the visuals, then render and assemble the finished cut. Use when the user wants to turn structured coursework notes into explainer videos.

相關技能