Communitygithub.com

VideoDB スキル

ビデオ、ライブストリーム、デスクトップセッションの認識、理解、操作を行います。ローカルファイル、URL、RTSP/ライブフィード、またはデスクトップキャプチャから取り込み、リアルタイムコンテキストと再生可能なストリームリンクを返します。

VideoDB スキル とは?

VideoDB スキルは、AIエージェントがビデオ、ライブストリーム、デスクトップセッションの知覚、記憶、アクションを実行できるようにする包括的なツールです。Claude Code、Cursor、Codexなどの主要なAIエージェントプラットフォームと互換性があり、ローカルファイル、URL、RTSP/ライブフィード、デスクトップキャプチャなど、さまざまなソースからのメディア取り込みをサポートします。このスキルは、フレーム抽出、視覚的・意味的・時間的インデックス作成、タイムスタンプ付きの正確な瞬間検索、自動クリップ生成によるインデックス作成と検索機能を提供します。アクションには、コーデック、FPS、解像度、アスペクト比のトランスコードと正規化、字幕、テキスト/画像オーバーレイ、ブランディング、オーディオオーバーレイ、吹き替え、翻訳などのタイムライン編集、画像、オーディオ、ビデオのメディアアセット生成、ライブストリームやデスクトップキャプチャからのイベントに対するリアルタイムアラートが含まれます。VideoDB Python SDKと統合されており、APIキー管理、エラーハンドリング、コード例に関する明確なガイダンスを提供し、効率的なワークフロー実装を実現します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/affaan-m/everything-claude-code/videodb

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

VideoDB スキル は何をしますか?

ビデオ、ライブストリーム、デスクトップセッションの知覚 + 記憶 + アクション。

使用するタイミング

デスクトップ知覚

  • デスクトップセッションを開始/停止し、画面、マイク、システムオーディオをキャプチャ
  • ライブコンテキストをストリーミングし、エピソード的セッション記憶を保存
  • 発言内容や画面の状態に基づいてリアルタイムアラート/トリガーを実行
  • セッションサマリー、検索可能なタイムライン、再生可能な証拠リンクを生成

ビデオ取り込み + ストリーム

  • ファイルまたはURLを取り込み、再生可能なWebストリームリンクを返す
  • トランスコード/正規化: コーデック、ビットレート、FPS、解像度、アスペクト比

インデックス + 検索(タイムスタンプ + 証拠)

  • 視覚的、音声、キーワードのインデックスを構築
  • タイムスタンプと再生可能な証拠付きで正確な瞬間を検索
  • 検索結果から自動的にクリップを作成

タイムライン編集 + 生成

  • 字幕: 生成、翻訳、焼き込み
  • オーバーレイ: テキスト/画像/ブランディング、モーションキャプション
  • オーディオ: 背景音楽、ナレーション、吹き替え
  • タイムライン操作によるプログラム的な合成とエクスポート

ライブストリーム(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ステートメントを超える場合は、代わりにヒアドキュメントを使用してください:

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

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ファイルに保存

無料のAPIキーはconsole.videodb.ioで取得できます(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 で動画をトリミングし、その短い結果をリフレームする
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="山の上の夕日",
    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 existsvideo.index_spoken_words(force=True) を使用して既存の場合スキップ
シーンインデックスがすでに存在Scene index with id XXXX already existsre.search(r"id\s+([a-f0-9]+)", str(e)) で既存の scene_index_id をエラーから抽出
検索で一致が見つからないInvalidRequestError: No results found例外をキャッチし、空の結果として扱う(shots = [])
リフレームがタイムアウト長い動画で無期限にブロックstart/end でセグメントを制限するか、callback_url で非同期処理
タイムラインで負のタイムスタンプ黙って壊れたストリームを生成VideoAsset を作成する前に常に start >= 0 を検証
generate_video() / create_collection() が失敗Operation not allowed または maximum limitプラン制限付き機能 — ユーザーにプラン制限について通知

使用例

正規プロンプト

  • 「デスクトップキャプチャを開始し、パスワードフィールドが表示されたらアラートを出す」
  • 「セッションを録画し、終了時に実用的なサマリーを生成する」
  • 「このファイルを取り込み、再生可能なストリームリンクを返す」
  • 「このフォルダをインデックスし、人が写っているすべてのシーンを見つけ、タイムスタンプを返す」
  • 「字幕を生成し、焼き込み、軽い背景音楽を追加する」
  • 「このRTSP URLに接続し、人物がゾーンに入ったらアラートを出す」

画面録画(デスクトップキャプチャ)

録画セッション中のWebSocketイベントをキャプチャするには ws_listener.py を使用します。デスクトップキャプチャは 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.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Next.js 16+ uses App Router with Server Components by default. Client Components are only used when interactivity is needed (hooks, event handlers, browser APIs).

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

関連スキル