OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  meta-video-ad-analyzer:提取并分析视频广告内容的情报工具

meta-video-ad-analyzer:提取并分析视频广告内容的情报工具

 
  audit ·  2026-02-24 09:07:14 · 2 次点击  · 0 条评论  

名称: video-ad-analyzer
版本: 1.0.0
描述: 使用 Gemini Vision AI 从视频广告中提取并分析内容。支持帧提取、OCR 文本检测、音频转录和 AI 驱动的场景分析。适用于分析视频创意内容、提取叠加文本或生成逐场景描述。


视频广告分析器

使用 Google Gemini Vision 进行 AI 驱动的视频内容提取。

功能概述

  • 帧提取:支持智能采样与场景变化检测
  • OCR 文本检测:使用 EasyOCR 提取叠加文本
  • 音频转录:通过 Google Cloud Speech 将语音转换为文本
  • AI 场景分析:利用 Gemini Vision 描述每个场景
  • 原生视频分析:直接理解较长视频内容
  • 缩略图生成:从首帧自动生成缩略图

环境配置

1. 环境变量

# Gemini Vision 必需
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

# 音频转录必需
# (同一服务账号需启用 Speech-to-Text API)

2. 依赖安装

pip install opencv-python pillow easyocr ffmpeg-python google-cloud-speech vertexai google-api-python-client

系统还需安装 ffmpegffprobe

使用指南

基础视频分析

from scripts.video_extractor import VideoExtractor
from scripts.models import ExtractedVideoContent
import vertexai
from vertexai.generative_models import GenerativeModel

# 初始化 Vertex AI
vertexai.init(project="your-project-id", location="us-central1")
gemini_model = GenerativeModel("gemini-1.5-flash")

# 创建提取器
extractor = VideoExtractor(gemini_model=gemini_model)

# 分析视频
result = extractor.extract_content("/path/to/video.mp4")

print(f"时长: {result.duration}s")
print(f"场景数: {len(result.scene_timeline)}")
print(f"文本叠加数: {len(result.text_timeline)}")
print(f"转录文本: {result.transcript[:200]}...")

仅提取帧

frames, timestamps, text_timeline, scene_timeline, thumbnail = extractor.extract_smart_frames(
    "/path/to/video.mp4",
    scene_interval=2,    # 每 2 秒检查一次场景变化
    text_interval=0.5    # 每 0.5 秒检查一次文本
)

分析图像

# 也适用于图像
result = extractor.extract_content("/path/to/image.jpg")
print(result.scene_timeline[0]['description'])

输出结构

ExtractedVideoContent(
    video_path="/path/to/video.mp4",
    duration=30.5,
    transcript="分析结果如下...",
    text_timeline=[
        {"at": 0.0, "text": ["立即下载"]},
        {"at": 5.5, "text": ["今日五折"]}
    ],
    scene_timeline=[
        {"timestamp": 0.0, "description": "女性使用手机应用..."},
        {"timestamp": 2.0, "description": "产品功能展示..."}
    ],
    thumbnail_url="/static/thumbnails/video_thumb.jpg",
    extraction_complete=True
)

核心特性

功能 描述
场景检测 基于直方图的变化检测(阈值=65)
OCR 置信度 分级阈值(高 0.5,低 0.3)
AI 校对 Gemini 修正 OCR 错误
来源整合 智能合并 OCR 与 Vision 文本
原生视频 直接分析 <20MB 的文件

提示词

通过编辑 prompts/ 文件夹中的文件自定义 AI 行为:

  • scene_analysis.md - 帧分析提示词
  • scene_reconciliation.md - 场景增强提示词

常见问题解答

  • "这个视频广告中出现了哪些文字?"
  • "描述这个创意的每个场景"
  • "旁白说了什么?"
  • "从这个广告中提取行动号召"
2 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor