视频反推工具,支持视频抽帧、视觉模型分析、提示词生成,适用于视频创作参考、内容提取、场景分析
npx skills add https://github.com/anbeime/skill --skill video-frame-extractor
opencv-python>=4.8.0
pillow>=10.0.0
requests>=2.28.0
需要配置视觉模型API密钥(如GPT-4V、Claude-3.5-Sonnet),环境变量格式:
export VISION_API_KEY="your_api_key"
export VISION_API_BASE="https://api.openai.com/v1" # 或其他API地址
export VISION_MODEL="gpt-4-vision-preview" # 模型名称
使用您发布的Coze Bot API进行视觉分析,环境变量格式:
export COZE_BOT_ID="7572557757883383858" # 您的Bot ID
export COZE_API_KEY="cztei_qHZQ0A5OSJjsmfZWmVb8bqu2BTbtB240YGbDYLhZpsIr8jER4aL4Aevyii8rnKfNs" # 您的API Key
Coze Bot的优势: 集成了官方抽帧插件和视觉模型,无需额外配置
步骤1: 视频抽帧
scripts/video_frame_extractor.py--input: 视频文件路径或URL--output: 输出图片目录--interval: 抽帧间隔(秒),默认1秒抽1帧--max_frames: 最大抽帧数,默认10帧# 示例: 抽取视频关键帧
python scripts/video_frame_extractor.py \
--input ./input/video.mp4 \
--output ./output/frames \
--interval 3 \
--max_frames 10
步骤2: 视觉分析
方案A: 使用Coze Bot API(推荐)
scripts/coze_bot_client.py--image_dir: 图片目录--prompt: 分析提示词(可选)--output: 输出JSON文件路径# 示例: 使用Coze Bot分析抽帧图片
python scripts/coze_bot_client.py \
--image_dir ./output/frames \
--prompt "分析场景内容、人物状态、构图特点,适合AI视频创作" \
--output ./output/analysis.json
方案B: 使用其他视觉模型API
scripts/visual_analyzer.py--input: 图片目录或单张图片路径--output: 分析结果JSON文件路径--prompt: 分析提示词(可选,默认分析场景/人物/构图)# 示例: 使用GPT-4V分析抽帧图片
python scripts/visual_analyzer.py \
--input ./output/frames \
--output ./output/analysis.json \
--prompt "分析场景内容、人物状态、构图特点,适合AI视频创作"
步骤3: 结果整合
抽帧参数:
--interval: 抽帧间隔(秒),越小抽帧越密集--max_frames: 最大抽帧数,控制输出数量--start_time: 开始时间(秒)--end_time: 结束时间(秒)--resolution: 输出图片分辨率,默认1080P分析参数:
--prompt: 自定义分析提示词--detail: 分析详细程度(brief/standard/detailed)--batch_size: 批量分析大小,默认5张# 1. 抽取视频关键帧
python scripts/video_frame_extractor.py \
--input ./input/source_video.mp4 \
--output ./output/frames \
--interval 2 \
--max_frames 8
# 2. 使用Coze Bot分析抽帧内容
python scripts/coze_bot_client.py \
--image_dir ./output/frames \
--prompt "详细描述场景、人物、构图,适合AI视频创作参考" \
--output ./output/analysis.json
# 3. 智能体读取analysis.json,生成创作提示词
# 智能体将根据分析结果组织内容,生成可用于AI创作的提示词
python scripts/video_frame_extractor.py \
--input ./input/video.mp4 \
--output ./output/frames \
--interval 5 \
--max_frames 5
# 使用Coze Bot
python scripts/coze_bot_client.py \
--image ./output/frames/frame_00001.jpg \
--prompt "分析这张图片的场景风格和构图"
# 或使用其他视觉模型
python scripts/visual_analyzer.py \
--input ./output/frames/ \
--output ./analysis.json \
--prompt "分析场景风格和构图"
抽帧输出:
./output/frames/
├── frame_00001.jpg
├── frame_00002.jpg
├── frame_00003.jpg
└── ...
分析输出(JSON):
{
"total_frames": 10,
"analysis": [
{
"frame_file": "frame_00001.jpg",
"timestamp": "00:00:00",
"description": "场景描述内容...",
"elements": ["人物", "背景", "道具"],
"style": "风格描述..."
},
{
"frame_file": "frame_00002.jpg",
"timestamp": "00:00:03",
"description": "场景描述内容...",
"elements": ["人物", "背景", "道具"],
"style": "风格描述..."
}
]
}
抽帧技术:
视觉分析:
Coze Bot优势:
性能优化:
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Improves the quality of images, especially screenshots, by enhancing resolution, sharpness, and clarity. Perfect for preparing images for presentations, documentation, or social media posts.
Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
Python library for working with DICOM (Digital Imaging and Communications in Medicine) files. Use this skill when reading, writing, or modifying medical imaging data in DICOM format, extracting pixel data from medical images (CT, MRI, X-ray, ultrasound), anonymizing DICOM files, working with DICOM metadata and tags, converting DICOM images to other formats, handling compressed DICOM data, or processing medical imaging datasets. Applies to tasks involving medical image analysis, PACS systems, radiology workflows, and healthcare imaging applications.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
Take anbeime/video-frame-extractor from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.