Communitygithub.com

ComeOnOliver/skillshub

对视频和音频进行感知、理解与操作。支持本地文件、URL、RTSP/直播流或桌面录制;返回实时上下文和可播放的流链接;提取帧、构建视觉/语义/时间索引、搜索带有时间戳和自动剪辑的时刻;转码标准化、时间线编辑、生成媒体资产,以及来自直播流或桌面捕获的实时告警。

skillshub 是什么?

ComeOnOliver/skillshub 是一个基于 VideoDB 的 AI 代理技能,为开发者提供全面的视频和音频处理能力。它涵盖三大核心功能:感知(从本地文件、URL、RTSP/直播流或桌面录制中摄取视频,返回实时上下文和可播放的流链接)、理解(提取视频帧、构建视觉、语义和时间索引,并通过带时间戳和自动生成的剪辑片段精确搜索所需片段)和行动(执行转码标准化(编解码器、帧率、分辨率、宽高比)、时间线编辑(字幕生成/翻译/烧录、文字/图片/品牌叠加、音频叠加、配音/翻译)、生成图像/音频/视频等媒体资产,以及为直播流或桌面录制设置实时告警)。该技能适用于 Claude Code 等 AI 编码代理,通过 Python SDK(`pip install videodb`)和 API 密钥(`VIDEO_DB_API_KEY`)集成。它强调在 VideoDB 支持的所有操作(剪辑、转码、字幕、叠加等)上优先使用其服务器端 API 而非本地 ffmpeg 等工具,仅在特定本地限制操作(如转场、速度变化)时才回退到本地工具。

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

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

VideoDB 技能

针对视频、直播流和桌面会话的感知、记忆与操作能力。

适用场景

桌面感知

  • 启动/停止桌面会话,捕获屏幕、麦克风和系统音频
  • 流式传输实时上下文并存储阶段性会话记忆
  • 针对屏幕上的内容和对话运行实时告警/触发器
  • 生成会话摘要、可搜索的时间线以及可播放的证据链接

视频摄取 + 流媒体

  • 摄取文件或 URL 并返回可播放的 Web 流链接
  • 转码/标准化:编解码器、比特率、帧率、分辨率、宽高比

索引 + 搜索(时间戳 + 证据)

  • 构建视觉、语音和关键词索引
  • 搜索并返回带有时间戳和可播放证据的精确片段
  • 自动从搜索结果创建剪辑

时间线编辑与生成

  • 字幕:生成、翻译、烧录
  • 叠加:文字/图片/品牌推广、动态字幕
  • 音频:背景音乐、画外音、配音
  • 通过时间线操作进行程序化合成和导出

直播流 (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

如果在 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 文件中

在 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="描述此场景的视觉内容。",
    )
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="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="群山上的日落",
    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 进行异步处理
时间线上的负时间戳静默产生损坏的流在创建 VideoAsset 之前始终验证 start >= 0
generate_video() / create_collection() 失败Operation not allowed 或 maximum limit计划限制功能——告知用户计划限制

示例

标准提示

  • "开始桌面捕获,并在出现密码字段时发出告警。"
  • "录制我的会话,并在结束时生成可操作的摘要。"
  • "摄取此文件并返回可播放的流链接。"
  • "索引此文件夹并找到所有包含人物的场景,返回时间戳。"
  • "生成字幕、烧录,并添加轻量背景音乐。"
  • "连接此 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() 或 conn.transcode() 配合 VideoConfig
需要为 Twitter/Instagram/TikTok 调整视频大小video.reframe(target="vertical") 或 target="square"
需要更改分辨率(例如 1080p → 720p)conn.transcode() 配合 VideoConfig(resolution=720)
需要在视频上叠加音频/音乐在 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

相关技能