video-frame-extractor

v1.0.0

This skill should be used when extracting frames from video files, such as generating keyframe sequences from videos, creating video thumbnails at intervals,...

0· 12·0 current·0 all-time
byHaoyu Huang@huanghaoyu1997
MIT-0
Download zip
LicenseMIT-0 · Free to use, modify, and redistribute. No attribution required.
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description match the actual content: the SKILL.md provides FFmpeg-based (and fallback OpenCV) instructions for extracting frames. No unrelated credentials, binaries, or configuration paths are requested.
Instruction Scope
Instructions are narrowly scoped to verifying/ installing FFmpeg, determining extraction parameters, running ffmpeg commands, and validating output. They do not direct the agent to read unrelated system files, access credentials, or transmit data to external endpoints.
Install Mechanism
This is an instruction-only skill with no install spec or bundled code. The SKILL.md recommends installing FFmpeg via standard package managers or an official build site; nothing is downloaded or executed by the skill itself.
Credentials
The skill requests no environment variables, credentials, or config paths. The operations described (running ffmpeg against provided video files and writing frames to an output directory) are proportional to the stated purpose.
Persistence & Privilege
always is false and model invocation is allowed (default). The skill does not request persistent or elevated privileges or modify other skills' configuration.
Assessment
This skill appears coherent and focused: it simply instructs an agent how to use FFmpeg to extract frames. Before installing or using it, ensure you: (1) only run it on videos you trust and have permission to process (the agent will run ffmpeg on files you supply), (2) install FFmpeg from your OS package manager or a trusted distributor (prefer apt/dnf/brew/winget or the official project releases), and (3) review and sanitize any paths you provide (output_path, video_path) to avoid overwriting important files. No credentials are requested by the skill. If you need the agent to process sensitive media, consider running FFmpeg locally yourself rather than granting the agent autonomous access.

Like a lobster shell, security has layers — review code before you run it.

latestvk9732kttfm0rtsym1t4sqb4fb1844qz0

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Video Frame Extractor

Overview

This skill guides LLM agents to extract frames from video files using FFmpeg. It provides complete workflow for frame extraction including environment setup, parameter configuration, and command execution.

Primary method: FFmpeg (fast and reliable)
Fallback method: OpenCV (if FFmpeg unavailable)

Workflow

Step 1: Verify FFmpeg Installation

Before extracting frames, check if FFmpeg is installed:

ffmpeg -version

If FFmpeg is not installed, see FFmpeg Installation section below.

Step 2: Determine Extraction Parameters

Before extracting frames, the LLM MUST confirm these parameters with the user:

ParameterDescriptionExample
output_pathDirectory to save extracted framesDefault: ./tmp/frames
frame_rateFrames per second to extract0.25 (1 frame every 4 seconds)
scaleShort side resize target in pixels (optional)640 (short side → 640px)

Parameter Calculation Guide:

  • To extract 1 frame every X seconds: frame_rate = 1/X
  • Example: 1 frame every 4 seconds → frame_rate = 0.25
  • Example: 1 frame every 10 seconds → frame_rate = 0.1
  • Example: 1 frame per second → frame_rate = 1

Step 3: Execute FFmpeg Command

Generate and execute the FFmpeg command:

Basic Command (no resize):

ffmpeg -hide_banner -loglevel error -i "{video_path}" -vf "fps={frame_rate}" -fps_mode vfr -q:v 2 -f image2 "{output_path}/%06d.jpg"

With Short Side Resize (recommended for analysis):

ffmpeg -hide_banner -loglevel error -thread_queue_size 512 -i "{video_path}" -vf "fps={frame_rate},scale='if(gt(iw,ih),-2,{scale}):if(gt(iw,ih),{scale},-2)':flags=lanczos" -fps_mode vfr -q:v 2 -f image2 -atomic_writing 1 "{output_path}/%06d.jpg"

Parameter Breakdown:

FlagPurpose
-hide_bannerSuppress build info
-loglevel errorQuiet mode, show only errors
-thread_queue_size 512Increase thread queue for large files
-vf "fps={rate}"Set frame extraction rate
-fps_mode vfrVariable frame rate (skip duplicates)
-q:v 2JPEG quality (1-31, lower = better)
-atomic_writing 1Atomic file write (prevent corruption)
%06d.jpgSequential naming: 000001.jpg, 000002.jpg...

Step 4: Verify Output

After extraction, verify the output:

  • Count frames: ls {output_path}/*.jpg | wc -l
  • Check frame sizes: ls -lh {output_path}/*.jpg | head -5

FFmpeg Installation

Windows

Option 1: winget (Recommended)

winget install ffmpeg

Option 2: Chocolatey

choco install ffmpeg

Option 3: Manual Download

  1. Download from: https://www.gyan.dev/ffmpeg/builds/
  2. Extract to a permanent location (e.g., C:\tools\ffmpeg)
  3. Add to PATH: setx PATH "$PATH;C:\tools\ffmpeg\bin
  4. Restart terminal

Verify Installation:

ffmpeg -version

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install ffmpeg

Verify Installation:

ffmpeg -version

Linux (CentOS/RHEL/Fedora)

sudo dnf install ffmpeg

macOS

brew install ffmpeg

Common Use Cases

Extract 1 frame every 4 seconds, resize to 640px

frame_rate = 0.25
scale = 640

Extract 1 frame every 10 seconds, original size

frame_rate = 0.1
scale = 0 (no resize)

Extract 1 frame per second for a 10-minute video (600 frames)

frame_rate = 1
video_duration = 600 seconds
expected_frames = 600

Output Directory Structure

Frames are saved with sequential naming:

output_path/
├── 000001.jpg
├── 000002.jpg
├── 000003.jpg
└── ...

The sequential naming (%06d) ensures frames are in temporal order regardless of original frame numbers.

Error Handling

ErrorSolution
ffmpeg: command not foundInstall FFmpeg first
No such file or directoryCheck video_path is correct
Permission deniedCheck write permissions for output_path
Output directory not emptyClear or use different output path

Notes

  • FFmpeg is much faster than OpenCV for frame extraction (10-100x)
  • The scale filter uses -2 instead of -1 to ensure dimensions are divisible by 2 (better codec compatibility)
  • -fps_mode vfr (variable frame rate) skips duplicate frames when seeking
  • Use -q:v 2 for high quality JPEG (range 1-31, default 31)

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…