kajisho5/ffmpeg-skill

▲ 3,016 stars today★ 12,243⑂ 1,013

Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. Cut, captions, reframe, loudness, platform exports.

About kajisho5/ffmpeg-skill

kajisho5/ffmpeg-skill is an open-source project on GitHub, mainly written in Python. Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. It currently holds 12,243 stars and 1,013 forks with 31 open issues, and was last pushed on 2026-11-28 (repository created 2026-09-03).

Project Overview

AI Homed tracks it on the AI Video Projects board and on the AI AI Video Projects list.

GitHub Repository Details

Repository kajisho5/ffmpeg-skill · default branch main · size 137149 KB · watchers 18 · source: GitHub REST API and repository README

README

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/ffmpeg-skill

Give your coding agent a video editor.
Claude Code, Cursor, Codex or any MCP client edits your footage with local FFmpeg, then checks its own output.
No cloud · No API keys · Python standard library
What you install and what it touches

Website · Quick start · Use cases · Demos · Tools · MCP · npm

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/tests https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/OpenSSF Scorecard https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/npm https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/npm downloads per month https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/FFmpeg 6.1, 7.1, 8 and 9 tested in CI https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/MIT https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/Sponsor

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/ffmpeg-skill v4: Edit. Measure. Ship. 42 local FFmpeg tools, 12 stable; your agent does the work. A card shows final.mp4 measured: 59.98 s, 1080x1920, 30 fps, -14.0 LUFS, verified.

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/Install: npx ffmpeg-skill setup   https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/Watch the demos

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/kajisho5/ffmpeg-skill on Trendshift: GitHub Trending, repository of the day   https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/Star History: global rank among GitHub repositories

English · 日本語 · 日本語(サイト)

Use cases, end to end: a vertical short with captions · a podcast as an audiogram · cleaning a phone clip · a cut-down of a long recording · one master, several platforms · a talk from two cameras

npx ffmpeg-skill
https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/animated captions with a karaoke highlight
caption.py --animate pop --karaoke
https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/16:9 reframed to 9:16
fit.py --aspect 9:16 --fit crop
https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/silence removed, timeline shorter
silence.py --threshold -35
https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/waveform before and after loudness normalisation
loudness.py -I -14 --tp -1

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/a conference talk laid out with its slides on the left and the speaker on the right
Twelve clips edited by asking: colour, slow motion and reframing, a talk laid out with its slides and cut into a captioned short, a pause removed, a green-screen composite, a levelled horizon, and three phone clips (stabilised, a night shot lifted and denoised, 60 fps slowed down). Watch them (English and Japanese) · the request and the exact commands. Nine clips are AI-generated with Google Veo; three are shot on a phone.

Review page

After an edit, ask your agent for the review page ("show me the review page"), or run npx ffmpeg-skill review project.json --result run.json yourself (python3 scripts/_review.py from a checkout). It writes one local HTML file. It shows the sources, every step with its checks, the result in a phone frame with the platform's safe area, and a timeline. Press the number of a clip or a caption, write what should change, and copy the instruction it builds back to your agent. Nothing is uploaded; the page speaks English, Japanese, Korean and Chinese.

https://github.com/kajisho5/ffmpeg-skill/blob/HEAD/the review page: sources and work steps on the left, the source frames and the vertical result with a timeline in the middle, the selected caption and the instruction for the agent on the right
The talk above as a vertical short, on the review page (AI-generated footage).

Left half is the input, right half is what the command produced. Every before/after demo, with the exact command under each one → — all of it built by python3 demos/build.py, so you can rebuild every frame of it yourself. The pictures come from demos/footage/: clips AI-generated with Google Veo (the people and places do not exist) and a few shot on a phone. The sound is synthetic, and a few demos (HDR10, a panorama) use a synthetic picture.

ffmpeg-skill is an Agent Skill for Claude Code, Cursor, Codex and any agent that reads SKILL.md. It teaches the agent a fixed workflow (probe → edit losslessly where possible → check → verify) and ships 41 tools that do the actual work with ffmpeg / ffprobe: cut, join, silence removal, fit to duration and aspect, captions and karaoke, overlays and motion graphics, HDR → SDR and LUTs, audio clean-up and typed dynamics, sync with drift correction, multicam, loudness, delivery checks, whole-edit project rendering, batch folders. Every tool is also callable as an MCP tool (tools/list advertises a core 12 by default to keep client context small, with FFMPEG_SKILL_MCP_FULL=1 listing all 41; every tool is reachable by name through tools/call either way), and the whole set is described by a machine-readable contract.

If ffmpeg and python3 are on your PATH, it works: offline, on footage you would rather not upload.

SPEC (Self-Producing Execution Contract): each tool's input_schema — the part of its
contract and MCP tool definition that has to track the CLI flag-for-flag — is never
hand-authored beside the code. It is derived, at run time, from the same argparse parser that
already defines the CLI, and CI fails the build if any of it drifts.
→ full explanation

---

Standalone, and in an ecosystem

Standalone, this is a local FFmpeg engine: probe → edit → verify, npx ffmpeg-skill and nothing else. No API key, no account, no other repo required. Everything above and below this section describes that standalone tool, and none of it changes if you never read the rest of this one.

In kajisho5's wider video-production ecosystem, this repo is the hands: it cuts, measures and exports files, and reports back in structured JSON. It does not decide what to cut, whether a deliverable is approvable, what makes a highlight interesting, or what a caption should say (the user's cue text is burned as written, never rewritten to fit) — those are a brain's job, sitting in front of this engine, not inside it.

| You want to... | Use | |---|---| | Cut / join / measure / export a file right now | this repo (ffmpeg-skill), standalone | | Decide cut points, approve a deliverable, plan a whole edit | video-production-agent / AI-video-production-OS | | Build a typed editing graph across a workspace, without writing raw ffmpeg | video-editing-skill / audio-production-skill | | Put Remotion motion graphics (animated captions, silence jump cuts, audio-peak motion) on a real recording | remotion-ffmpeg-skill: its compositions take their length, fps, frame, silences, scene cuts, audio peaks and beats from this repo's probe.py, silence.py and scenes.py. It verifies its render with check.py and look.py, composites a graphics layer with overlay.py (--place for its --sparse mode), and delivers through render.py --template |

Other repos in the ecosystem — media-analysis-skill, transcription-skill, subtitle-skill, thumbnail-skill, color-grading-skill, motion-graphics-skill, qc-skill — read this repo's contract --json, its tools' --json output and doctor, the same way any agent framework would; this repo does not call into any of them. The dependency runs one way.

---

Contents Standalone, and in an ecosystem · Why · Quick start · How it works · Design principles · Tools · Audio · Built for agents · FAQ · FFmpeg compatibility · Tested on real footage · Install · Requirements · Development · Docs

---

Why

An agent that "knows FFmpeg" still guesses: it assumes a frame rate, picks a codec the container cannot hold, re-encodes a file that only needed a stream copy, and reports "done" without opening the result. This skill takes the guessing out:

Paper

The design discipline behind this skill — per-operation verification for AI agents — is written up as a position paper. The paper scores ffmpeg-skill itself as only partially conformant with the discipline it defines.

Kajiyama, S. (2026). What Is Verification-Driven Coding? — A Discipline for Not Trusting Generation. Zenodo. https://doi.org/10.5281/zenodo.23720216

Quick start

One command does steps 0 to 2 below: npx ffmpeg-skill setup installs the skill for every agent it finds on the machine (~/.claude, ~/.cursor, ~/.codex or ~/.agents; Claude Code when it finds none), installs FFmpeg when ffmpeg does not run (brew install ffmpeg-full, winget install --id Gyan.FFmpeg -e or sudo apt-get install -y ffmpeg, printed before it runs; --no-ffmpeg never runs a package manager), and ends with doctor, whose exit status it returns. On a system with none of those three package managers it installs the skill, says FFmpeg is still missing, and exits non-zero. It needs Node 16+ and Python 3.10+, and installs neither.

npx ffmpeg-skill setup

The same steps one at a time:

# 0. FFmpeg itself, once (Ubuntu/Debian shown; macOS and Windows are in the Install table below)
sudo apt install ffmpeg

1. install the skill for Claude Code (Cursor: --cursor, Codex: --codex, all three: --all)

npx ffmpeg-skill

2. check the machine: ffmpeg, ffprobe and every FFmpeg component the tools need

npx ffmpeg-skill doctor

3. (for agent frameworks) read the machine-readable contract

npx ffmpeg-skill contract --json | head -40

Captions from speech (caption.py --transcribe) need one local speech engine, installed separately. pip install faster-whisper is the simplest; the first run downloads its model, and the audio never leaves the machine. Without an engine, everything else works, doctor lists the engine as missing optional, and --transcribe refuses with the install line for each engine it supports.

Already installed? re-run npx ffmpeg-skill to refresh ~/.claude/skills/ffmpeg-skill. Copies are not updated automatically.

doctor's overall ok and a single tool's usable are different signals: ok is false when anything some tool requires is missing, so one missing filter (a plain Homebrew ffmpeg without subtitles, or a build without libvidstab) turns it false even though most tools still run. Check doctor --json's tools field for the per-tool answer, not just ok.

Then talk to your agent:

"Take interview.mp4, keep 0:45–1:20 and 5:00–5:25, and make it a 60-second Reel."

The agent runs probe.py, cut.py --segments 0:45-1:20,5:00-5:25 --accurate, fit.py --aspect 9:16 --fit crop, export.py --preset reels, check.py --platform reels and look.py, then reports "final.mp4: 60.00 s, 1080×1920, 30 fps, AAC stereo" with the contact sheet it inspected.

Deliver to a platform

One command per destination, with the app's own UI taken into account:

python3 $S/render.py talk.mp4 --template tiktok --cues cues.txt

That fills the shipped templates/tiktok.json: 9:16 crop, captions popped word by word above TikTok's description bar and clear of its like column, −14 LUFS, the tiktok export preset, and a check.py --platform tiktok on the file it wrote. The caption size comes from the delivery table, so since 1.17.1 the filled project also states "fit_size": "on": a size nobody asked for shrinks to fit the cue instead of splitting the sentence across two cues. A template that states its own fit_size, and a --brand that states a caption size, still win, and a project with "fit_size": "off" renders the captions 1.17.0 rendered. Templates ship for tiktok, reels, shorts, youtube-shorts, youtube, x, linkedin, facebook, podcast and audiogram; --template all (or a comma-separated list) renders the seven video destinations (tiktok, reels, shorts, youtube, x, linkedin, facebook) from the same edit and writes a _pack.md table of what each one produced. Files land next to the input unless -o says otherwise, and --dry-run shows every planned command rather than a result. render.py --list-templates prints them with their frames, limits and safe zones. Alias spellings work everywhere a platform is named (youtube-shorts = shorts, ig = reels, twitter = x, fb = facebook).

The tools also work on their own, from any shell:

S=~/.claude/skills/ffmpeg-skill/scripts
python3 $S/probe.py input.mp4 --compact
python3 $S/fit.py input.mp4 --duration 60 --method trim --aspect 9:16 --dry-run    # plan a trim and reframe
python3 $S/export.py input.mp4 --preset reels --json                 # structured result with a probe of the output

On Windows in Git Bash, python3 is only on PATH if Python was installed from the Microsoft Store; a python.org install exposes python (or the py launcher) instead — replace python3 with python above if you see a "command not found". bin/install.js and doctor/contract already handle this for you; only the raw script examples above need it spelled out manually.

More requests and the commands behind them: examples/README.md. To see everything run end-to-end on generated footage: npm run demo (the gallery in docs/demos.md).

How it works

flowchart TD
    U[User request] --> A[AI agent
Claude Code · Cursor · Codex] A -->|reads| S[SKILL.md
workflow, request → tool map, report format] A -->|runs| T[Structured tool
scripts/<name>.py, typed argparse flags] T --> C[Contract
input schema · role · capabilities · verification policy] C --> D[Capability detection
doctor: available / missing / unknown] D --> F[FFmpeg execution
no shell, stream copy when possible] F --> V[Verification
probe · check · look.py contact sheet] V --> R[Structured result
--json: status, output, commands, probe] R --> A

Over MCP the same tools are reached through a transport that holds no tool table of its own:

flowchart LR
    M[MCP client
Claude Desktop · Cursor · any client] --> P[mcp/server.py
stdio JSON-RPC] P -->|tools/list| C[Contract-derived ToolSpecs
names · order · inputSchema] P -->|tools/call| T[scripts/<name>.py] C -.derived from.-> K[scripts/_contract.py] T -.described by.-> K

Names, order and inputSchema in tools/list are translated from each tool's argparse parser at start-up, so a new flag or a new script appears in MCP with no edit to mcp/. A test copies the skill, adds, removes and edits a script, and reads tools/list again to prove it.

Design principles

These are the rules the skill file gives the agent and the code enforces.

1. Probe first. No tool decides from the file name. probe.py measures duration, fps (with variable-frame-rate detection), resolution, rotation, bit depth, HDR format including Dolby Vision, colour tags and every audio stream before anything is cut. 2. Lossless when possible. cut.py and loudness.py stream-copy what they do not need to touch (join.py re-encodes so it can crossfade and conform mismatched clips; --copy --transition none joins clips that already match by stream copy). Re-encoding happens only when it must: frame-accurate cuts, filters, format changes, or a keyframe farther than the tolerance. 3. Plan before render. Every tool takes --dry-run (print the ffmpeg command lines, write nothing; verify ignores it), --plan FILE (the dry run saved as a plan with fingerprinted inputs that render.py FILE executes later, refusing if an input changed; render and verify refuse it), --json (structured result with a probe of the output), --fast (preview quality), --progress (percent and ETA), --timeout (a hung ffmpeg is killed and reported, never waited on forever; Ctrl-C or SIGTERM likewise stops the running ffmpeg, removes its partial output and reports kind: interrupted) and --overwrite (explicit consent before an existing output is replaced). A test runs every tool whose contract says its dry run runs no ffmpeg (ffmpeg_execution: none, plus cut and metadata without their measuring flags) under --dry-run behind a fake ffmpeg and asserts that no ffmpeg call happened and no file appeared; another runs every tool the contract says supports --dry-run (all but verify) behind an ffmpeg that logs each decode, and asserts that no file appeared and that every tool that decoded is one the contract lists as analysis_only. 4. Machine-readable contract. contract --json describes all 41 tools (and crop, an alias of fit --rect since 4.19, marked alias_of): input schema generated from the parser, output schema, role, required and conditional FFmpeg capabilities, dry-run support, the verification tools to run afterwards, whether a visual check is required, mutates_input: false. provides lists them by a cross-repository Capability id (ffmpeg-skill.cut, ffmpeg-skill.loudness, ...) for kajisho5/AI-video-production-OS's CapabilityContract.provides — see docs/contract.md. 5. Contract-derived MCP. mcp/server.py builds its tools/list from the contract. Tool names, order and inputSchema cannot drift from the scripts; a test keeps the two byte-identical. 6. Capability detection. doctor reads ffmpeg -encoders / -decoders / -filters / -bsfs and reports which of the components the tools need are present on this build (libx264, libass, zscale, loudnorm, xfade, …), before a job fails inside ffmpeg. 7. Unknown is not missing. When a listing cannot be read (a layout the parser does not know, ffmpeg exiting non-zero) the affected capabilities are unknown: never missing, never silently available. An installed filter is not reported absent; a failed detection is not a pass. 8. Verify the result. The output is probed, and when the picture changed (captions, overlays, crops, colour, transitions) the agent runs look.py and inspects the PNG. The report is not finished until its Look: line names tha

GitHub Stars & Activity

12,243Stars
1,013Forks
31Open issues
PythonLanguage

GitHub Popularity

GitHub stars12,243
Forks1,013
Open issues31
Primary languagePython
LicenseMIT
Stars gained today3,016
Created2026-09-03
Last pushed2026-11-28

Trending History

Weekly boardrank #8 · ▲ 3,016 stars
Monthly boardrank #23 · ▲ 8,756 stars

Related AI Projects

1

OpenMontageInc / OpenMontage

Python★ 84,549⑂ 0
→
2

calesthio / OpenMontage

Python★ 69,490⑂ 0
→
3

ATH-MaaS / Pixelle-Video

Python★ 30,632⑂ 0
→
4

latent-spaces / brag

Python★ 23,007⑂ 0
→
5

KlingAIResearch / LivePortrait

Python★ 19,632⑂ 0
→
6

Wan-Video / Wan2.2

Python★ 19,053⑂ 0
→
7

Zulko / moviepy

Python★ 15,244⑂ 0
→
8

JuneYaooo / rea-video

Python★ 15,007⑂ 0
→

More AI Rankings