Skip to main content
Glama

create_video_from_images

Convert a sequence of images into a video using FFmpeg. Specify input patterns, output path, framerate, codec, and pixel format for customized video creation.

Instructions

Create a video from a sequence of images

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codecNoVideo codec to use (default: libx264)
extraOptionsNoAdditional FFmpeg options
framerateNoFrames per second (default: 25)
inputPatternYesPattern for input images (e.g., 'img%03d.jpg' or 'folder/*.png')
outputPathYesPath for the output video file
pixelFormatNoPixel format (default: yuv420p)

Implementation Reference

  • Handler logic for the 'create_video_from_images' tool. Parses arguments, validates input, constructs an FFmpeg command to create a video from images using the specified pattern, framerate, codec, etc., executes it via runFFmpegCommand, and returns the result.
    case "create_video_from_images": { const inputPattern = String(args?.inputPattern); const outputPath = validatePath(String(args?.outputPath)); const framerate = Number(args?.framerate || 25); const codec = String(args?.codec || "libx264"); const pixelFormat = String(args?.pixelFormat || "yuv420p"); const extraOptions = String(args?.extraOptions || ""); if (!inputPattern) { throw new Error("Input pattern is required"); } await ensureDirectoryExists(outputPath); const command = `-framerate ${framerate} -i "${inputPattern}" -c:v ${codec} -pix_fmt ${pixelFormat} ${extraOptions} "${outputPath}" -y`; const result = await runFFmpegCommand(command); return { content: [{ type: "text", text: `Video creation completed: ${inputPattern} → ${outputPath}\n\n${result}` }] };
  • Input schema and metadata definition for the 'create_video_from_images' tool, specifying parameters like inputPattern, outputPath, framerate, codec, etc.
    { name: "create_video_from_images", description: "Create a video from a sequence of images", inputSchema: { type: "object", properties: { inputPattern: { type: "string", description: "Pattern for input images (e.g., 'img%03d.jpg' or 'folder/*.png')" }, outputPath: { type: "string", description: "Path for the output video file" }, framerate: { type: "number", description: "Frames per second (default: 25)" }, codec: { type: "string", description: "Video codec to use (default: libx264)" }, pixelFormat: { type: "string", description: "Pixel format (default: yuv420p)" }, extraOptions: { type: "string", description: "Additional FFmpeg options" } }, required: ["inputPattern", "outputPath"] }
  • src/index.ts:46-50 (registration)
    Registers the list of available tools, including 'create_video_from_images', by returning toolDefinitions in response to ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions }; });
  • src/index.ts:56-68 (registration)
    Registers the tool execution handler for MCP CallToolRequest, which delegates to handleToolCall dispatching to the specific tool handler like create_video_from_images.
    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}` }] }; } });

Other Tools

Related Tools

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