当前位置: 首页 > Skill >

video-analysis

video-analysis

video-analysis

主要用于识别给定视频链接中视频内容,最后调用工具自动完成视频中所描述任务。本skill使用ASR识别语音转文字,使用ffempeg切分视频切块,可调用外部多模态模型对切出的图片进行图片识别,识别结果与ASR结果进行二次验证,最后得出视频所描述的内容,以描述内容交付给agent后,自动完成视频中所描述任务.

1.0.0 2026.11.23 798
获取Skill文件查看使用说明
作 者:顾知 许可证: 更新时间:2026.11.23
本文目录收起

Video Analysis

Use this skill to turn an authorized video file or direct video URL into a timestamped, auditable report. Remote models do not receive the raw MP4/WebM stream. This workflow decodes the video locally, extracts timestamped JPEG frames and speech transcription, and—only when explicitly configured—sends frames to a selected vision provider and text evidence to a selected synthesis provider.

Authorized inputs only

Accept any of:

  • A local video file that the user is authorized to analyze.
  • A public, direct http:// or https:// media URL, such as a public .mp4 or .webm resource.
  • With --allow-platform, a public video-platform page (for example a Bilibili or YouTube watch link). The skill fetches the single public video with yt-dlp and then processes it locally.

Platform-page fetching is deliberately narrow and these limits are not to be weakened:

  • Public, anonymously accessible videos only. Never send cookies, passwords, or authenticated headers; never log in; never access member-only, private, friend-only, or age-gated content.
  • No DRM circumvention. DRM-protected streams are refused with an honest error, not decrypted.
  • Single video per run (--no-playlist); no batch scraping, playlists, or channels.
  • The user remains responsible for the platform's terms of service and for being authorized to analyze the content.

If a platform video requires login or membership, do not work around it: ask the user for an authorized original file, a direct public export, or the platform's official API/export route.

The URL fetcher blocks local, private, link-local, reserved, and metadata-service addresses. Do not weaken these checks.

Workflow

  1. Run the preflight check before installing or running the pipeline:

    python "$HOME/.claude/skills/video-analysis/scripts/preflight.py" --json
    

    On Windows, use the full path if $HOME is not expanded by the active shell.

  2. Explain any missing prerequisites instead of silently installing packages or adding secrets. The pipeline needs ffmpeg and ffprobe; full transcription requires faster-whisper; remote semantic stages require the official openai Python SDK plus the provider-specific environment key selected by the user; platform-page fetching with --allow-platform requires yt-dlp.

  3. Choose providers. Remote stages are disabled by default, but a user-supplied OpenAI-compatible endpoint is the simplest configuration: an API key, a base URL, and a model name are enough. Pass --custom-base-url and --custom-model plus the key via the CUSTOM_API_KEY environment variable (or --custom-api-key-env if the key already lives in another variable). When all three are present and no provider flags are given, the pipeline auto-selects the custom provider for both vision and synthesis. Any model that accepts image input works; the pipeline verifies this with a single test image before sending frame batches, and a text-only model degrades to an honest local report instead of failing.

    Otherwise choose providers explicitly:

    • --vision-provider {none,openai,xai,custom} controls frame interpretation. custom targets a user-supplied OpenAI-compatible endpoint with an explicit model name; the model must support image input.
    • --synthesis-provider {none,openai,xai,deepseek,custom} controls the text report. DeepSeek hosted API is text-only and never receives images.
    • API keys come only from environment variables: OPENAI_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, or CUSTOM_API_KEY (name configurable via --custom-api-key-env).

    Run the analyzer. Start from a local file when possible:

    python scripts/analyze_video.py 
      --input "C:\videos\demo.mp4" 
      --output-dir "C:\video-results\demo" 
      --frame-interval 3 
      --vision-provider openai 
      --synthesis-provider deepseek 
      --keep-artifacts
    

    For an authorized direct URL:

    python scripts/analyze_video.py 
      --url "https://media.example.com/public-demo.mp4" 
      --output-dir "./video-results/public-demo" 
      --max-download-bytes 262144000 
      --vision-provider xai 
      --synthesis-provider openai
    

    For a public video-platform page (single public video, no login/cookies; requires yt-dlp):

    python scripts/analyze_video.py 
      --url "https://www.bilibili.com/video/BVxxxxxxxxxx/" 
      --output-dir "./video-results/platform-demo" 
      --allow-platform 
      --language zh 
      --skip-vision
    

    For a custom OpenAI-compatible endpoint (key, endpoint, and model supplied by the user). If the user gives you the API key directly, set it inline on the command instead of persisting it anywhere, and never echo it into the report:

    CUSTOM_API_KEY="<key the user supplied>" python scripts/analyze_video.py 
      --input "C:\videos\demo.mp4" 
      --output-dir "C:\video-results\demo" 
      --custom-base-url https://api.relay.example/v1 
      --custom-model gpt5.6-luna
    

    --custom-model applies to both stages; with the key set, the custom provider is auto-selected for vision and synthesis. To use different models per stage, spell them out with --vision-provider custom --vision-model <name> --synthesis-provider custom --synthesis-model <name>.

    In PowerShell, use $env:CUSTOM_API_KEY="<key>"; python scripts/analyze_video.py ... instead. Use --custom-api-key-env OTHER_VAR if the key already lives in a differently named environment variable. The model must accept image input for the vision stage; the pipeline verifies this with a single test image before sending frame batches.

  4. Read analysis.json and report.md from the output directory. Cite time ranges when describing the video. If the report lists missing modalities, state that limitation rather than inventing content.

Runtime behavior

  • ffprobe checks duration and streams before processing.
  • With --allow-platform, a URL that serves HTML instead of direct media is fetched as a single public video via yt-dlp (--no-playlist, size and duration caps applied, no cookies or login ever). Login-gated, member-only, private, or DRM-protected content is refused with a clear limitation instead of being bypassed. The report's provenance records that the media came from platform extraction.
  • ffmpeg produces a 16 kHz mono WAV and bounded JPEG key frames. Default sampling is every 3 seconds, which is suitable for typical short videos; use 1–2 seconds for UI/PPT tutorials and 3–5 seconds for talking-head videos.
  • faster-whisper creates timestamped transcript segments. ASR failures are reportable but nonfatal: the pipeline writes an empty transcript.json and continues with any available visual evidence.
  • When --vision-provider openai or --vision-provider xai is selected, the official openai Python SDK sends batches of JPEG frames as Base64 data URLs to the selected model. Each returned observation is forced back to the locally generated source timestamp.
  • When --vision-provider custom is selected, the user-supplied OpenAI-compatible endpoint receives the same JPEG frames via Chat Completions image_url content parts. Before batching, the pipeline submits one test image to confirm the named model actually accepts image input; if the endpoint rejects it, frame interpretation is aborted with a clear limitation instead of failing every batch.
  • When a custom base URL, model name (--custom-model or per-stage models), and the custom API key are all supplied without explicit provider flags, both stages auto-select the custom provider; the auto-selection is disclosed in the report limitations and provenance.
  • When --synthesis-provider openai, xai, deepseek, or custom is selected, only the text timeline evidence is sent to that provider. DeepSeek and custom synthesis never receive images.
  • A selected provider failure degrades to the deterministic local report. It never silently switches to another vendor or sends artifacts elsewhere.
  • The pipeline aligns transcript and visual observations into five-minute timeline windows and generates a final JSON report plus readable Markdown.
  • The default maximum video duration is 10 minutes. For a longer authorized source, increase --max-duration deliberately and use --segment-seconds 300; the report remains split into time windows. Do not attempt frame-by-frame processing.

Offline and staged verification

Use both skip flags to verify decoding and outputs without model credentials or an ASR model:

python scripts/analyze_video.py 
  --input sample.mp4 
  --output-dir ./video-results/offline-check 
  --skip-asr --skip-vision

This is an offline media-pipeline check, not a video understanding result. It creates media.json, frames.json, timeline.json, analysis.json, and report.md, and marks audio and visual interpretation as unavailable.

Output contract

The output directory contains:

  • media.json — ffprobe metadata and source information.
  • transcript.json — ASR segments with timestamps, when ASR ran.
  • frames.json — key-frame paths and estimated source timestamps.
  • vision.json — provider frame observations and batch errors, when vision ran.
  • timeline.json — merged time windows.
  • analysis.json — title, summary, chapters, key moments, limitations, and provenance.
  • report.md — user-readable report.

Temporary downloaded media, WAV audio, and frames are removed unless --keep-artifacts is supplied. A caller-supplied local source video is never deleted.

Failure handling

  • Treat blocked URL, download, platform-fetch refusal (login/member/DRM), ffprobe, ASR, Vision, and synthesis errors as separate reportable failures.
  • Keep successfully produced JSON artifacts when a later stage fails.
  • Do not claim an end-to-end analysis succeeded when a modality was skipped, unavailable, or failed.
  • Before a real external URL run, tell the user that it downloads media and may use ASR compute plus credits from the explicitly selected OpenAI, xAI, DeepSeek, or custom providers.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
Skill 文件
  • SKILL.md
    • Video Analysis
    • Authorized inputs only
    • Workflow
    • Runtime behavior
    • Offline and staged verification
    • Output contract
    • Failure handling
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期