matthensleyio/FFMpeg.MCP
If you are the rightful owner of FFMpeg.MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that exposes FFMpeg audio processing functionality to AI clients.
FFMpeg MCP Server
A Model Context Protocol (MCP) server that exposes FFMpeg audio processing functionality to AI clients.
Features
This MCP server provides 6 audio processing tools:
- convert_audio - Convert audio files between formats (mp3, wav, aac, flac, ogg, m4a)
- get_audio_info - Get detailed information about audio files
- trim_audio - Trim/cut audio to specific time ranges
- adjust_audio_quality - Adjust bitrate and sample rate
- extract_audio_channel - Extract specific channels from multi-channel audio
- merge_audio_files - Merge multiple audio files into one
Requirements
- FFMpeg installed and available in system PATH
Installation
Install FFMpeg
Windows
winget install FFmpeg
macOS
brew install ffmpeg
Linux
sudo apt-get install ffmpeg
Download FFMpeg MCP Server
Download the latest release for your platform from the releases page:
- Windows:
ffmpeg-mcp-win-x64.zip
- macOS:
ffmpeg-mcp-osx-x64.zip
orffmpeg-mcp-osx-arm64.zip
- Linux:
ffmpeg-mcp-linux-x64.zip
Extract the downloaded archive to a location of your choice.
Usage
Configuring with Claude Desktop
Add this configuration to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Windows Configuration
{
"mcpServers": {
"ffmpeg": {
"command": "C:\\path\\to\\ffmpeg-mcp\\FFMpeg.Mcp.Host.exe"
}
}
}
macOS/Linux Configuration
{
"mcpServers": {
"ffmpeg": {
"command": "/path/to/ffmpeg-mcp/FFMpeg.Mcp.Host"
}
}
}
Note: Replace /path/to/ffmpeg-mcp/
with the actual path where you extracted the release files.
Running Standalone
You can also run the server directly from the command line:
Windows
FFMpeg.Mcp.Host.exe
macOS/Linux
./FFMpeg.Mcp.Host
Available Tools
convert_audio
Convert audio from one format to another.
Parameters:
inputPath
(string, required) - Path to input audio fileoutputPath
(string, required) - Path for output audio filetargetFormat
(string, required) - Target format: mp3, wav, aac, flac, ogg, m4abitrate
(int, optional) - Target bitrate in kbps (64-320)sampleRate
(int, optional) - Sample rate in Hz (22050, 44100, 48000, 96000)
Example:
Convert my-audio.wav to MP3 at 192 kbps
get_audio_info
Get detailed metadata about an audio file.
Parameters:
filePath
(string, required) - Path to audio file
Example:
Get info about my-audio.mp3
trim_audio
Trim audio to a specific time range.
Parameters:
inputPath
(string, required) - Path to input audio fileoutputPath
(string, required) - Path for output audio filestartSeconds
(double, required) - Start time in secondsendSeconds
(double, required) - End time in seconds
Example:
Trim my-audio.wav from 10 seconds to 30 seconds
adjust_audio_quality
Adjust audio quality by changing bitrate and/or sample rate.
Parameters:
inputPath
(string, required) - Path to input audio fileoutputPath
(string, required) - Path for output audio filebitrate
(int, optional) - Target bitrate in kbps (64-320)sampleRate
(int, optional) - Sample rate in Hz (22050, 44100, 48000, 96000)
Example:
Reduce quality of my-audio.mp3 to 128 kbps
extract_audio_channel
Extract a specific channel from multi-channel audio.
Parameters:
inputPath
(string, required) - Path to input audio fileoutputPath
(string, required) - Path for output audio filechannel
(string, required) - Channel index (0 for left, 1 for right in stereo)
Example:
Extract left channel from stereo-audio.wav
merge_audio_files
Merge multiple audio files into one.
Parameters:
inputPathsCsv
(string, required) - Comma-separated paths to input filesoutputPath
(string, required) - Path for output audio fileoutputFormat
(string, required) - Output format: mp3, wav, aac, flac, ogg, m4a
Example:
Merge file1.mp3, file2.mp3, and file3.mp3 into combined.mp3
Building from Source
If you prefer to build from source instead of using pre-built releases:
Requirements
- .NET 9.0 SDK
Build Steps
# Clone the repository
git clone https://github.com/matthensleyio/FFMpeg.MCP.git
cd FFMpeg.MCP
# Build the project
dotnet build src/FFMpeg.Mcp.Host/FFMpeg.Mcp.Host.csproj
# Run the server
dotnet run --project src/FFMpeg.Mcp.Host/FFMpeg.Mcp.Host.csproj
Configuring Claude Desktop with Source Build
{
"mcpServers": {
"ffmpeg": {
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\path\\to\\FFMpeg.MCP\\src\\FFMpeg.Mcp.Host\\FFMpeg.Mcp.Host.csproj"
]
}
}
}
Development
Running Tests
# Run all tests
dotnet test
# Run only unit tests
dotnet test tests/FFMpeg.Mcp.Host.UnitTests/FFMpeg.Mcp.Host.UnitTests.csproj
# Run only integration tests
dotnet test tests/FFMpeg.Mcp.Host.IntegrationTests/FFMpeg.Mcp.Host.IntegrationTests.csproj
Project Structure
FFMpeg.MCP/
āāā src/
ā āāā FFMpeg.Mcp.Host/
ā āāā Models/ # Data models
ā āāā Services/ # Core audio processing services
ā āāā Tools/ # MCP tool definitions
ā āāā Validators/ # Input validation
ā āāā Program.cs # Entry point
āāā tests/
ā āāā FFMpeg.Mcp.Host.UnitTests/
ā āāā FFMpeg.Mcp.Host.IntegrationTests/
āāā README.md
Architecture
- MCP Server: Uses ModelContextProtocol library for stdio transport
- Audio Processing: FFMpegCore library wraps FFMpeg functionality
- Background Processing: Channel-based task queue for async operations
- Progress Notifications: Real-time progress updates for long-running operations
- Dependency Injection: Microsoft.Extensions.Hosting for service management
Supported Audio Formats
- MP3 (.mp3)
- WAV (.wav)
- AAC (.aac, .m4a)
- FLAC (.flac)
- OGG (.ogg)
Error Handling
All operations return detailed error messages when failures occur. Common error scenarios:
- Invalid file paths
- Unsupported audio formats
- Invalid parameter values (bitrate, sample rate, etc.)
- FFMpeg processing errors
License
This project uses the following open-source libraries:
- FFMpegCore (MIT License)
- ModelContextProtocol (MIT License)
- Microsoft.Extensions.Hosting (MIT License)
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests to ensure everything passes
- Submit a pull request
Support
For issues and questions:
- Check FFMpeg installation:
ffmpeg -version
- Verify .NET version:
dotnet --version
- Review server logs for error messages