@ash_j1997/ffmpeg-mcp-server 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -43
- package/dist/index.js +283 -91
- package/dist/tools/audio.js +24 -9
- package/dist/tools/burn_subtitles.js +92 -0
- package/dist/tools/compress.js +8 -4
- package/dist/tools/concat.js +14 -3
- package/dist/tools/convert.js +77 -42
- package/dist/tools/keyframes.js +75 -0
- package/dist/tools/normalize.js +75 -0
- package/dist/tools/overlay.js +115 -0
- package/dist/tools/probe.js +6 -2
- package/dist/tools/reformat.js +13 -7
- package/dist/tools/silence.js +81 -20
- package/dist/tools/speed.js +24 -3
- package/dist/tools/split.js +15 -9
- package/dist/tools/subtitles.js +5 -2
- package/dist/tools/thumbnail.js +24 -13
- package/dist/tools/trim.js +36 -14
- package/dist/tools/waveform.js +3 -3
- package/dist/utils/exec.js +139 -8
- package/dist/utils/hwaccel.js +148 -26
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# ffmpeg-mcp-server
|
|
2
2
|
|
|
3
|
-
[](https://github.com/Ashutos1997/ffmpeg-mcp-server/actions) [](https://github.com/Ashutos1997/ffmpeg-mcp-server/releases) [](LICENSE) [](https://glama.ai/mcp/servers/@Ashutos1997/ffmpeg-mcp-server)
|
|
3
|
+
[](https://github.com/Ashutos1997/ffmpeg-mcp-server/actions) [](https://github.com/Ashutos1997/ffmpeg-mcp-server/releases) [](LICENSE) [](https://www.npmjs.com/package/@ash_j1997/ffmpeg-mcp-server) [](https://glama.ai/mcp/servers/@Ashutos1997/ffmpeg-mcp-server)
|
|
4
4
|
|
|
5
5
|
A Model Context Protocol (MCP) server that gives AI tools access to FFmpeg and FFprobe to process video and audio locally.
|
|
6
6
|
|
|
7
|
-
Supports
|
|
7
|
+
Supports cross-platform GPU hardware encoding (Apple Silicon, NVIDIA NVENC, Intel QuickSync, AMD AMF), live progress updates via MCP progress tokens, instant cancellation via `AbortSignal`, and inlines image previews directly for multimodal vision models.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -12,102 +12,102 @@ Supports Apple Silicon hardware encoding and returns image previews directly to
|
|
|
12
12
|
|
|
13
13
|
When AI agents process media, they often hallucinate invalid flags, syntax errors, or incompatible pixel formats.
|
|
14
14
|
|
|
15
|
-
This server provides
|
|
15
|
+
This server provides **17 typed tools** using Zod schemas. The AI passes parameters (such as `{ inputPath: "video.mov", preset: "web_mp4" }`), and the server runs the valid FFmpeg command locally with proper error handling, hardware acceleration, and progress notifications.
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
## Key Features
|
|
20
20
|
|
|
21
|
-
* **Hardware
|
|
22
|
-
* **
|
|
23
|
-
* **
|
|
24
|
-
* **
|
|
25
|
-
* **
|
|
21
|
+
* **Universal Hardware Acceleration:** Automatically detects and leverages hardware encoders across macOS (VideoToolbox), Linux/Windows GPUs (NVIDIA NVENC, Intel QuickSync, AMD AMF, and VA-API) for 5x–20x faster exports with low CPU usage.
|
|
22
|
+
* **Real-time Progress Reporting:** Emits live percentage updates via standard MCP progress tokens (`notifications/progress`), enabling progress bars in modern AI clients.
|
|
23
|
+
* **Instant Cancellation:** Listens to client `AbortSignal` events to immediately terminate child FFmpeg processes when a generation is stopped.
|
|
24
|
+
* **Multimodal Vision Previews:** Inlines base64 image data for thumbnails, audio waveforms, and multi-frame contact sheets so vision models (Claude 3.7, GPT-4o, Gemini) can "see" media content.
|
|
25
|
+
* **Social Formats & Automation:** Reformats landscape video to 9:16 vertical video with blurred backgrounds, burns customizable hardcoded subtitles, and stacks top/bottom split-screen reels for TikTok and Instagram Reels.
|
|
26
|
+
* **Audio Engineering:** Normalizes loudness to broadcast/streaming standards (EBU R128 / -16 LUFS), cleans vocal audio with 80Hz rumble removal, and trims dead air while preserving lip-sync.
|
|
26
27
|
|
|
27
28
|
---
|
|
28
29
|
|
|
29
|
-
## Included Tools (
|
|
30
|
+
## Included Tools (17 Total)
|
|
30
31
|
|
|
31
32
|
| Tool | Description | Key Parameters |
|
|
32
33
|
| :--- | :--- | :--- |
|
|
33
34
|
| **`media_probe`** | Inspects media files with ffprobe. Returns metadata, streams, codecs, resolution, and duration as JSON. | `inputPath` |
|
|
34
|
-
| **`media_convert`** | Converts video and audio formats. Includes presets for web MP4, WebM, and animated GIF. | `inputPath`, `outputPath`, `preset`, `crf`, `resolution`, `fps`, `hardwareAcceleration` |
|
|
35
|
+
| **`media_convert`** | Converts video and audio formats. Includes presets for web MP4, WebM, and animated GIF with GPU acceleration. | `inputPath`, `outputPath`, `preset`, `crf`, `resolution`, `fps`, `hardwareAcceleration` |
|
|
35
36
|
| **`trim_media`** | Cuts a segment from a video or audio file using stream copy or re-encoding. | `inputPath`, `outputPath`, `startTime`, `endTime`, `duration`, `accurateReencode` |
|
|
36
37
|
| **`extract_audio`** | Rips audio tracks from video. Includes a 16kHz mono WAV preset for Whisper speech recognition. | `inputPath`, `outputPath`, `format`, `bitrate` |
|
|
37
38
|
| **`extract_thumbnail`** | Captures a still image at a timestamp or midpoint. Returns base64 image data for vision models. | `inputPath`, `outputPath`, `timestamp`, `resolution`, `includeBase64` |
|
|
38
39
|
| **`compress_video`** | Compresses video to fit target sizes (such as GitHub PRs under 10MB or Discord under 25MB). | `inputPath`, `outputPath`, `targetSizeMB`, `preset`, `crf`, `maxWidth`, `hardwareAcceleration` |
|
|
39
|
-
| **`reformat_aspect_ratio`** | Changes video ratio to 9:16 vertical, 1:1 square, or 4:5 portrait with blurred borders or center crop. | `inputPath`, `outputPath`, `targetRatio`, `mode`, `blurAmount`, `padColor` |
|
|
40
|
+
| **`reformat_aspect_ratio`** | Changes video ratio to 9:16 vertical, 1:1 square, or 4:5 portrait with blurred borders or center crop. | `inputPath`, `outputPath`, `targetRatio`, `mode`, `blurAmount`, `padColor`, `hardwareAcceleration` |
|
|
40
41
|
| **`create_split_screen`** | Stacks two videos top-and-bottom (9:16 Reels/TikTok) or side-by-side with audio mixing and subtitles. | `firstVideoPath`, `secondVideoPath`, `outputPath`, `layout`, `audioSource`, `subtitlesPath` |
|
|
41
|
-
| **`trim_silence`** | Detects and removes silent pauses from recordings
|
|
42
|
+
| **`trim_silence`** | Detects and removes silent pauses from recordings while preserving video & audio lip-sync. | `inputPath`, `outputPath`, `mode`, `thresholdDb`, `minDurationSeconds` |
|
|
42
43
|
| **`concat_media`** | Joins multiple video or audio files in order using stream copy or re-encoding. | `inputPaths`, `outputPath`, `mode` |
|
|
43
44
|
| **`generate_waveform`** | Generates a PNG waveform image. Returns base64 image data for vision models. | `inputPath`, `outputPath`, `width`, `height`, `color`, `scale`, `includeBase64` |
|
|
44
|
-
| **`add_subtitles`** | Embeds SRT or VTT subtitle tracks into video files without re-encoding video. | `videoPath`, `subtitlesPath`, `outputPath`, `language`, `title` |
|
|
45
|
+
| **`add_subtitles`** | Embeds SRT or VTT subtitle tracks into MP4/MKV video files without re-encoding video. | `videoPath`, `subtitlesPath`, `outputPath`, `language`, `title` |
|
|
46
|
+
| **`burn_subtitles`** *(New)* | Hardcodes subtitles directly onto video frames with customizable font size, colors, and margins. | `videoPath`, `subtitlesPath`, `outputPath`, `fontSize`, `fontColor`, `outlineColor`, `marginV` |
|
|
47
|
+
| **`extract_keyframes`** *(New)* | Extracts multiple representative frames across the video and generates a contact sheet grid for vision AI. | `inputPath`, `outputPath`, `count`, `layout`, `includeBase64` |
|
|
48
|
+
| **`normalize_audio`** *(New)* | Normalizes audio loudness using EBU R128 (default -16 LUFS) with optional speech clarity high-pass filter. | `inputPath`, `outputPath`, `targetLufs`, `targetPeakDb`, `voiceClarity` |
|
|
49
|
+
| **`add_overlay`** *(New)* | Places a watermark image or logo PNG over video with customizable corner position, scale, and opacity. | `videoPath`, `overlayPath`, `outputPath`, `position`, `padding`, `scaleWidth`, `opacity` |
|
|
45
50
|
| **`change_speed`** | Adjusts playback speed (such as 2x fast forward or 0.5x slow motion) with pitch correction. | `inputPath`, `outputPath`, `speed`, `muteAudio` |
|
|
46
51
|
|
|
47
52
|
---
|
|
48
53
|
|
|
54
|
+
## MCP Resources & Prompts
|
|
55
|
+
|
|
56
|
+
### Resources
|
|
57
|
+
* **`media://capabilities`**: Inspects local FFmpeg installation, active version, detected hardware accelerators (VideoToolbox, NVENC, QSV, AMF, VAAPI), and supported video encoders.
|
|
58
|
+
* **`media://presets`**: Standard reference table of social aspect ratios, platform upload file size limits, and broadcast audio loudness targets.
|
|
59
|
+
|
|
60
|
+
### Prompts
|
|
61
|
+
* **`social_clip_generator`**: Interactive workflow that turns raw landscape video into vertical shorts with blurred background padding, trimmed silence, and hardcoded captions.
|
|
62
|
+
* **`whisper_audio_prep`**: Standard pipeline for extracting 16kHz mono WAV audio and normalizing loudness for speech-to-text models.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
49
66
|
## Requirements
|
|
50
67
|
|
|
51
68
|
* **Node.js** >= 18.0.0
|
|
52
69
|
* **FFmpeg & FFprobe** installed locally:
|
|
53
70
|
* **macOS:** `brew install ffmpeg`
|
|
54
|
-
* **Linux (Ubuntu/Debian):** `sudo apt update && sudo apt install ffmpeg`
|
|
71
|
+
* **Linux (Ubuntu/Debian):** `sudo apt update && sudo apt install ffmpeg libass-dev`
|
|
55
72
|
* **Windows:** `winget install Gyan.FFmpeg` or `choco install ffmpeg`
|
|
56
73
|
|
|
57
74
|
---
|
|
58
75
|
|
|
59
76
|
## Installation
|
|
60
77
|
|
|
61
|
-
### Antigravity
|
|
78
|
+
### Quick Start (Claude Desktop, Cursor, Antigravity)
|
|
62
79
|
|
|
63
|
-
|
|
80
|
+
Run directly with `npx` (no manual cloning or building required):
|
|
64
81
|
|
|
65
82
|
```json
|
|
66
83
|
{
|
|
67
84
|
"mcpServers": {
|
|
68
85
|
"ffmpeg": {
|
|
69
|
-
"command": "
|
|
70
|
-
"args": ["/
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["-y", "@ash_j1997/ffmpeg-mcp-server"]
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
91
|
```
|
|
75
92
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
* **
|
|
81
|
-
* **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"mcpServers": {
|
|
86
|
-
"ffmpeg": {
|
|
87
|
-
"command": "node",
|
|
88
|
-
"args": ["/Users/ashj/Desktop/Projects/ffmpeg-mcp-server/dist/index.js"]
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
+
#### Configuration File Locations:
|
|
94
|
+
* **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
95
|
+
* **Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
96
|
+
* **Antigravity IDE:** `~/.gemini/config/mcp_config.json`
|
|
97
|
+
* **Cursor / Windsurf:** Add as a stdio server with command `npx` and args `["-y", "@ash_j1997/ffmpeg-mcp-server"]`
|
|
93
98
|
|
|
94
99
|
---
|
|
95
100
|
|
|
96
|
-
## Local Development
|
|
101
|
+
## Local Development & Testing
|
|
97
102
|
|
|
98
103
|
1. **Install dependencies:**
|
|
99
104
|
```bash
|
|
100
105
|
npm install
|
|
101
106
|
```
|
|
102
107
|
|
|
103
|
-
2. **
|
|
104
|
-
```bash
|
|
105
|
-
npm run build
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
3. **Run tests:**
|
|
108
|
+
2. **Run build and automated test suite:**
|
|
109
109
|
```bash
|
|
110
|
-
|
|
110
|
+
npm test
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
---
|