# Video Frame Extraction

Extract frames from video files and save them as images using OpenCV

- Repository: https://github.com/benchflow-ai/skillsbench (1888 stars)
- Category: Media
- License: Apache-2.0
- Last updated: 2026-10-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add benchflow-ai/skillsbench --skill video-frame-extraction -g -a claude-code -y`
Codex: `npx skills add benchflow-ai/skillsbench --skill video-frame-extraction -g -a codex -y`
Cursor: `npx skills add benchflow-ai/skillsbench --skill video-frame-extraction -g -a cursor -y`
Gemini CLI: `npx skills add benchflow-ai/skillsbench --skill video-frame-extraction -g -a gemini-cli -y`

## Description

Extract frames from video files and save them as images using OpenCV

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

```python
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:

```json
{
  "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": []
}
```


### Field Descriptions

The rest: https://github.com/benchflow-ai/skillsbench/blob/HEAD/tasks-extra/pedestrian-traffic-counting/environment/skills/video-frame-extraction/SKILL.md
