Skip to main content
Glama

ffmpeg-mcp-server 🎬

CI License: MIT Python 3.10+ MCP Compatible

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 via ffprobe in clean JSON.

  • βœ‚οΈ Frame-Accurate Clip Trimming (trim_clip): Cuts segments with millisecond-accurate timestamps (HH:MM:SS.mmm or 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 .srt subtitle files from structured cue arrays and burns them into video with customizable font size and margin styling.

  • 🎡 Audio Extraction & Normalization (extract_audio): Extracts clean mp3, wav, flac, or m4a tracks 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=True support on every mutative tool so agents can preview exact ffmpeg argv arrays before execution.


Related MCP server: ffmpeg-mcp

πŸš€ Quick Start

Prerequisites

  • Python 3.10+

  • ffmpeg and ffprobe installed on your system PATH (sudo apt install ffmpeg or brew 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 dry_run

probe_media

Inspect container duration, streams, resolution, FPS, and codecs via ffprobe.

Yes

trim_clip

Cut a media segment between start_time and end_time or duration.

Yes

convert_aspect_ratio

Reframe video to 9:16, 1:1, 16:9, or 4:5 using crop or pad mode.

Yes

extract_audio

Extract audio stream to mp3, wav, flac, or m4a with optional loudnorm.

Yes

generate_srt

Build a validated .srt subtitle file from a list of {start, end, text} cues.

No (Pure file/string)

burn_subtitles

Burn an .srt file into a video with custom font size and alignment.

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 tools
burn_subtitlesC

Burn an .srt subtitle file into a video with customizable font size and vertical margin.

NameRequiredDescriptionDefault
dry_runNo
margin_vNo
font_sizeNo
input_pathYes
output_pathYes
subtitle_pathYes

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

NameRequiredDescriptionDefault
modeNocrop
dry_runNo
input_pathYes
output_pathYes
aspect_ratioNo9:16

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

NameRequiredDescriptionDefault
dry_runNo
normalizeNo
input_pathYes
output_pathYes
audio_formatNomp3

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

NameRequiredDescriptionDefault
cuesYes
output_pathYes

TDQS

B3/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines3/5

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.

NameRequiredDescriptionDefault
dry_runNo
input_pathYesPath to media file inside workspace.

TDQS

B3.1/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness3/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines3/5

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.

NameRequiredDescriptionDefault
dry_runNo
durationNo
end_timeNo
reencodeNo
input_pathYes
start_timeNo
output_pathYes

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

  1. 6 tool updatesv0.1.0
    • First observedburn_subtitles
    • First observedconvert_aspect_ratio
    • First observedextract_audio
    • First observedgenerate_srt
    • First observedprobe_media
    • First observedtrim_clip

TDQS

B3.3/5.0

Scored across 6 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

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.

Completeness3/5

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

ActivityMaintained
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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 npm
    MIT