docs/ja-JP/skills/videodb/SKILL.md
ビデオとオーディオの表示、理解、アクション。表示:ローカルファイル、URL、RTSP/ライブストリーム、またはリアルタイムのデスクトップ録画からコンテンツを取得し、リアルタイムコンテキストと再生可能なストリームリンクを返す。理解:フレームを抽出し、ビジュアル/セマンティック/時間的インデックスを構築し、タイムスタンプと自動クリップでモーメントを検索する。アクション:トランスコードと正規化(コーデック、フレームレート、解像度、アスペクト比)、タイムライン編集(字幕、テキスト/画像オーバーレイ、ブランディング、オーディオオーバーレイ、吹き替え、翻訳)、メディアアセットの生成(画像、オーディオ、ビデオ)、ライブストリームまたはデスクトップキャプチャされたイベントのリアルタイムアラートを実行する。
npx skillsauth add affaan-m/everything-claude-code videodbInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ビデオ、ライブストリーム、デスクトップセッションのための知覚 + 記憶 + アクション。
VideoDBコードを実行する前に、プロジェクトディレクトリに移動して環境変数をロードする:
from dotenv import load_dotenv
load_dotenv(".env")
import videodb
conn = videodb.connect()
これにより以下から VIDEO_DB_API_KEY が読み込まれる:
.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のセットアップ」などを要求した場合:
pip install "videodb[capture]" python-dotenv
Linuxで videodb[capture] が失敗する場合は、キャプチャ拡張なしでインストールする:
pip install videodb python-dotenv
ユーザーはいずれかの方法で VIDEO_DB_API_KEY を設定する必要がある:
export VIDEO_DB_API_KEY=your-key.env ファイル:プロジェクトの .env ファイルに VIDEO_DB_API_KEY=your-key を保存する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")
# Local file
video = coll.upload(file_path="/path/to/video.mp4")
# force=True skips the error if the video is already indexed
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() raises InvalidRequestError when no results are found.
# Always wrap in try/except and treat "No results found" as empty.
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() has no force parameter — it raises an error if a scene
# index already exists. Extract the existing index ID from the error.
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
# Use score_threshold to filter low-relevance noise (recommended: 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
# Change resolution, quality, or aspect ratio server-side
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
# Always prefer reframing a short segment:
reframed = video.reframe(start=0, end=60, target="vertical", mode=ReframeMode.smart)
# Async reframe for full-length videos (returns None, result via webhook):
video.reframe(target="vertical", callback_url="https://example.com/webhook")
# Presets: "vertical" (9:16), "square" (1:1), "landscape" (16:9)
reframed = video.reframe(start=0, end=60, target="square")
# Custom dimensions
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("Check your VIDEO_DB_API_KEY")
try:
video = coll.upload(url="https://example.com/video.mp4")
except InvalidRequestError as e:
print(f"Upload failed: {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 を渡す |
| タイムライン上の負のタイムスタンプ | 破損したストリームを静かに生成 | VideoAsset を作成する前に常に start >= 0 を検証する |
| generate_video() / create_collection() の失敗 | Operation not allowed または maximum limit | プラン制限された機能——ユーザーにプラン制限を通知する |
ws_listener.py を使用して録画セッション中にWebSocketイベントをキャプチャする。デスクトップキャプチャはmacOSのみサポート。
STATE_DIR="${VIDEODB_EVENTS_DIR:-$HOME/.local/state/videodb}"VIDEODB_EVENTS_DIR="$STATE_DIR" python scripts/ws_listener.py --clear "$STATE_DIR" &cat "$STATE_DIR/videodb_ws_id"$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ソリューション |
|---------|-----------------|
| プラットフォームがビデオのアスペクト比または解像度を拒否 | VideoConfig を使用した video.reframe() または 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/ の下でローカルに提供されている。
実行時に外部リポジトリリンクをたどるのではなく、上記のローカルコピーを使用する。
メンテナー: VideoDB
data-ai
Design task-local harnesses, eval gates, and reusable skill extraction for Claude dynamic workflow mode and other adaptive agent harnesses.
development
React component testing with React Testing Library, Vitest/Jest, MSW for network mocking, accessibility assertions with axe, and the decision boundary between component tests and Playwright/Cypress end-to-end runs. Use when writing or fixing tests for React components, hooks, or pages.
tools
React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills). Organizes 70+ rules across 8 priority categories — waterfalls, bundle size, server-side, client fetching, re-render, rendering, JS micro-perf, advanced. Use when writing, reviewing, or refactoring React/Next.js code for performance.
tools
React 18/19 patterns including hooks discipline, server/client component boundaries, Suspense + error boundaries, form actions, data fetching, state management decision trees, and accessibility-first composition. Use when writing or reviewing React components.