# FFmpeg MCP Server – Convert, Compress, Trim & Extract Media (`gazidev/ffmpeg-media-mcp`) Actor

MCP server with 12 FFmpeg tools for AI agents: probe, convert, compress to target MB, trim, extract audio, GIF, thumbnail, frames, merge, 9:16 resize, watermark, loudness normalize. Direct file URLs in, public download links out. From $0.002 per call.

- **URL**: https://apify.com/gazidev/ffmpeg-media-mcp.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 tool calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## FFmpeg MCP Server – convert, compress, trim and extract media for AI agents

**FFmpeg MCP Server** gives Claude, Cursor, ChatGPT, n8n and any other Model Context Protocol (MCP) client 12 FFmpeg media tools in one remote server. You don't install FFmpeg, run servers or upload anything. Your agent passes a **direct media file URL** and gets back a **public download link** to the result, which it can pass straight to the next tool.

- 🎬 **Video:** convert (MP4, WebM, MOV), compress to a target size in MB, trim, merge, resize to 9:16, 1:1 or 4:5, add a watermark, make a GIF
- 🎧 **Audio:** extract audio to MP3, M4A, WAV, FLAC, OGG or Opus, and normalize loudness (EBU R128 / LUFS)
- 🖼️ **Images:** thumbnail, frames for vision models, image watermark
- 🔍 **Probe:** duration, resolution, fps, codecs, bitrate and streams (ffprobe)
- 💸 **Pay per use:** $0.002 per successful call, plus a per-minute or per-frame fee for outputs. Failed calls are free.

### Connect your MCP client

MCP endpoint (Streamable HTTP):

```
https://gazidev--ffmpeg-media-mcp.apify.actor/mcp
```

Authenticate with your Apify API token as a bearer token: `Authorization: Bearer <APIFY_TOKEN>`.

**Claude Desktop / Cursor** (`mcp.json` / `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "ffmpeg": {
      "url": "https://gazidev--ffmpeg-media-mcp.apify.actor/mcp",
      "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
    }
  }
}
```

For clients that only support stdio, use `npx mcp-remote https://gazidev--ffmpeg-media-mcp.apify.actor/mcp --header "Authorization: Bearer YOUR_APIFY_TOKEN"`.

### Tools

| Tool | What it does | Key arguments |
|---|---|---|
| `probe` | Media info: duration, width and height, fps, codecs, bitrate, size, streams | `url` |
| `convert` | Converts to MP4 (H.264), WebM (VP9, up to 720p) or MOV, or to any audio format | `url`, `format`, `max_resolution`, `quality`, `start`, `end`, `mute`, `fps` |
| `compress` | Shrinks a video to a target size in MB (2-pass) or by quality level | `url`, `target_size_mb`, `max_resolution` (default 720) |
| `extract_audio` | Extracts audio to MP3, M4A, WAV, FLAC, OGG or Opus | `url`, `format`, `bitrate_kbps`, `normalize` |
| `trim` | Cuts between `start` and `end`. Frame-accurate, or instant `fast_copy` | `url`, `start`, `end`, `fast_copy` |
| `gif` | Makes a palette-optimized animated GIF (up to 30 s) | `url`, `start`, `duration`, `fps`, `width` |
| `thumbnail` | Grabs one still frame as JPG, PNG or WebP | `url`, `time`, `width`, `format` |
| `frames` | Extracts up to 100 frames, evenly spaced or every N seconds | `url`, `count` or `interval_seconds`, `width` |
| `merge` | Joins 2 to 20 clips into one MP4, normalizing size, fps and audio | `urls`, `max_resolution` |
| `resize_aspect` | Reframes to 9:16, 1:1, 4:5, 16:9 or any W:H with a blurred background, color bars or a crop | `url`, `aspect`, `mode`, `resolution` |
| `watermark` | Adds a text or logo watermark to a video or image (9 positions, or tiled) | `url`, `text`, `image_url`, `position`, `opacity` |
| `normalize_audio` | Normalizes loudness to a LUFS target. The video stream is copied untouched | `url`, `target_lufs`, `format` |

Times take seconds (`12.5`) or `HH:MM:SS`. Limits per call: 500 MB per input file and 60 output minutes.

#### Example agent prompts

- "Compress https://example.com/demo.mov to under 8 MB so I can post it on Discord."
- "Turn this landscape video into a 9:16 Reel with a blurred background, then add '@mybrand' bottom-right."
- "Take 12 frames from this video and describe what happens."
- "Extract the audio as MP3, normalize it to -14 LUFS, and give me a 5-second GIF from 00:01:10."

#### Example result (`compress`)

```json
{
  "tool": "compress",
  "file_url": "https://api.apify.com/v2/key-value-stores/abc123/records/compress-5e03fce1-demo.mp4",
  "content_type": "video/mp4",
  "size_bytes": 454653,
  "output": {"format": "mp4", "duration": 5.759, "width": 854, "height": 480, "videoCodec": "h264", "size_reduction_pct": 84.0},
  "input": {"url": "https://example.com/demo.mp4", "duration": 5.759, "width": 1920, "height": 1080, "sizeBytes": 2848208},
  "billed_events": {"tool-call": 1, "fullhd-video-minute": 1},
  "processing_sec": 1.74
}
```

### Supported inputs

The server accepts **direct links to media files**: MP4, MOV, MKV, WebM, AVI, MP3, WAV, FLAC, M4A, OGG, PNG, JPG and WebP. The link can be a file on your server, an S3 or R2 public or presigned URL, a Google Cloud Storage link, an Apify key-value store record, or the output of a previous tool.

**Not supported:** YouTube, TikTok, Instagram, Vimeo and other platform pages, HLS/DASH playlists (`.m3u8` / `.mpd`), and private or local network addresses. This is a media processing tool, not a downloader, so only process files you own or have the right to process.

### Pricing (pay per event)

| Event | Price | When |
|---|---|---|
| Actor start | $0.02 | Once per server session (Standby run) |
| Tool call | $0.002 | Every successful tool call |
| SD video minute | $0.008 | Per started output minute, up to 576p (and every `fast_copy` trim) |
| HD video minute | $0.025 | Per started output minute, 720p tier |
| Full HD video minute | $0.06 | Per started output minute, 1080p tier |
| 4K video minute | $0.20 | Per started output minute, above 1080p |
| Audio minute | $0.003 | Per started output minute of audio. Loudness normalization counts 4 |
| Frame / image | $0.001 | Each thumbnail, extracted frame or watermarked image |
| GIF (per 10 s) | $0.015 | Per started 10 seconds of GIF |

The video tier is the higher of the **source** and **output** resolution, because decoding a 4K file costs as much as encoding one. **Failed calls are never charged.** Calls that would exceed your maximum charge per run are refused before any work is done.

**Example costs:** probing a file costs $0.002. A 1-minute 1080p video compressed to 720p costs $0.062. A 5-second GIF costs $0.017. Ten frames cost $0.012. Extracting 30 minutes of MP3 audio costs $0.092.

**Compared with the Store:** the only other FFmpeg MCP server on the Apify Store charges $0.03 per start plus $0.01 to $0.15 per operation. For example, it charges $0.1 per transcode or compress and $0.15 per merge. Short clips here cost 3 to 10 times less.

### Batch runs (without MCP)

You can also run the Actor normally from the Console, the API or a schedule. Pick a `tool`, then pass its `arguments` as JSON, or add several `calls`. Each call becomes one dataset row with a `file_url`. Example input:

```json
{"tool": "convert", "arguments": {"url": "https://www.w3schools.com/html/mov_bbb.mp4", "format": "webm"}}
```

### FAQ

**How long are the output links valid?** Outputs are stored in the run's key-value store. That store is kept for the data retention period of your Apify plan (7 days on the free plan). Download the files or copy them elsewhere if you need them longer.

**Is my media private?** Each run has its own key-value store. Its record links are unguessable, but anyone who has a link can download the file. Inputs are processed in a temporary folder and deleted after each call.

**What about long videos?** One call handles up to 60 output minutes and 500 MB per input file. For longer media, use `start` and `end` to process it in parts. Some MCP clients have short tool timeouts, so for long encodes use batch runs.

**Can I use it with n8n, Make or LangChain?** Yes. Any MCP client works. You can also call the Actor through the Apify API in batch mode.

**Why is WebM limited to 720p?** VP9 encoding needs about 2x the CPU of H.264. Use `mp4` for 1080p or 4K output.

### Use with AI agents / Apify MCP

This Actor *is* an MCP server. You can also reach it through the [Apify MCP server](https://mcp.apify.com), which lets agents discover and call Apify Actors. It works well alongside other Actors in an agent pipeline, for example a transcriber after `extract_audio` or a vision model after `frames`.

# Actor input Schema

## `tool` (type: `string`):

Which media tool to run in batch mode.

## `arguments` (type: `object`):

Arguments for the tool. Every tool takes "url" (a direct media file link; merge takes "urls"). Examples: convert {"url": "https://.../clip.mov", "format": "mp4", "max_resolution": "720"}; compress {"url": "...", "target_size_mb": 8}; trim {"url": "...", "start": "00:00:05", "end": 20}; gif {"url": "...", "start": 3, "duration": 5}. See the README for all arguments.

## `calls` (type: `array`):

Run several tool calls in one run (max 50): \[{"tool": "thumbnail", "arguments": {"url": "https://.../a.mp4"}}, {"tool": "extract_audio", "arguments": {"url": "https://.../a.mp4", "format": "mp3"}}]

## Actor input object example

```json
{
  "tool": "convert",
  "arguments": {
    "url": "https://www.w3schools.com/html/mov_bbb.mp4",
    "format": "webm"
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tool": "convert",
    "arguments": {
        "url": "https://www.w3schools.com/html/mov_bbb.mp4",
        "format": "webm"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/ffmpeg-media-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "tool": "convert",
    "arguments": {
        "url": "https://www.w3schools.com/html/mov_bbb.mp4",
        "format": "webm",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("gazidev/ffmpeg-media-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tool": "convert",
  "arguments": {
    "url": "https://www.w3schools.com/html/mov_bbb.mp4",
    "format": "webm"
  }
}' |
apify call gazidev/ffmpeg-media-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/ffmpeg-media-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/OPdqUD5B0XlR7ToVX/builds/7hhYklZTlcpAPiDlD/openapi.json
