Communitygithub.com

Cody-W-Tucker/skills

感知、理解並操作影片與音訊。支援本機檔案、URL、RTSP 即時串流與桌面錄製,提供即時上下文、可播放串流連結、智慧搜尋、時間軸編輯及媒體生成。

skills 是什麼?

這是一套專為 AI 代理人設計的 VideoDB 技能,賦予代理人對影片與音訊的完整「感知 + 記憶 + 行動」能力。它支援多種輸入來源,包含本機檔案、公開 URL、YouTube 連結、RTSP 即時串流以及桌面錄製(螢幕、麥克風、系統音訊)。技能的核心功能涵蓋:即時轉碼與正規化(編碼、幀率、解析度、長寬比)、建立視覺與語意索引、透過時間戳記進行精確搜尋、產生可播放的串流連結與自動剪輯片段。此外,它還提供強大的時間軸編輯管道,可疊加字幕、文字、圖片、品牌標誌、背景音樂、旁白與配音,並能生成全新媒體資產(圖片、影片、音訊)。對於即時串流與桌面監控情境,技能支援設定即時警示與事件觸發。技能以 Python SDK(`videodb` 套件)實現,需設定 `VIDEO_DB_API_KEY` 環境變數。開發者可直接在程式碼中呼叫 SDK 方法,無需依賴 ffmpeg 等本機工具,所有運算皆在 VideoDB 伺服器端完成。技能文件中包含了完整的錯誤處理指引、常見陷阱對照表以及豐富的實際範例,能有效協助開發者快速建構影片處理工作流程。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Cody-W-Tucker/skills/tree/HEAD/skills/videodb

在你喜歡的 AI 中提問

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

說明文件

VideoDB 技能

影片、直播與桌面會話的感知 + 記憶 + 行動。

使用時機

桌面感知

  • 開始/停止桌面會話,捕捉螢幕、麥克風與系統音訊
  • 串流即時上下文並儲存情節性會話記憶
  • 針對畫面內容與語音執行即時警示/觸發
  • 生成會話摘要、可搜尋的時間軸與可播放的證據連結

影片擷取與串流

  • 擷取檔案或 URL,回傳可播放的網路串流連結
  • 轉碼/正規化:編碼格式、位元率、幀率、解析度、長寬比

索引 + 搜尋(時間戳記與證據)

  • 建立視覺、語音與關鍵字索引
  • 搜尋並回傳帶有時間戳記與可播放證據的精確時刻
  • 從搜尋結果自動建立剪輯

時間軸編輯與生成

  • 字幕:生成、翻譯、燒錄
  • 疊加:文字/圖片/品牌標誌、動態字幕
  • 音訊:背景音樂、旁白、配音
  • 透過時間軸操作進行程式化組合與匯出

即時串流(RTSP)+ 監控

  • 連接RTSP/即時來源
  • 執行即時視覺與語音理解,為監控工作流程發出事件/警示

運作方式

常見輸入

  • 本機檔案路徑、公開 URL 或 RTSP URL
  • 桌面錄製請求:開始 / 停止 / 總結會話
  • 所需操作:取得理解上下文、轉碼規格、索引規格、搜尋查詢、剪輯範圍、時間軸編輯、警示規則

常見輸出

  • 串流 URL
  • 包含時間戳記與證據連結的搜尋結果
  • 生成資產:字幕、音訊、圖片、剪輯
  • 即時串流的事件/警示負載
  • 桌面會話摘要與記憶條目

執行 Python 程式碼

執行任何 VideoDB 程式碼前,請先切換至專案目錄並載入環境變數:

from dotenv import load_dotenv
load_dotenv(".env")

import videodb
conn = videodb.connect()

此舉會從以下來源讀取 VIDEO_DB_API_KEY:

  1. 環境變數(若已匯出)
  2. 目前目錄中的專案 .env 檔案

若金鑰遺失,videodb.connect() 會自動拋出 AuthenticationError。

當簡短的單行指令即可完成時,請勿撰寫指令碼檔案。

使用內嵌 Python(python -c "...")時,務必使用格式正確的程式碼——使用分號分隔陳述式並保持可讀性。若超過約 3 個陳述式,請改用 heredoc:

python << 'EOF'
from dotenv import load_dotenv
load_dotenv(".env")

import videodb
conn = videodb.connect()
coll = conn.get_collection()
print(f"影片數量: {len(coll.get_videos())}")
EOF

設定

當使用者要求「設定 videodb」或類似操作時:

1. 安裝 SDK

pip install "videodb[capture]" python-dotenv

若 videodb[capture] 在 Linux 上安裝失敗,請安裝不含 capture 擴充的版本:

pip install videodb python-dotenv

2. 設定 API 金鑰

使用者必須使用任一方法設定 VIDEO_DB_API_KEY:

  • 在終端機中匯出(啟動 Claude 之前):export VIDEO_DB_API_KEY=你的金鑰
  • 專案 .env 檔案:將 VIDEO_DB_API_KEY=你的金鑰 儲存在專案的 .env 檔案中

前往 console.videodb.io 免費取得 API 金鑰(50 次免費上傳,無需信用卡)。

請勿自行讀取、寫入或處理 API 金鑰。務必讓使用者自行設定。

快速參考

上傳媒體

# URL
video = coll.upload(url="https://example.com/video.mp4")

# YouTube
video = coll.upload(url="https://www.youtube.com/watch?v=VIDEO_ID")

# 本機檔案
video = coll.upload(file_path="/path/to/video.mp4")

逐字稿 + 字幕

# force=True 可在影片已建立索引時跳過錯誤
video.index_spoken_words(force=True)
text = video.get_transcript_text()
stream_url = video.add_subtitle()

在影片中搜尋

from videodb.exceptions import InvalidRequestError

video.index_spoken_words(force=True)

# search() 在找不到結果時會拋出 InvalidRequestError。
# 務必使用 try/except 包覆,並將「找不到結果」視為空。
try:
    results = video.search("產品展示")
    shots = results.get_shots()
    stream_url = results.compile()
except InvalidRequestError as e:
    if "No results found" in str(e):
        shots = []
    else:
        raise

場景搜尋

import re
from videodb import SearchType, IndexType, SceneExtractionType
from videodb.exceptions import InvalidRequestError

# index_scenes() 沒有 force 參數——若場景索引已存在則會拋出錯誤。
# 從錯誤訊息中擷取現有的索引 ID。
try:
    scene_index_id = video.index_scenes(
        extraction_type=SceneExtractionType.shot_based,
        prompt="請描述此場景的視覺內容。",
    )
except Exception as e:
    match = re.search(r"id\s+([a-f0-9]+)", str(e))
    if match:
        scene_index_id = match.group(1)
    else:
        raise

# 使用 score_threshold 過濾低相關性雜訊(建議:0.3 以上)
try:
    results = video.search(
        query="有人在白板上書寫",
        search_type=SearchType.semantic,
        index_type=IndexType.scene,
        scene_index_id=scene_index_id,
        score_threshold=0.3,
    )
    shots = results.get_shots()
    stream_url = results.compile()
except InvalidRequestError as e:
    if "No results found" in str(e):
        shots = []
    else:
        raise

時間軸編輯

重要: 建立時間軸前務必驗證時間戳記:

  • start 必須 >= 0(負值會被靜默接受但會產生錯誤輸出)
  • start 必須 < end
  • end 必須 <= video.length
from videodb.timeline import Timeline
from videodb.asset import VideoAsset, TextAsset, TextStyle

timeline = Timeline(conn)
timeline.add_inline(VideoAsset(asset_id=video.id, start=10, end=30))
timeline.add_overlay(0, TextAsset(text="劇終", duration=3, style=TextStyle(fontsize=36)))
stream_url = timeline.generate_stream()

轉碼影片(解析度/品質變更)

from videodb import TranscodeMode, VideoConfig, AudioConfig

# 在伺服器端變更解析度、品質或長寬比
job_id = conn.transcode(
    source="https://example.com/video.mp4",
    callback_url="https://example.com/webhook",
    mode=TranscodeMode.economy,
    video_config=VideoConfig(resolution=720, quality=23, aspect_ratio="16:9"),
    audio_config=AudioConfig(mute=False),
)

調整長寬比(適用於社群平台)

警告: reframe() 是較耗時的伺服器端操作。對於長影片可能需要數分鐘,並可能超時。最佳做法:

  • 盡可能使用 start/end 限制為短片段
  • 對於完整長度的影片,使用 callback_url 進行非同步處理
  • 先在 Timeline 上裁剪影片,再對較短的結果進行 reframe
from videodb import ReframeMode

# 優先對短片段進行 reframe:
reframed = video.reframe(start=0, end=60, target="vertical", mode=ReframeMode.smart)

# 長影片的非同步 reframe(回傳 None,結果透過 webhook 取得):
video.reframe(target="vertical", callback_url="https://example.com/webhook")

# 預設值:"vertical" (9:16)、"square" (1:1)、"landscape" (16:9)
reframed = video.reframe(start=0, end=60, target="square")

# 自訂尺寸
reframed = video.reframe(start=0, end=60, target={"width": 1280, "height": 720})

生成式媒體

image = coll.generate_image(
    prompt="日落下的山脈",
    aspect_ratio="16:9",
)

錯誤處理

from videodb.exceptions import AuthenticationError, InvalidRequestError

try:
    conn = videodb.connect()
except AuthenticationError:
    print("請檢查您的 VIDEO_DB_API_KEY")

try:
    video = coll.upload(url="https://example.com/video.mp4")
except InvalidRequestError as e:
    print(f"上傳失敗: {e}")

常見陷阱

情境錯誤訊息解決方案
對已建立索引的影片再次建立索引該影片的口語文字索引已存在使用 video.index_spoken_words(force=True) 跳過已建立的索引
場景索引已存在場景索引 ID XXXX 已存在使用 re.search(r"id\s+([a-f0-9]+)", str(e)) 從錯誤中擷取現有的 scene_index_id
搜尋無相符結果InvalidRequestError: 找不到結果捕捉例外並視為空結果(shots = [])
Reframe 超時長影片會無限阻塞使用 start/end 限制片段,或傳入 callback_url 進行非同步處理
Timeline 上的負數時間戳記靜默產生損毀的串流建立 VideoAsset 前務必驗證 start >= 0
generate_video() / create_collection() 失敗不允許的操作 或 達到上限此功能取決於方案——告知使用者方案限制

範例

標準提示詞

  • 「開始桌面錄製,並在出現密碼欄位時發出警示。」
  • 「記錄我的會話,並在結束時產生可操作的摘要。」
  • 「擷取此檔案並回傳可播放的串流連結。」
  • 「為此資料夾建立索引,找出所有包含人物的場景,回傳時間戳記。」
  • 「產生字幕、燒錄進去,並加入輕柔的背景音樂。」
  • 「連接此 RTSP URL,並在有人員進入區域時發出警示。」

螢幕錄製(桌面擷取)

使用 ws_listener.py 在錄製會話期間捕捉 WebSocket 事件。桌面擷取僅支援 macOS。

快速入門

  1. 選擇狀態目錄:STATE_DIR="${VIDEODB_EVENTS_DIR:-$HOME/.local/state/videodb}"
  2. 啟動監聽器:VIDEODB_EVENTS_DIR="$STATE_DIR" python scripts/ws_listener.py --clear "$STATE_DIR" &
  3. 取得 WebSocket ID:cat "$STATE_DIR/videodb_ws_id"
  4. 執行擷取程式碼(完整工作流程請參閱 reference/capture.md)
  5. 事件寫入:$STATE_DIR/videodb_events.jsonl

每次開始新的擷取執行時,請使用 --clear,以免舊的逐字稿與視覺事件洩漏到新會話中。

查詢事件

import json
import os
import time
from pathlib import Path

events_dir = Path(os.environ.get("VIDEODB_EVENTS_DIR", Path.home() / ".local" / "state" / "videodb"))
events_file = events_dir / "videodb_events.jsonl"
events = []

if events_file.exists():
    with events_file.open(encoding="utf-8") as handle:
        for line in handle:
            try:
                events.append(json.loads(line))
            except json.JSONDecodeError:
                continue

transcripts = [e["data"]["text"] for e in events if e.get("channel") == "transcript"]
cutoff = time.time() - 300
recent_visual = [
    e for e in events
    if e.get("channel") == "visual_index" and e["unix_ts"] > cutoff
]

其他文件

參考文件位於此 SKILL.md 檔案旁的 reference/ 目錄中。如有需要,請使用 Glob 工具尋找。

當 VideoDB 支援該操作時,請勿使用 ffmpeg、moviepy 或本機編碼工具。以下操作皆由 VideoDB 在伺服器端處理:裁剪、合併片段、疊加音訊或音樂、加入字幕、文字/圖片疊加、轉碼、解析度變更、長寬比轉換、依平台需求調整尺寸、轉錄與媒體生成。僅在 reference/editor.md 中「限制」一節所列的操作(轉場、速度變更、裁切/縮放、調色、音量混合)才回退使用本機工具。

何時使用何種工具

問題VideoDB 解決方案
平台拒絕影片的長寬比或解析度video.reframe() 或使用 VideoConfig 的 conn.transcode()
需要調整影片尺寸以符合 Twitter/Instagram/TikTok 要求video.reframe(target="vertical") 或 target="square"
需要變更解析度(例如 1080p → 720p)使用 VideoConfig(resolution=720) 的 conn.transcode()
需要在影片上疊加音訊/音樂在 Timeline 上使用 AudioAsset
需要加入字幕video.add_subtitle() 或 CaptionAsset
需要合併/裁剪片段在 Timeline 上使用 VideoAsset
需要產生旁白、音樂或音效coll.generate_voice()、generate_music()、generate_sound_effect()

來源

此技能的參考資料位於本機的 skills/videodb/reference/ 目錄下。 請使用上述本機複本,而非在執行時追蹤外部儲存庫連結。

Individual skills in this repo

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

Cody-W-Tucker/skills

Landing page quality assessment for paid advertising campaigns. Evaluates message match, page speed, mobile experience, trust signals, form optimization, and conversion rate potential. Use when user says landing page, post-click experience, landing page audit, conversion rate, or landing page optimization.

Cody-W-Tucker/skills

TikTok Ads deep analysis covering creative quality, tracking, bidding, campaign structure, and TikTok Shop. Evaluates 28 checks with emphasis on creative-first strategy, safe zone compliance, and Smart+ campaigns. Use when user says TikTok Ads, TikTok marketing, TikTok Shop, Spark Ads, Smart+, or TikTok campaign.

Cody-W-Tucker/skills

YouTube Ads specific analysis covering campaign types, creative quality, audience targeting, and measurement. Evaluates video ad performance across skippable, non-skippable, bumper, Shorts, Demand Gen, and Connected TV formats. Covers VAC→Demand Gen migration, Shorts creative requirements, and CTV shoppable ads. Use when user says YouTube Ads, video ads, pre-roll, bumper ads, YouTube campaign, Shorts ads, or CTV ads.

Cody-W-Tucker/skills

Craft the story that makes investors say \"I want in.\" Master the narrative structure that Reid Hoffman, Sequoia, and top founders use to raise capital. Use when: **Preparing to fundraise** to develop your story before the deck; **Investor meetings** to structure conversations that convert; **Pitch practice** to refine your narrative arc; **Cold outreach** to write compelling investor emails; **Pivoting** to reframe your story after a change

Cody-W-Tucker/skills

Identify the best GTM motions and tools across 7 motion types: Inbound, Outbound, Paid Digital, Community, Partners, ABM, and PLG. Use when selecting marketing channels, choosing between inbound and outbound strategy, or planning cross-channel campaigns.

Cody-W-Tucker/skills

Produce a print-grade single-page kami (紙 / 纸) document — warm parchment canvas, ink-blue accent, serif at one weight, no italic, no cool grays. The output reads like a professional white paper or studio one-pager, not an app UI. Multilingual by design (EN · zh-CN · ja). One self-contained HTML file, zero dependencies.

Cody-W-Tucker/skills

Optimize landing pages for maximum conversions using proven frameworks from Unbounce and Oli Gardner—apply the \"one goal, one message, one action\" principle with data-driven design, copy, and CTA best practices. Use when: **Create a new landing page** for a campaign; **Optimize an existing landing page** that isn't converting; **Review landing page design** before launch; **Improve form conversion rates** on lead gen pages; **A/B test landing page elements** systematically

Cody-W-Tucker/skills

Advanced motion patterns for React / Next.js — drag & drop, gestures, text animations, SVG path drawing, custom hooks, imperative sequences (useAnimate), loaders, and the full API decision tree. Requires motion-foundations.

Cody-W-Tucker/skills

Motion tokens, spring presets, performance rules, device adaptation, accessibility enforcement, and SSR safety for React / Next.js using motion/react. Foundation layer — all other motion skills depend on this.

Cody-W-Tucker/skills

A single-frame motion-design composition with looping CSS animations — rotating type ring, animated globe, ticking timer, parallax labels. Renders as a hero video poster you can hand straight to HyperFrames or any keyframe-based exporter. Use when the brief asks for "motion design", "animated hero", "loop", "video poster", "title card", or pairs Open Claude Design with HyperFrames for a kinetic export.

Cody-W-Tucker/skills

Production-ready animation patterns for React / Next.js — button, modal, toast, stagger, page transitions, exit animations, scroll, and layout — built on motion-foundations tokens and springs.

Cody-W-Tucker/skills

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

Cody-W-Tucker/skills

Produce a single-file slide deck in the Atelier Zero visual language (warm-paper background, italic-serif emphasis spans, coral terminating dots, surreal collage plates) — Open Design's brand deck recipe. The deck uses **horizontal magazine-style swipe pagination** (←/→, wheel, swipe), a per-slide chrome strip with brand mark and slide counter, an ESC overview grid, a coral progress bar, and inherits the canonical stylesheet + 16-slot image library from the sister `open-design-landing` skill.

Cody-W-Tucker/skills

Produce a world-class single-page editorial landing site in the Atelier Zero visual language (Monocle / Apartamento / Études editorial collage) — the same aesthetic Open Design uses for its own marketing surface. The agent fills a typed `inputs.json` from a brand brief, optionally generates 16 collage assets via gpt-image-2, then runs a pure-function composer that emits a self-contained HTML file; a separate path can mirror the Astro marketing site in `apps/landing-page/`. Drop-in scroll-reveal motion and a Headroom-style sticky nav are wired automatically.

Cody-W-Tucker/skills

Best practices for Remotion - Video creation in React. 29 domain-specific rules covering 3D, animations, audio, captions, charts, transitions, and more.

Cody-W-Tucker/skills

Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens. Trigger keywords: "saas landing", "marketing page", "product landing".

Cody-W-Tucker/skills

Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens. Trigger keywords: "saas landing", "marketing page", "product landing".

Cody-W-Tucker/skills

Master April Dunford's 8-step sales narrative from \"Sales Pitch\" (2023). Transform your positioning into a compelling story that wins enterprise deals. Use when: Structuring B2B sales presentations and demos; Creating pitch decks for complex products; Training sales teams on narrative-driven selling; Converting positioning strategy into sales conversations; Winning against entrenched competitors

Cody-W-Tucker/skills

Swiss-style user-research narrative template in warm-paper editorial aesthetics. Use when users ask for a premium research deck or story-first live artifact with minimalist typography, high-clarity layout, subtle motion, donut breakdowns, and keyboard/click navigation across slides in a single HTML file.

Cody-W-Tucker/skills

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

相關技能