Skip to main content
Glama

🎬 ffmpeg-mcp

A powerful MCP server for video and audio processing through FFmpeg

PyPI version License: MIT Python Version

Integrate FFmpeg with Claude, Dive, and other MCP-compatible AI systems. Convert, compress, trim videos, extract audio, and more β€” all through natural language.

Features β€’ Installation β€’ Tools β€’ Usage β€’ Configuration


✨ Features

πŸ“Š Media Information

  • Get comprehensive metadata

  • Duration, resolution, codecs

  • Bitrate and stream details

  • JSON formatted output

πŸ”„ Format Conversion

  • Convert between any formats

  • MP4, MKV, WebM, MOV, etc.

  • Custom video/audio codecs

  • Resolution scaling

πŸ—œοΈ Video Compression

  • Quality presets (low/medium/high)

  • Encoding speed control

  • H.264 optimization

  • Size reduction stats

βœ‚οΈ Video Trimming

  • Precise start/end times

  • Duration-based cuts

  • Stream copy (fast)

  • No re-encoding needed

🎡 Audio Extraction

  • Multiple formats supported

  • MP3, AAC, WAV, FLAC, OGG, Opus

  • Bitrate control

  • High quality output

🎞️ Advanced Features

  • Merge multiple videos

  • Extract frames as images

  • Interval or count-based extraction

  • JPG, PNG, BMP, WebP output

πŸ“ Subtitles

  • Burn-in SRT/ASS/VTT subtitles

  • Multiple styles available

  • Customizable font size

  • Works great with Whisper MCP


Related MCP server: Video & Audio Editing MCP Server

πŸš€ Installation

Prerequisites

Install FFmpeg on your system:

Getting Started

Add the following config to your MCP client:

{
  "mcpServers": {
    "ffmpeg": {
      "command": "uvx",
      "args": ["ffmpeg-mcp-lite"]
    }
  }
}

MCP Client Configuration

  1. Open Dive Desktop

  2. Click "+ Add MCP Server"

  3. Paste the config provided above

  4. Click "Save" and you're ready!

Use the Claude Code CLI to add the ffmpeg MCP server:

claude mcp add ffmpeg uvx ffmpeg-mcp-lite

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "ffmpeg": {
      "command": "uvx",
      "args": ["ffmpeg-mcp-lite"]
    }
  }
}

Go to Cursor Settings -> MCP -> New MCP Server. Use the config provided above.

Install via the VS Code CLI:

code --add-mcp '{"name":"ffmpeg","command":"uvx","args":["ffmpeg-mcp-lite"]}'

Follow the configure MCP guide using the standard config from above.

Manual Installation

pip install ffmpeg-mcp-lite

Or with uv:

uv pip install ffmpeg-mcp-lite

πŸ› οΈ Available Tools

All tools are prefixed with ffmpeg_ to avoid naming conflicts with other MCP servers.

πŸ“Š Media Information

Get comprehensive video/audio metadata

  • Parameters: file_path

  • Returns: JSON with duration, resolution, codecs, bitrate, streams

πŸ”„ Conversion & Compression

Convert video/audio to different formats

  • Parameters: file_path, output_format, scale, video_codec, audio_codec

  • Formats: mp4, mkv, webm, mov, mp3, wav, etc.

Compress video to reduce file size

  • Parameters: file_path, quality, scale, preset

  • Quality: low, medium, high

  • Preset: ultrafast to veryslow

βœ‚οΈ Editing

Trim video to extract a segment

  • Parameters: file_path, start_time, end_time or duration

  • Time format: "00:01:30" or seconds

Concatenate multiple videos into one

  • Parameters: file_paths (list), output_path

  • Supports: Same codec videos

🎡 Audio & Frames

Extract audio track from video

  • Parameters: file_path, audio_format, bitrate

  • Formats: mp3, aac, wav, flac, ogg, opus

Extract frames as images

  • Parameters: file_path, interval or count, format

  • Formats: jpg, png, bmp, webp

πŸ“ Subtitles

Burn-in subtitles to video (hardcode)

  • Parameters: file_path, subtitle_path, style, font_size, output_path

  • Formats: SRT, ASS, VTT

  • Styles: outline, shadow, background, glow


πŸ’‘ Usage Examples

Get Media Information

"Get info about /path/to/video.mp4"
"What's the resolution and duration of this video?"
"Show me the codec information for my video"

Convert Videos

"Convert video.mp4 to WebM format"
"Convert this video to MKV with h265 codec"
"Convert and scale to 1280x720"

Compress Videos

"Compress video.mp4 with medium quality"
"Compress this video to reduce file size, use fast preset"
"Compress with high quality and scale to 1920:-1"

Trim Videos

"Trim video.mp4 from 00:01:00 to 00:02:30"
"Cut the first 30 seconds from this video"
"Extract a 1-minute clip starting at 5:00"

Extract Audio

"Extract audio from video.mp4 as MP3"
"Get the audio track in AAC format with 192k bitrate"
"Extract audio as FLAC for best quality"

Extract Frames

"Extract one frame every 5 seconds from video.mp4"
"Get 10 frames evenly distributed from this video"
"Extract frames as PNG images"
"Extract frames as WebP for screen recordings"

πŸ’‘ For screen recordings, prefer png or webp over jpg β€” JPEG chroma subsampling smears anti-aliased text and 1px UI borders.

Merge Videos

"Merge video1.mp4 and video2.mp4 together"
"Concatenate these three videos into one"

Add Subtitles

"Add subtitles.srt to video.mp4"
"Burn in Chinese subtitles with shadow style"
"Add subtitles with font size 32 and glow effect"

πŸ”§ Configuration

Environment Variables

Variable

Description

Default

FFMPEG_PATH

Path to ffmpeg binary

ffmpeg

FFPROBE_PATH

Path to ffprobe binary

ffprobe

FFMPEG_OUTPUT_DIR

Default output directory

~/Downloads

Custom Configuration

{
  "mcpServers": {
    "ffmpeg": {
      "command": "uvx",
      "args": ["ffmpeg-mcp-lite"],
      "env": {
        "FFMPEG_OUTPUT_DIR": "/path/to/output"
      }
    }
  }
}

πŸ—οΈ Architecture

Built With

  • FFmpeg - Video/audio processing engine

  • FastMCP - MCP Python framework

  • asyncio - Async subprocess execution

  • Python 3.10+ - Type hints and modern features

Key Features

  • βœ… Async Processing: Non-blocking FFmpeg execution

  • βœ… Type Safe: Full type hints with mypy validation

  • βœ… Well Tested: 32 test cases with pytest

  • βœ… Cross Platform: Works on Windows, macOS, Linux

  • βœ… Modular Design: One file per tool


🀝 Contributing

Contributions are welcome!

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

Development

# Clone and install
git clone https://github.com/kevinwatt/ffmpeg-mcp-lite.git
cd ffmpeg-mcp-lite
uv sync

# Run tests
uv run pytest

# Type checking
uv run mypy src/

# Linting
uv run ruff check src/

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • FFmpeg - The powerful multimedia framework

  • Anthropic - For the Model Context Protocol

  • Dive - MCP-compatible AI platform


⬆ Back to Top

Available Tools

8 tools
ffmpeg_add_subtitlesA

Add subtitles to a video file (burn-in/hardcode).

Args:
    file_path: Path to the input video file
    subtitle_path: Path to the subtitle file (SRT, ASS, VTT)
    style: Subtitle style - "outline" (default), "shadow", "background", or "glow"
    font_size: Font size for subtitles (default: 24)
    output_path: Optional output file path. If not specified, saves to default output directory.

Returns:
    Path to the output video with subtitles

Inputs: file_path (required), subtitle_path (required), style, font_size, +1 more. Returns: result

ffmpeg_compressA

Compress a video file to reduce file size.

Args:
    file_path: Path to the input video file
    quality: Compression quality level - "low" (smallest file), "medium", or "high" (best quality)
    scale: Optional resolution scale (e.g., "1280:720", "1920:-1" for auto height)
    preset: Encoding speed preset - faster presets = larger files, slower = smaller files

Returns:
    Path to the compressed file

Inputs: file_path (required), quality, scale, preset. Returns: result

ffmpeg_convertB

Convert video/audio to a different format.

Args:
    file_path: Path to the input media file
    output_format: Target format (e.g., mp4, mkv, webm, mp3, wav)
    scale: Optional resolution scale (e.g., "1280:720", "1920:-1" for auto height)
    video_codec: Optional video codec (e.g., libx264, libx265, libvpx-vp9)
    audio_codec: Optional audio codec (e.g., aac, mp3, opus)

Returns:
    Path to the converted file

Inputs: file_path (required), output_format (required), scale, video_codec, +1 more. Returns: result

ffmpeg_extract_audioA

Extract audio track from a video file.

Args:
    file_path: Path to the input video file
    audio_format: Output audio format (mp3, aac, wav, flac, ogg, opus)
    bitrate: Audio bitrate (e.g., "128k", "192k", "320k"). If not specified, uses format default.

Returns:
    Path to the extracted audio file

Inputs: file_path (required), audio_format, bitrate. Returns: result

ffmpeg_extract_framesA

Extract frames from a video as images.

Args:
    file_path: Path to the input video file
    interval: Extract one frame every N seconds (e.g., 1.0 for one frame per second)
    count: Total number of frames to extract (evenly distributed). Mutually exclusive with interval.
    format: Output image format (jpg, png, bmp)

Returns:
    Path to the directory containing extracted frames

Inputs: file_path (required), interval, count, format. Returns: result

ffmpeg_get_infoA

Get video/audio file metadata using ffprobe.

Args:
    file_path: Path to the media file

Returns:
    JSON string with media metadata including duration, resolution,
    codecs, bitrate, and stream information

Inputs: file_path (required). Returns: result

ffmpeg_mergeA

Concatenate multiple video files into one.

Args:
    file_paths: List of paths to video files to merge (in order)
    output_path: Optional output file path. If not specified, saves to default output directory.

Returns:
    Path to the merged file

Inputs: file_paths (required), output_path. Returns: result

ffmpeg_trimA

Trim a video to extract a specific segment.

Args:
    file_path: Path to the input video file
    start_time: Start time (e.g., "00:01:30" or "90" for 90 seconds)
    end_time: End time (e.g., "00:02:00"). Mutually exclusive with duration.
    duration: Duration of the clip (e.g., "30" for 30 seconds). Mutually exclusive with end_time.

Returns:
    Path to the trimmed file

Inputs: file_path (required), start_time (required), end_time, duration. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: adding subtitles, compressing, converting, extracting audio, extracting frames, getting info, merging, and trimming. No overlap in functionality.

    Naming Consistency5/5

    All tools follow a consistent 'ffmpeg_verb_noun' pattern in snake_case (e.g., ffmpeg_extract_audio, ffmpeg_get_info). No deviations.

    Tool Count5/5

    With 8 tools, the server covers a broad range of common FFmpeg operations without being excessive. Each tool serves a distinct, useful purpose.

    Completeness4/5

    The tool set covers core video/audio operations (info, conversion, compression, trimming, merging, subtitle addition) but lacks advanced features like video effects or audio filters. It is sufficient for typical use cases.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers