ffmpeg-keyframe-extraction

ffmpeg-keyframe-extraction is a skill for Claude Code, Codex from cxcscmu/SkillLearnBench. It costs 29 tokens per session (661 once invoked), scanned B, original, MIT.

A set of FFmpeg commands for extracting complete still images from a video at key moments. These keyframes can help reveal scene changes or important parts of the footage.

In plain words
What is it for?
Extract keyframes as numbered PNG files and inspect basic video information such as duration.
Why use it?
It avoids manually scrubbing through a video and saving screenshots one by one.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cxcscmu/skilllearnbench/ffmpeg-keyframe-extraction
Any agent
npx skills add cxcscmu/SkillLearnBench --skill ffmpeg-keyframe-extraction
Clone the repo
git clone --depth 1 https://github.com/cxcscmu/SkillLearnBench

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ffmpeg-keyframe-extraction

README.md
[![agentmods](https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/ffmpeg-keyframe-extraction.svg)](https://agentmods.dev/skills/cxcscmu/skilllearnbench/ffmpeg-keyframe-extraction)
Your own site
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/ffmpeg-keyframe-extraction"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/ffmpeg-keyframe-extraction.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 661 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.00661
Opus 5 $0.00015 $0.00331
Sonnet 5 $0.00006 $0.00132
Haiku 4.5 $0.00003 $0.00066

Measured 3d ago against content hash 1b35935327d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

ffmpeg-keyframe-extraction scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo apt-get install ffmpeg

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(cmd, capture_output=True, text=True)
skills/b1-one-shot-claude-haiku-4-5/video-object-counting/ffmpeg-keyframe-extraction/SKILL.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FFmpeg Keyframe Extraction

Overview

FFmpeg can extract keyframes (I-frames) from video files. Keyframes are complete frames that don't depend on other frames for decoding, making them ideal for analysis and detection tasks.

Installation

# Ubuntu/Debian
sudo apt-get install ffmpeg

# macOS
brew install ffmpeg

Usage

Extract All Keyframes from Video

ffmpeg -i input.mp4 -vf "select=eq(pict_type\,I)" -vsync 0 output_%03d.png

Parameters:

  • -i input.mp4: Input video file
  • -vf "select=eq(pict_type\,I)": Filter to select only I-frames (keyframes)
  • -vsync 0: Output one image per keyframe (important for proper numbering)
  • output_%03d.png: Output pattern with zero-padded frame numbers (001, 002, etc.)

Extract Keyframes with Frame Rate Control

ffmpeg -i input.mp4 -vf "fps=1/5,select=eq(pict_type\,I)" -vsync 0 output_%03d.png

This extracts at most 1 keyframe every 5 seconds.

Check Video Information

ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1:noprint_wrappers=1 video.mp4

Output Naming Convention

When using output_%03d.png:

  • Frame 1: output_001.png
  • Frame 2: output_002.png
  • Frame 100: output_100.png

Python Integration

import subprocess
import os

def extract_keyframes(video_path, output_dir, output_prefix="keyframes"):
    """Extract keyframes from video file"""
    os.makedirs(output_dir, exist_ok=True)
    output_pattern = os.path.join(output_dir, f"{output_prefix}_%03d.png")

    cmd = [
        'ffmpeg',
        '-i', video_path,
        '-vf', 'select=eq(pict_type\\,I)',
        '-vsync', '0',
        output_pattern
    ]

    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        raise RuntimeError(f"FFmpeg error: {result.stderr}")

    # Return list of extracted frames
    frames = sorted([
        os.path.join(output_dir, f)
        for f in os.listdir(output_dir)
        if f.startswith(output_prefix)
    ])
    return frames

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 86 lines · 29 tokens per session scan B 1b35935327d7

Subscribe to this mod's changes

ffmpeg-keyframe-extraction is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 1mo ago), licensed MIT. It adds 29 tokens to every session and 661 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.