Skip to main content
Glama

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
NameRequiredDescriptionDefault
inputPathYesPath to the input video file
outputPathYesPath for the output video file
optionsNoAdditional FFmpeg options (optional)

Implementation Reference

  • 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}`
        }]
      };
    }
  • 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}`
          }]
        };
      }
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sworddut/mcp-ffmpeg-helper'

If you have feedback or need assistance with the MCP directory API, please join our Discord server