ffmpeg-mcp

ffmpeg-mcp

Enables comprehensive video and audio processing using FFmpeg, supporting tasks like metadata extraction, clipping, scaling, and adding transitions or overlays. It provides a high-performance interface for building media processing microservices via FastMCP.

Category
访问服务器

README

ffmpeg-mcp

ffmpeg-mcp 🎬⚡

A Python package for media processing using FFmpeg and FastMCP. It enables building microservices that handle video/audio tasks with clean, reusable interfaces.


📖 Overview

This project provides a framework for handling media processing tasks using:

  1. FFmpeg — A powerful multimedia framework for processing audio and video files
  2. FastMCP — A high-performance framework for building microservices

🛠️ Available Tools

1. Metadata & Frames

  • get_video_metadata

    • param(s):

      • input_video_path: str
  • extract_frames

    • params:

      • input_video_path: str | Path
      • number_of_frames: int
      • frame_timestamps: int (eg: 5s, 10s, 15s, ...)

2. Audio

  • extract_audio

    • param(s):

      • input_video_path: str

3. Video Scaling & Resizing

  • scale_video

    • params:

      • input_video_path: str
      • resolution: Optional[str]

4. Overlay Operations

  • overlay_image

    • params:

      • input_video_path: str
      • overlay_image_path: str
      • positioning: Literal[top_left, bottom_left, top_right, bottom_right, center, top_center, bottom_center] = 'top_right'
      • scale: tuple[int, int] | None = (100, 100)
      • keep_audio: bool = True
      • opacity: float | None = None (range 0.0–1.0)
      • start_time: float = 0.0 (in seconds)
      • duration: float | None = None (in seconds; None = until end of video)
  • overlays_video

    • params:

      • input_video_path: str
      • overlay_video_path: str
      • positioning: Literal[top_left, bottom_left, top_right, bottom_right] = 'top_left'

5. Video Editing

  • clip_video

    • params:

      • input_video_path: str
      • start_timestamp
      • duration: int
  • crop_video

    • params:

      • input_video_path
      • safe_crop: bool
      • height: int
      • width: int
      • x_offset: int
      • y_offset: int
  • trim_and_concatenate

    • params:

      • input_video_path
      • number_of_trims: int
      • trim_timestamp: List[(start, end), (start, end), ...]
  • make_gif

    • params:

      • input_video_path
      • start_timestamp
      • duration

6. Concatenation & Transitions

  • concatenate_videos

    • param(s):

      • file_list: list[Path]
  • normalize_video_clips

    • params:

      • input_video_clips: List[str]
      • resolution: tuple default (1280, 720)
      • frame_rate: int default 30
      • crf: int default 23
      • audio_bitrate: str default 128k
      • preset: str default fast
  • concat_clips_with_transition

    • params:

      • input_video_clips: List[str]
      • transition_types: str default fade (e.g., fade, wipeleft, rectcrop, coverup, etc.)
      • transition_duration: float default 2

🧰 Utilities

The utils folder contains helper functions and decorators to enhance the functionality and robustness of the media processing tools.

a. Decorators

  • validate_input_video_path A decorator that checks if the video path exists, is non-empty, and is a valid video file. This ensures that all video processing functions receive a valid input file.

📦 Requirements

  • Python 3.12 or higher
  • uv (package manager)
  • FFmpeg installed on the system

🚀 Usage

The package can be used to build media processing microservices that leverage the power of FFmpeg through a Python interface.

1. Clone this repo

git clone git@github.com:yubraaj11/ffmpeg-mcp.git

2. Sync the project

uv sync --frozen

3. Use via MCP - Cline config

{
  "mcpServers": {
    "ffmpeg-mcp": {
      "autoApprove": [],
      "disabled": false,
      "timeout": 60,
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/ffmpeg-mcp/ffmpeg_mcp",
        "run",
        "main.py"
      ],
      "env": {
        "PYTHONPATH": "/path/to/ffmpeg-mcp"
      },
      "transportType": "stdio"
    }
  }
}

📚 Dependencies

  • ffmpeg-python — Python bindings for FFmpeg
  • fastmcp — Framework for building microservices
  • colorlog — Colored logging output
  • fastapi — Web framework for building APIs
  • pydantic — Data validation and settings management

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选