Video Frame Extraction
Extract frames from video files and save them as images using OpenCV
Install
npx skills add benchflow-ai/skillsbench --skill video-frame-extraction -g -a claude-code -y- Repository
- benchflow-ai/skillsbench1.9k
- Category
- Media
- Updated
- 11d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Extract frames from video files and save them as images using OpenCV
Video Frame Extraction Skill
Purpose
This skill enables extraction of individual frames from video files (MP4, AVI, MOV, etc.) using OpenCV. Extracted frames are saved as image files in a specified output directory. It is suitable for video analysis, creating training datasets, thumbnail generation, and preprocessing video content for further processing.
When to Use
- Extracting frames for machine learning training data
- Creating image sequences from video content
- Generating video thumbnails or preview images
- Preprocessing videos for object detection or tracking
- Converting video segments to image collections for analysis
- Sampling frames at specific intervals for time-lapse effects
Required Libraries
The following Python libraries are required:
import cv2
import os
import json
from pathlib import Path
Input Requirements
- File formats: MP4, AVI, MOV, MKV, WMV, FLV, WEBM
- Video codec: Must be readable by OpenCV (most common codecs supported)
- File access: Read permissions on source video
- Output directory: Write permissions on destination folder
- Disk space: Ensure sufficient space for extracted frames (uncompressed images)
Output Schema
All extraction results must be returned as valid JSON conforming to this schema:
{
"success": true,
"source_video": "sample.mp4",
"output_directory": "/path/to/frames",
"frames_extracted": 150,
"extraction_params": {
"interval": 1,
"start_frame": 0,
"end_frame": null,
"output_format": "jpg"
},
"video_metadata": {
"total_frames": 300,
"fps": 30.0,
"duration_seconds": 10.0,
"resolution": [1920, 1080]
},
"output_files": [
"frame_000001.jpg",
"frame_000002.jpg"
],
"warnings": []
}


