当视频遇上AI Agent——基于NVIDIA AI Blueprints构建视频搜索、摘要和智能分析Agent,让每一帧都变得可查询、可理解。
世界上有一种绝望叫"我知道视频里有这段内容,但找不到在哪分钟"。传统视频搜索靠人工标注,准确率看心情,效率看缘分。视频AI分析Agent的出现,让"用自然语言搜索视频内容"变成了现实。
视频AI分析的三大挑战:
NVIDIA的Video Search & Summarization Blueprint提供了一套完整的参考架构:
Blueprint核心组件:
┌─────────────────────────────────────────────┐
│ Video Ingestion Layer │
│ 支持格式: MP4, AVI, MOV, MKV, RTSP流 │
└─────────────────┬───────────────────────────┘
│
┌─────────────────┴───────────────────────────┐
│ Multimodal Extraction Pipeline │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 视觉特征 │ │ 音频转录 │ │ OCR文本 │ │
│ │(CV模型) │ │(ASR模型) │ │(OCR模型)│ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
└───────┼─────────────┼─────────────┼─────────┘
│ │ │
┌───────┴─────────────┴─────────────┴─────────┐
│ Embedding & Indexing │
│ 视频片段 → 向量表示 → 向量数据库 │
│ 使用: NVIDIA NeMo, CLIP, Whisper │
└─────────────────┬───────────────────────────┘
│
┌─────────────────┴───────────────────────────┐
│ Query & Retrieval Layer │
│ 自然语言查询 → 向量检索 → 结果排序 │
└─────────────────┬───────────────────────────┘
│
┌─────────────────┴───────────────────────────┐
│ Agent Orchestration │
│ OpenClaw Agent 负责智能决策和交互 │
└─────────────────────────────────────────────┘
视频AI分析Agent架构:
┌─────────────────┐
│ 用户查询 │
│ "找出所有提到 │
│ Agent的片段" │
└────────┬─────────┘
│
┌────────────────────────────┴─────────────────────────────┐
│ OpenClaw Agent │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Query Understanding │ │
│ │ 理解查询意图 → 确定搜索策略 → 生成检索query │ │
│ └────────────────────┬─────────────────────────────┘ │
│ │ │
│ ┌────────────────────┴─────────────────────────────┐ │
│ │ Video Search Skill │ │
│ │ - 调用NVIDIA向量检索API │ │
│ │ - 多模态相似度计算 │ │
│ │ - 时序上下文扩展 │ │
│ └────────────────────┬─────────────────────────────┘ │
│ │ │
│ ┌────────────────────┴─────────────────────────────┐ │
│ │ Result Synthesis │ │
│ │ 汇总结果 → 生成摘要 → 提取关键帧 │ │
│ └────────────────────┬─────────────────────────────┘ │
└───────────────────────┼─────────────────────────────────┘
│
▼
┌─────────────────┐
│ 返回结果 │
│ 时间戳 + 摘要 + │
│ 关键帧截图 │
└─────────────────┘
// 视频分片策略
async function segmentVideo(videoPath, options = {}) {
const {
segmentDuration = 30, // 每段30秒
overlap = 5, // 重叠5秒避免截断
keyframeOnly = false // 是否仅提取关键帧
} = options;
const segments = [];
const duration = await getVideoDuration(videoPath);
for (let start = 0; start < duration; start += segmentDuration - overlap) {
const end = Math.min(start + segmentDuration, duration);
segments.push({
start,
end,
path: `${videoPath}_segment_${start}_${end}.mp4`
});
}
return segments;
}
// 使用NVIDIA NeMo和CLIP提取特征
async function extractMultimodalFeatures(segment) {
const features = {};
// 视觉特征(使用CLIP)
features.visual = await extractVisualFeatures(segment.videoFrames, {
model: 'ViT-L/14',
batchSize: 32
});
// 音频转录(使用Whisper)
features.transcript = await transcribeAudio(segment.audioTrack, {
model: 'whisper-large-v3',
language: 'zh'
});
// OCR文本(使用PaddleOCR)
features.text = await extractText(segment.videoFrames, {
engine: 'paddleocr',
languages: ['ch', 'en']
});
// 人脸/物体检测(可选)
features.objects = await detectObjects(segment.videoFrames, {
model: 'yolov8',
confidence: 0.7
});
return features;
}
// 构建视频向量索引
async function buildVideoIndex(segments, embeddings) {
const index = new VectorIndex({
dimension: 768, // CLIP embedding维度
metric: 'cosine'
});
for (const [i, segment] of segments.entries()) {
const embedding = embeddings[i];
// 融合多模态embedding
const fusedEmbedding = fuseEmbeddings({
visual: embedding.visual,
transcript: embedding.transcript,
text: embedding.text,
weights: {
visual: 0.5,
transcript: 0.3,
text: 0.2
}
});
index.add({
id: `segment_${i}`,
vector: fusedEmbedding,
metadata: {
startTime: segment.start,
endTime: segment.end,
transcript: segment.transcript,
objects: segment.objects
}
});
}
await index.save('./video_index.faiss');
return index;
}
// SKILL.md - video-search ## 视频内容智能搜索 当用户需要搜索视频内容时: 1. **查询解析** - 提取时间范围(如"前10分钟") - 识别实体(人物、物体、场景) - 理解语义意图(查找、统计、摘要) 2. **检索策略** - 文本查询:使用transcript embedding - 视觉查询:使用visual embedding - 混合查询:融合多模态相似度 3. **结果呈现** - 返回时间戳列表 - 生成内容摘要 - 提取关键帧截图 **示例查询:** - "找出所有演示Agent架构的片段" - "视频里什么时候提到了OpenClaw?" - "给我看看演示多模态的段落"
// SKILL.md - video-summarization ## 视频智能摘要生成 自动生成视频的结构化摘要: 1. **分段摘要** - 将视频按主题分段 - 每段生成一句话摘要 - 提取关键实体和事件 2. **全局摘要** - 汇总所有分段摘要 - 生成层次化大纲 - 识别核心观点和结论 3. **摘要格式** ```markdown # 视频摘要 ## 概览 [100字全局摘要] ## 章节 - 00:00-05:30: [章节1摘要] - 05:30-12:45: [章节2摘要] ... ## 关键要点 - 要点1 - 要点2 ... ``` **使用场景:** - 长视频快速浏览 - 会议录像总结 - 教程视频大纲提取
将视频分析能力封装为OpenClaw的Skill:
// openclaw.yaml 配置
skills:
- name: "video-analysis"
path: "./skills/video-analysis"
tools:
- name: "search_video"
description: "搜索视频内容"
parameters:
- name: "query"
type: "string"
required: true
- name: "video_path"
type: "string"
required: true
- name: "time_range"
type: "tuple"
required: false
- name: "summarize_video"
description: "生成视频摘要"
parameters:
- name: "video_path"
type: "string"
required: true
- name: "detail_level"
type: "enum"
values: ["brief", "detailed"]
default: "brief"
在Agent中使用:
// Agent对话示例 User: "帮我分析这个教程视频,找出所有讲Agent记忆的部分" Agent: [调用 video-analysis skill] 1. 索引视频(首次需要) 2. 搜索"Agent记忆"相关内容 3. 找到3个相关片段: - 12:34-15:20: 介绍Agent记忆机制 - 28:45-31:10: 记忆检索优化 - 45:00-47:30: 实战案例演示 4. 生成这3段的摘要 5. 提取关键帧 返回结果: "视频中共有3处讲解Agent记忆: 1. 12:34-15:20 - [摘要]... 2. 28:45-31:10 - [摘要]... 3. 45:00-47:30 - [摘要]... 需要我提取这些片段的详细内容吗?"
| 方案 | 适用场景 | 资源需求 | 延迟 |
|---|---|---|---|
| 本地GPU | 私有视频、低延迟 | 高(需要NVIDIA GPU) | 低(<5s) |
| 云端API | 快速原型、弹性扩展 | 低(按需付费) | 中(5-30s) |
| 混合方案 | 平衡成本与性能 | 中(部分本地+云端) | 中(5-15s) |
| 边缘计算 | 实时监控、IoT场景 | 中(边缘设备) | 低(<2s) |
# docker-compose.yml
version: '3.8'
services:
video-agent:
image: nvidia/video-search-agent:latest
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
- ./videos:/data/videos
- ./index:/data/index
environment:
- NVIDIA_API_KEY=${NVIDIA_API_KEY}
- OPENCLAW_ENDPOINT=http://openclaw:3000
ports:
- "8000:8000"
openclaw:
image: openclaw/openclaw:latest
volumes:
- ./skills:/app/skills
ports:
- "3000:3000"
视频AI分析Agent让"视频"这种非结构化数据变得可查询、可理解、可利用。通过NVIDIA AI Blueprints提供的成熟架构,结合OpenClaw的Agent编排能力,你可以快速构建出生产级的视频智能分析系统。
世界上有一种效率叫"用一句话找到视频里的任何内容",视频AI分析Agent正在让这种效率成为标配。
最后更新:2026-05-16 | 妙趣AI - AI工具导航与教程平台