基于 AI MCP 协议的专业视频剪辑工具,提供高效的视频处理能力和智能化操作体验。无需手动安装 FFmpeg,开箱即用!
本工具是基于 AI MCP 协议的专业视频剪辑工具,具备高效的视频处理能力和智能化操作体验,且无需手动安装 FFmpeg。
npm install -g @pickstar-2002/video-clip-mcp@latest
npx @pickstar-2002/video-clip-mcp@latest
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"video-clip": {
"command": "npx",
"args": ["@pickstar-2002/video-clip-mcp@latest"]
}
}
}
在 .cursorrules 或项目配置中添加:
{
"mcp": {
"servers": {
"video-clip": {
"command": "npx @pickstar-2002/video-clip-mcp@latest"
}
}
}
}
在 windsurfconfig.json 中配置:
{
"mcpServers": {
"video-clip": {
"command": "npx",
"args": ["@pickstar-2002/video-clip-mcp@latest"],
"env": {}
}
}
}
在项目根目录创建 .codebuddy/mcp.json:
{
"servers": {
"video-clip": {
"command": "npx @pickstar-2002/video-clip-mcp@latest",
"description": "🎬 视频剪辑处理工具"
}
}
}
通用配置格式:
{
"mcpServers": {
"video-clip": {
"command": "npx",
"args": ["@pickstar-2002/video-clip-mcp@latest"]
}
}
}
npm install -g @pickstar-2002/video-clip-mcp@latest
npx @pickstar-2002/video-clip-mcp@latest
// 剪辑视频片段(10秒到30秒)
await clipVideo({
inputPath: "input.mp4",
outputPath: "output.mp4",
timeSegment: {
start: 10000, // 10秒(毫秒)
end: 30000 // 30秒(毫秒)
},
quality: "fast",
videoCodec: "libx264"
});
// 合并多个视频文件
await mergeVideos({
inputPaths: ["video1.mp4", "video2.mp4", "video3.mp4"],
outputPath: "merged.mp4",
quality: "medium",
resolution: { width: 1920, height: 1080 }
});
// 按时长分割视频
await splitVideo({
inputPath: "long_video.mp4",
outputDir: "./segments",
splitBy: "duration",
duration: 60, // 每60秒一段
namePattern: "segment_{index}.{ext}"
});
// 批量处理任务
const tasks = [
{
type: "clip",
options: {
inputPath: "video1.mp4",
outputPath: "clip1.mp4",
timeSegment: { start: 0, end: 30000 }
}
},
{
type: "clip",
options: {
inputPath: "video2.mp4",
outputPath: "clip2.mp4",
timeSegment: { start: 10000, end: 40000 }
}
}
];
await batchProcess({ tasks });
interface VideoClipOptions {
inputPath: string;
outputPath: string;
timeSegment: {
start: number; // 开始时间(毫秒)
end: number; // 结束时间(毫秒)
};
quality?: 'ultrafast' | 'fast' | 'medium' | 'slow' | 'veryslow';
videoCodec?: 'libx264' | 'libx265' | 'libvpx-vp9' | 'libaom-av1';
audioCodec?: 'aac' | 'libmp3lame' | 'libopus' | 'libvorbis';
preserveMetadata?: boolean;
}
interface MergeVideosOptions {
inputPaths: string[];
outputPath: string;
quality?: string;
videoCodec?: string;
audioCodec?: string;
resolution?: { width: number; height: number };
fps?: number;
}
interface SplitVideoOptions {
inputPath: string;
outputDir: string;
splitBy: 'duration' | 'size' | 'segments';
duration?: number; // 按时长分割(秒)
maxSize?: number; // 按大小分割(MB)
segmentCount?: number; // 分割段数
namePattern?: string; // 文件命名模式
}
interface VideoInfo {
duration: number; // 时长(秒)
width: number; // 宽度
height: number; // 高度
fps: number; // 帧率
bitrate: number; // 比特率
format: string; // 格式
codec: string; // 编码
size: number; // 文件大小(字节)
}
interface TaskStatus {
id: string;
type: 'clip' | 'merge' | 'split';
status: 'pending' | 'processing' | 'completed' | 'failed';
progress?: number;
createdAt: string;
completedAt?: string;
error?: string;
result?: any;
}
// 获取视频信息
getVideoInfo(filePath: string): Promise<VideoInfo>
// 剪辑视频
clipVideo(options: VideoClipOptions): Promise<string>
// 合并视频
mergeVideos(options: MergeVideosOptions): Promise<string>
// 分割视频
splitVideo(options: SplitVideoOptions): Promise<string[]>
// 批量处理
batchProcess(tasks: BatchTask[]): Promise<string[]>
// 获取任务状态
getTaskStatus(taskId: string): Promise<TaskStatus>
// 取消任务
cancelTask(taskId: string): Promise<boolean>
// 获取支持的格式
getSupportedFormats(): Promise<SupportedFormats>
问题描述: 使用 npx 时出现连接关闭错误
解决方案(按推荐顺序):
npx @pickstar-2002/video-clip-mcp@latest
npx @pickstar-2002/video-clip-mcp@1.2.0
# Windows
npx clear-npx-cache
# 或者手动删除缓存目录
rmdir /s "%APPDATA%\npm-cache\_npx"
# macOS/Linux
npx clear-npx-cache
# 或者手动删除缓存目录
rm -rf ~/.npm/_npx
问题描述: FFmpeg 执行失败或找不到
解决方案:
问题描述: 输入或输出文件路径错误
解决方案:
/ 或双反斜杠 \\问题描述: 没有文件读写权限
解决方案:
问题描述: 处理大文件时内存溢出
解决方案:
如果以上解决方案无法解决您的问题,请:
本项目使用了多种开源技术和框架,基于 AI MCP 协议开发。其中,借助 FFmpeg 进行强大的多媒体处理,通过 fluent-ffmpeg 这个 Node.js FFmpeg 封装库简化操作。使用 TypeScript 保证代码的类型安全,同时遵循 Model Context Protocol 实现 AI 工具的集成。
本项目采用 MIT License 开源协议。您可以自由使用、修改和分发本软件。
我们欢迎所有形式的贡献!请遵循以下步骤:
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-feature# 克隆仓库
git clone https://github.com/pickstar-2002/video-clip-mcp.git
cd video-clip-mcp
# 安装依赖
npm install
# 构建项目
npm run build
# 启动开发模式
npm run dev
感谢以下开源项目和社区的支持:
如果这个项目对您有帮助,请:
让我们一起打造更好的视频处理工具!🚀
微信: pickstar_loveXX