ffmpeg-mcp-server
Provides tools for inspecting, trimming, reframing, extracting audio from, and burning subtitles into media files using ffmpeg and ffprobe.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ffmpeg-mcp-serverTrim clip.mp4 to 00:00:30β00:01:00 and reframe it to 9:16 for Shorts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ffmpeg-mcp-server π¬
ffmpeg-mcp-server is a deterministic, security-hardened Model Context Protocol (MCP) server that gives AI coding agents (Claude Code, Cursor, Windsurf, Cline, Gemini) safe, structured tools for inspecting, trimming, reframing (9:16 vertical shorts), extracting audio, and burning dynamic subtitles into video and audio files via ffmpeg and ffprobe.
Unlike raw shell-execution wrappers that expose agents to command injection or destructive path traversal, ffmpeg-mcp-server enforces workspace sandboxing, strict argument validation, argument-list subprocess execution (shell=False), and dry-run command inspection.
β¨ Key Features
π Sandboxed Workspace Security: Confines all input/output media operations to an explicit allowed root directory (
FFMPEG_MCP_WORKDIR), blocking path traversal (..) and symlink escapes.π Structured Media Probing (
probe_media): Extracts duration, resolution, codec, FPS, bitrates, and audio stream metadata viaffprobein clean JSON.βοΈ Frame-Accurate Clip Trimming (
trim_clip): Cuts segments with millisecond-accurate timestamps (HH:MM:SS.mmmor seconds) and configurable stream copy or H.264/AAC re-encoding.π± Vertical 9:16 Reframing (
convert_aspect_ratio): Automatically computes center-crop or blurred-pad filtergraphs for TikTok, Reels, and YouTube Shorts (9:16,1:1,16:9,4:5).π¬ Deterministic SRT Generator & Subtitle Burn-In (
generate_srt,burn_subtitles): Creates valid.srtsubtitle files from structured cue arrays and burns them into video with customizable font size and margin styling.π΅ Audio Extraction & Normalization (
extract_audio): Extracts cleanmp3,wav,flac, orm4atracks with optional EBU R128 loudness normalization (loudnorm).π§ͺ Zero-Dependency Core & Dry-Run Mode: Built on the Python standard library with a compliant JSON-RPC 2.0 stdio MCP transport, plus
dry_run=Truesupport on every mutative tool so agents can preview exactffmpegargv arrays before execution.
Related MCP server: ffmpeg-mcp
π Quick Start
Prerequisites
Python 3.10+
ffmpegandffprobeinstalled on your systemPATH(sudo apt install ffmpegorbrew install ffmpeg).
Installation
pip install -e ".[dev]"Claude Code / Claude Desktop Configuration
Add ffmpeg-mcp-server to your claude_desktop_config.json or .mcp.json:
{
"mcpServers": {
"ffmpeg": {
"command": "ffmpeg-mcp-server",
"env": {
"FFMPEG_MCP_WORKDIR": "/path/to/your/media/workspace"
}
}
}
}Or add it directly in Claude Code CLI:
claude mcp add ffmpeg -- ffmpeg-mcp-server --workdir /path/to/your/media/workspaceπ οΈ Available MCP Tools
Tool Name | Description | Supports |
| Inspect container duration, streams, resolution, FPS, and codecs via | Yes |
| Cut a media segment between | Yes |
| Reframe video to | Yes |
| Extract audio stream to | Yes |
| Build a validated | No (Pure file/string) |
| Burn an | Yes |
π§ͺ Running Tests
All unit tests run offline without requiring media fixtures or external network calls:
pytest -q
ruff check .π€ Contributing & Security
See CONTRIBUTING.md for development setup and pull request guidelines, and SECURITY.md for our security policy and sandboxing invariants.
π License
Licensed under the MIT License.
Available Tools
6 toolsburn_subtitlesC
Burn an .srt subtitle file into a video with customizable font size and vertical margin.
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| margin_v | No | ||
| font_size | No | ||
| input_path | Yes | ||
| output_path | Yes | ||
| subtitle_path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and mostly doesn't. 'Burn' implies re-encoding and mutation, but it never says whether the input is preserved, whether output_path is overwritten if it exists, how long it takes, or that ffmpeg-level encoding is involved. Only the cosmetic customization is disclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the core action and the two customization knobs come first. It is efficient, though the brevity is partly the source of the missing guidance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a six-parameter mutating media tool with no annotations, no output schema, and 0% schema coverage, this is thin. There is no mention of the dry_run escape hatch, overwrite semantics, or error conditions, which an agent needs before committing to a potentially expensive encode.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate and only names two of six parameters (font size, vertical margin) without units, ranges, or defaults. The three required path parameters and especially the non-obvious dry_run flag are never explained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('burn') and resources (an .srt file into a video), which is more precise than a generic 'add subtitles'. It doesn't reference any sibling, so the agent must infer that generate_srt creates the file this one consumes, but the core action is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No indication of when to use this versus generate_srt or how it chains after subtitle creation. No prerequisites stated, such as needing an existing video and an existing .srt on disk. The agent is left to infer the entire workflow.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
convert_aspect_ratioC
Reframe a video to 9:16, 1:1, 16:9, or 4:5 using crop or pad mode.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | crop | |
| dry_run | No | ||
| input_path | Yes | ||
| output_path | Yes | ||
| aspect_ratio | No | 9:16 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It does not disclose that output_path is written, whether input_path is modified, how crop vs pad affects content, or what dry_run does.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler. It is efficiently sized, though its terseness contributes to gaps elsewhere rather than being a conciseness problem itself.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a mutation tool with five parameters, no annotations, no output schema, and zero schema coverage, the description is too thin. It omits file-path semantics, dry-run behavior, output/overwrite behavior, and mode trade-offs.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description only clarifies the aspect_ratio and mode parameters via examples. It says nothing about input_path, output_path, or the important dry_run flag, leaving three of five parameters undocumented.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (Reframe) and resource (video), and enumerates target aspect ratios and modes. It does not explicitly differentiate from sibling tools such as trim_clip, but the purpose is immediately clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings, nor when to choose crop versus pad. The description implies its use for aspect-ratio conversion but leaves alternatives and conditions unstated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_audioC
Extract audio track from media file into mp3, wav, flac, or m4a.
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| normalize | No | ||
| input_path | Yes | ||
| output_path | Yes | ||
| audio_format | No | mp3 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden, and it discloses almost nothing: overwrite behavior on an existing output_path, whether the source audio stream is re-encoded or copied, failure modes for files with no audio, and permissions are all unstated. Only the supported output formats are revealed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with zero filler; the operation and output formats come first. It is efficient, though efficiency here comes partly at the cost of omitted detail rather than through tight editing of rich content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a five-parameter file-mutating tool with no annotations, no output schema, and 0% schema description coverage, the description is far too thin. An agent cannot determine what dry_run or normalize do or what the tool returns on success.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across five parameters, so the description must compensate, but it only enumerates the audio_format enum values that the schema already lists. The required input_path/output_path, plus dry_run and normalize β which materially change behavior β get no explanation at all.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('extract') and resource ('audio track from media file'), which unambiguously separates it from the video-editing siblings like trim_clip or burn_subtitles. It does not explicitly name an alternative, but the operation is distinct enough that no agent would confuse it.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus the sibling media tools, nor any stated preconditions (e.g. that the source file must contain an audio stream). The agent must infer usage entirely from the verb.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_srtB
Generate a validated .srt subtitle file inside the workspace from structured cues.
| Name | Required | Description | Default |
|---|---|---|---|
| cues | Yes | ||
| output_path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the output is validated and written inside the workspace, but does not explain validation rules, overwrite behavior, error handling, permissions, or directory creation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is a single front-loaded sentence with no filler. It states the key action and output immediately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no annotations, no output schema, and 0% schema description coverage, the one-sentence description is not complete enough for an agent to call the tool confidently. It leaves cue structure, timestamp semantics, path behavior, and validation details unspecified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, but it only alludes to 'structured cues' and a workspace output path. It does not document cue fields, timestamp units, or output_path constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb and resource: generate a validated .srt subtitle file from structured cues. It is clear what the tool produces, though it does not explicitly distinguish itself from the related burn_subtitles sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'from structured cues' implies when the tool is appropriate, but there is no explicit when-to-use guidance, no exclusions, and no named alternatives such as burn_subtitles or extract_audio.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
probe_mediaB
Inspect media container duration, resolution, codecs, and streams via ffprobe.
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| input_path | Yes | Path to media file inside workspace. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden, yet it does not state that the operation is read-only/non-destructive, what happens on non-media or missing files, or ffprobe availability requirements. Most notably it never explains why a read-only inspection tool accepts a 'dry_run' flag, which is a behavioral ambiguity an agent needs resolved.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the verb, the inspected attributes, and the engine all appear immediately, and every clause contributes information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter read tool with no annotations and no output schema, listing the returned attributes partially compensates for the missing return documentation. However, the unexplained 'dry_run' parameter and the absence of any file-type or failure behavior leave a real gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 50%: input_path is documented in the schema, but 'dry_run' has no description anywhere and the tool description adds nothing about its meaning or effect for an inspection call. The listed outputs (duration, resolution, codecs, streams) hint at what the path yields but do not clarify either parameter's semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ("Inspect") and resource ("media container") and enumerates what is reported (duration, resolution, codecs, streams), plus the underlying implementation (ffprobe). It never names a sibling, but the read-only inspection intent is naturally distinct from the mutating siblings (trim, convert, extract, burn).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use, when-not, or ordering guidance (e.g., "call before trim_clip to check resolution"). Usage is only inferable from the verb "Inspect" and the fact that every sibling transforms media.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
trim_clipC
Trim a video or audio clip between start_time and end_time/duration.
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| duration | No | ||
| end_time | No | ||
| reencode | No | ||
| input_path | Yes | ||
| start_time | No | ||
| output_path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, yet it says nothing about the two behavioral flags that matter most: dry_run (preview without writing) and reencode (defaulting to true, implying quality/speed tradeoffs). It also omits what happens on invalid ranges or whether output overwrites an existing file.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with the key operation and time parameters front-loaded; no filler or repetition. It is efficient, though its brevity leaves necessary detail for the other dimensions rather than bloating this one.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 7-parameter mutation tool with zero annotation coverage, no output schema, and no schema descriptions, the description is too thin. An agent cannot tell what reencode or dry_run do, what the time formats are, or what the tool returns.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across 7 parameters, and the description only names three of them without format detail β it does not clarify whether times are strings like '00:01:30' or numeric seconds, despite the union type. The required input_path/output_path and the dry_run/reencode flags receive no explanation at all.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb ('Trim') and resource ('video or audio clip'), and it references the start/end/duration parameters, which makes the intent clear. It does not explicitly differentiate itself from siblings like extract_audio or convert_aspect_ratio, but the operation is distinct enough to be recognizable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus alternatives, nor any stated prerequisites (e.g., valid media path). The description is purely declarative about what it does, leaving the agent to infer the context in which trimming is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
burn_subtitles - First observed
convert_aspect_ratio - First observed
extract_audio - First observed
generate_srt - First observed
probe_media - First observed
trim_clip
TDQS
Scored across 6 tools
Each tool maps to a distinct ffmpeg operation: probing, trimming, aspect-ratio reframing, audio extraction, SRT generation, and subtitle burning. There is no meaningful overlap; generate_srt (create cues) and burn_subtitles (embed an existing .srt) are clearly differentiated by their descriptions.
All six tools follow a consistent snake_case verb_noun pattern (probe_media, trim_clip, extract_audio, burn_subtitles, etc.). Verb choices are accurate and predictable, and convert_aspect_ratio is the only longer name but still fits the convention.
Six tools is a well-scoped surface for a focused ffmpeg wrapper, with each tool earning its place. Nothing feels redundant or padded, and the set stays comfortably in the ideal 3-15 range.
Core operations (probe, trim, reframe, audio extract, subtitle create/burn) are covered, but common ffmpeg workflows are absent: concatenation/merging clips, general format transcoding or compression, frame/thumbnail extraction, and overlays/watermarks. These gaps will force agents to work around missing lifecycle operations.
Maintenance
Related MCP Connectors
FFmpeg as a service for AI agents: typed video editing tools, async jobs, downloadable outputs.
Transform video, audio and images, and generate media from prompts. FFmpeg, captions, models.
Video, audio, and image processing for AI agents: convert, transcribe, upscale - 150+ operations.
15 media & data tools for AI agents: search, transcribe, subtitles, voiceover, translate & more.
Related MCP Servers
- AlicenseBqualityBmaintenanceProvides video and audio manipulation tools powered by FFmpeg, enabling AI assistants to perform media operations such as cutting, converting, and removing silence.6169 npm2MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to safely execute ffmpeg and ffprobe operations by passing arguments as arrays, avoiding shell injection, with support for probe, convert, trim, concat, thumbnail, watermark, speed, loudnorm, and batch processing.24,296 npmMIT
- AlicenseBqualityCmaintenanceProvides Claude Code with local ffmpeg-based tools to probe, trim, concat, transform, overlay, mix audio, render JSON timelines, and run automated QA on video filesβno API key required.9Apache 2.0
- AlicenseBqualityCmaintenanceEnables AI agents to programmatically edit videos via FFmpeg, providing tools for probing, trimming, concatenating, timeline composition, LUT generation/application, rendering, and edit verification over MCP.162MIT