Communitygithub.com

Anhvu1107/all-agent-skill

在請求與 Videodb 相關時務必使用此技能:影片與音訊的感知、索引與編輯。

all-agent-skill 是什麼?

這項技能專為處理影片與音訊的感知、索引、搜尋及時間軸編輯而設計,適用於檔案、URL、桌面會話或即時串流。它整合了一套完整的工作流程,包含攝取、理解、檢索與媒體操作。支援的功能包括桌面畫面與音訊捕捉、即時警報觸發、會話摘要與可播放的證據連結;影片/音訊的索引與時間戳記搜尋;字幕生成與燒錄;文字/影像覆疊;背景音樂與配音;以及即時 RTSP 串流的監控與事件警示。程式碼範例使用 VideoDB Python SDK,強調正確的錯誤處理(例如偵測重複索引、處理空搜尋結果、驗證時間軸時間戳記的有效性)。此技能在多個平台上皆可使用,並透過 SKILL.md 文件提供詳細的 API 參考與開發指引。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/videodb

在你喜歡的 AI 中提問

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

說明文件

選擇性閱讀規則

從以下開始:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

然後僅載入與使用者實際任務相符的繼承文件、腳本、資源或範例。

為影片、即時串流和桌面會話提供感知 + 記憶 + 操作功能。

當您需要以下功能時,請使用此技能:

使用時機

  • 您需要從檔案、URL、桌面會話或即時串流進行影片或音訊的感知、索引、搜尋或時間軸編輯。
  • 任務涉及時間戳記、可搜尋的證據、字幕、片段、覆疊或即時監控警報。
  • 您希望一個工作流程能結合攝取、理解、檢索和媒體操作。

1) 桌面感知

  • 啟動/停止一個桌面會話,捕捉螢幕、麥克風和系統音訊
  • 串流即時上下文並儲存情節式會話記憶
  • 根據說話內容和螢幕上發生的事件執行即時警報/觸發器
  • 產出會話摘要、可搜尋的時間軸和可播放的證據連結

2) 影片攝取 + 串流

  • 攝取檔案或 URL 並回傳一個可播放的網路串流連結
  • 轉碼/標準化:編碼格式、位元率、影格率、解析度、長寬比

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

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

4) 時間軸編輯 + 生成

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

5) 即時串流 (RTSP) + 監控

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

常見輸入

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

常見輸出

  • 串流 URL
  • 帶有時間戳記和證據連結的搜尋結果
  • 生成的資源:字幕、音訊、圖片、片段
  • 即時串流的事件/警報負載
  • 桌面會話摘要和記憶條目

典型提示(範例)

  • "啟動桌面捕捉,並在密碼欄位出現時發出警報。"
  • "錄製我的會話,並在結束時產出可操作的摘要。"
  • "攝取這個檔案並回傳一個可播放的串流連結。"
  • "索引這個資料夾並找出所有包含人物的場景,回傳時間戳記。"
  • "生成字幕,燒錄進去,並加上輕柔的背景音樂。"
  • "連接這個 RTSP 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"Videos: {len(coll.get_videos())}")
EOF

設定

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

1. 安裝 SDK

pip install "videodb[capture]" python-dotenv

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

pip install videodb python-dotenv

2. 設定 API 金鑰

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

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

在 https://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("product demo")
    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="Describe the visual content in this scene.",
    )
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="person writing on a whiteboard",
        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="The End", 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 上修剪影片,然後對較短的結果進行調整
from videodb import ReframeMode

# 始終優先調整短片段的長寬比:
reframed = video.reframe(start=0, end=60, target="vertical", mode=ReframeMode.smart)

# 全長影片的非同步調整(回傳 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="a sunset over mountains",
    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}")

常見陷阱

情境錯誤訊息解決方案
對已索引的影片再次索引Spoken word index for video already exists使用 video.index_spoken_words(force=True) 在已索引時跳過
場景索引已存在Scene index with id XXXX already exists使用 re.search(r"id\s+([a-f0-9]+)", str(e)) 從錯誤中擷取現有的 scene_index_id
搜尋找不到相符項目InvalidRequestError: No results found捕獲例外並視為空結果 (shots = [])
調整長寬比超時長影片會無限期阻塞使用 start/end 限制片段,或傳遞 callback_url 進行非同步處理
Timeline 上的負時間戳記會靜默產生損壞的串流在建立 VideoAsset 之前務必驗證 start >= 0
generate_video() / create_collection() 失敗Operation not allowed 或 maximum limit方案限制功能 — 告知使用者方案限制

其他文件

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

螢幕錄製(桌面捕捉)

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

快速開始

  1. 啟動監聽器:python scripts/ws_listener.py &
  2. 取得 WebSocket ID:cat /tmp/videodb_ws_id
  3. 執行捕捉程式碼(請參閱 reference/capture.md 了解完整工作流程)
  4. 事件寫入至:/tmp/videodb_events.jsonl

查詢事件

import json
events = [json.loads(l) for l in open("/tmp/videodb_events.jsonl")]

# 取得所有轉錄稿
transcripts = [e["data"]["text"] for e in events if e.get("channel") == "transcript"]

# 取得最近 5 分鐘的視覺描述
import time
cutoff = time.time() - 300
recent_visual = [e for e in events 
                 if e.get("channel") == "visual_index" and e["unix_ts"] > cutoff]

實用腳本

如需完整的捕捉工作流程,請參閱 reference/capture.md。

當 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()

儲存庫

https://github.com/video-db/skills

維護者: VideoDB

限制

  • 僅在任務明確符合上述範圍時使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代品。
  • 如果缺少所需的輸入、權限、安全邊界或成功標準,請停下來並要求釐清。

Individual skills in this repo

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

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

相關技能