convert_video
Convert video files between different formats using FFmpeg processing capabilities. Specify input and output paths to transform video files for compatibility or optimization.
Instructions
Convert a video file to a different format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputPath | Yes | Path to the input video file | |
| outputPath | Yes | Path for the output video file | |
| options | No | Additional FFmpeg options (optional) |
Implementation Reference
- src/tools/handlers.ts:22-37 (handler)Handler function for the 'convert_video' tool that performs video format conversion using FFmpeg.case "convert_video": { const inputPath = validatePath(String(args?.inputPath), true); const outputPath = validatePath(String(args?.outputPath)); const options = String(args?.options || ""); await ensureDirectoryExists(outputPath); const command = `-i "${inputPath}" ${options} "${outputPath}" -y`; const result = await runFFmpegCommand(command); return { content: [{ type: "text", text: `Video conversion completed: ${inputPath} → ${outputPath}\n\n${result}` }] }; }
- src/tools/definitions.ts:20-41 (schema)Input schema definition for the 'convert_video' tool.{ name: "convert_video", description: "Convert a video file to a different format", inputSchema: { type: "object", properties: { inputPath: { type: "string", description: "Path to the input video file" }, outputPath: { type: "string", description: "Path for the output video file" }, options: { type: "string", description: "Additional FFmpeg options (optional)" } }, required: ["inputPath", "outputPath"] } },
- src/index.ts:46-50 (registration)Registers the list tools handler which provides the tool definitions including 'convert_video' schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions }; });
- src/index.ts:56-68 (registration)Registers the tool call handler that dispatches to specific tool implementations including 'convert_video'.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await handleToolCall(request.params.name, request.params.arguments); } catch (error: any) { console.error("Tool execution error:", error.message); return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } });