FFmpeg is arguably the most powerful piece of multimedia software ever written. It powers YouTube, Netflix, Discord, and VLC, capable of cutting, transcoding, filtering, and assembling video at blistering speeds. Yet for 99% of creators and developers, FFmpeg is an impenetrable black box of cryptic flags, obscure filtergraphs, and terrifying terminal syntax errors.
Enter the Model Context Protocol (MCP). By connecting Claude Desktop or Claude Code directly to a local FFmpeg MCP server, you transform Claude into an autonomous video editing engineer. Instead of Googling arcane CLI commands or manually scrubbing timelines, you simply tell Claude in plain English: "Trim the silences from this recording, crop the speaker into 9:16 vertical, add blurred letterboxing, and burn in high-contrast captions."
How Model Context Protocol Solves the FFmpeg Problem
Humans hate memorizing filter syntax like [0:v]split=2[bg][fg];[bg]scale=1080:1920:force_original_aspect_ratio=increase,boxblur=20:5[bg_blurred]. But Large Language Models are encyclopedias of syntax. With MCP, Claude doesn't just print terminal commands for you to copy-paste—it inspects the video file's codecs, calculates optimal bitrates, runs the command securely in your local environment, verifies the output, and reports back with the finished video.
The Architecture: Connecting Claude to FFmpeg
The workflow uses standard Anthropic Model Context Protocol architecture:
- The Client: Claude Desktop or Claude Code CLI running locally on your computer.
- The Protocol: Standardized JSON-RPC over stdio.
- The MCP Server: A lightweight Python or Node.js server exposing video manipulation tools (e.g.,
inspect_media,trim_silence,crop_vertical,burn_subtitles,transcode_video). - The Engine: Your local FFmpeg binary executing hardware-accelerated encoding via Metal (Apple Silicon) or NVENC (NVIDIA).
Step 1: Setting Up the FFmpeg MCP Server in 5 Minutes
You can create a rock-solid, production-ready FFmpeg MCP server using Python's FastMCP library. First, ensure you have FFmpeg installed on your machine:
# On macOS via Homebrew
brew install ffmpeg
# On Ubuntu/Debian Linux
sudo apt install ffmpeg
# Install FastMCP
pip install fastmcp
Create a Python script named ffmpeg_mcp_server.py:
# ffmpeg_mcp_server.py
import subprocess
import json
import os
from fastmcp import FastMCP
mcp = FastMCP("Local-FFmpeg-Video-Studio")
@mcp.tool()
def probe_video(file_path: str) -> str:
"""Inspect video resolution, codec, duration, and audio streams using ffprobe."""
if not os.path.exists(file_path):
return f"Error: File '{file_path}' does not exist."
cmd = [
"ffprobe", "-v", "quiet", "-print_format", "json",
"-show_format", "-show_streams", file_path
]
res = subprocess.run(cmd, capture_output=True, text=True)
return res.stdout
@mcp.tool()
def run_ffmpeg(command: str) -> str:
"""Execute an ffmpeg command within a designated media directory."""
# Security check: ensure command starts with ffmpeg and avoids destructive host operations
if not command.strip().startswith("ffmpeg"):
return "Error: Command must begin with 'ffmpeg'."
print(f"Executing: {command}")
res = subprocess.run(command, shell=True, capture_output=True, text=True)
if res.returncode != 0:
return f"FFmpeg Error:
{res.stderr[-800:]}"
return f"Success! Output generated.
{res.stderr[-300:]}"
if __name__ == "__main__":
mcp.run()
Step 2: Configuring Claude Desktop
Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the FFmpeg server to your mcpServers dictionary:
{
"mcpServers": {
"ffmpeg-studio": {
"command": "python3",
"args": ["/Users/yourname/scripts/ffmpeg_mcp_server.py"]
}
}
}
Restart Claude Desktop. You will see a small hammer 🔨 icon indicating that Claude now has direct access to probe_video and run_ffmpeg.
4 Real-World Video Editing Workflows Tested with Claude
Workflow 1: Auto-Detecting and Slicing Silences
When recording tutorials, webinars, or video podcasts, creators waste immense time manually cutting out pauses, breaths, and hesitation gaps. You can prompt Claude:
"Inspectinterview.mp4. Find all silent audio segments longer than 0.7 seconds with volume below -30dB, cut them out, and export a clean seamless cut tointerview_tight.mp4."
Claude automatically generates and executes FFmpeg's compound silencedetect filter and assembles the timestamps into a continuous timeline, removing 15 minutes of dead air from an hour-long recording in under 45 seconds.
Workflow 2: Converting 16:9 Landscape Video into a 9:16 Vertical Reel
Turning a horizontal YouTube video into a vertical TikTok, Reel, or YouTube Short usually requires opening an editor, duplicating tracks, and manually blurring the top and bottom. With Claude, you simply say:
"Convert demo_landscape.mp4 into a 1080x1920 vertical video. Center the original 16:9 clip in the middle, and fill the top and bottom letterbox bars with a 25px Gaussian-blurred scaled version of the same video."
Behind the scenes, Claude writes and runs this complex filtergraph:
ffmpeg -i demo_landscape.mp4 -filter_complex "[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,boxblur=25:5[bg]; [0:v]scale=1080:-1[fg]; [bg][fg]overlay=(W-w)/2:(H-h)/2" -c:a copy output_reel.mp4
Workflow 3: Auto-Audio Normalization to Streaming Broadcast Standards
Podcasters and video creators frequently struggle with inconsistent audio: one guest whispers while another blows out the microphone. Claude can analyze the audio stream with the EBU R128 loudness filter and apply two-pass loudness normalization directly:
# Claude executes broadcast-standard -14 LUFS loudness normalization
ffmpeg -i podcast_rough.mp4 -af loudnorm=I=-14:LRA=7:tp=-1.5 -c:v copy podcast_mastered.mp4
Workflow 4: 90% Compression with Zero Perceptible Quality Loss
Got a 2.5GB screen capture file from OBS or Zoom that you need to send over Slack or email? Traditional web compressors degrade video into muddy artifacts. Tell Claude:
"Compress obs_recording.mov using H.265 / HEVC with a Constant Rate Factor (CRF) of 26 and AAC audio at 128k. Keep original resolution."
The result is a 180MB file (92% reduction) with razor-sharp text and crisp audio, rendered entirely on your local GPU.
Best Practices & Security Rules for Video MCP
- Folder Sandboxing: Always constrain the MCP server to a designated working directory (e.g.,
~/Videos/AI_Workspace/) so the agent cannot inadvertently touch system files. - GPU Hardware Acceleration: If you are on an Apple Silicon Mac, tell Claude to include
-c:v h264_videotoolboxorhevc_videotoolboxto encode videos 5x faster with minimal battery drain. - Keep Originals Intact: Always instruct Claude to append suffixes like
_edited,_vertical, or_normalizedrather than overwriting source footage.
Explore More Model Context Protocol Tools
Want to build more custom AI integrations? Read our comprehensive tutorial on Building FastMCP Servers in Python or browse our verified Production MCP Server Directory.