Skip to main content
Glama

extract_audio

Extract audio from video files into specified formats like mp3 or aac. Input the video path and desired output path to convert videos into standalone audio files.

Instructions

Extract audio from a video file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYesAudio format (mp3, aac, etc.)
inputPathYesPath to the input video file
outputPathYesPath for the output audio file

Implementation Reference

  • Core handler function for 'extract_audio' tool: validates inputs, ensures output directory, runs FFmpeg command to extract audio from video (-vn -acodec), and returns completion message with result.
    case "extract_audio": { const inputPath = validatePath(String(args?.inputPath), true); const outputPath = validatePath(String(args?.outputPath)); const format = String(args?.format || "mp3"); await ensureDirectoryExists(outputPath); const command = `-i "${inputPath}" -vn -acodec ${format} "${outputPath}" -y`; const result = await runFFmpegCommand(command); return { content: [{ type: "text", text: `Audio extraction completed: ${inputPath} → ${outputPath}\n\n${result}` }] }; }
  • Tool schema definition for 'extract_audio' including name, description, and input validation schema.
    name: "extract_audio", description: "Extract audio from a video file", inputSchema: { type: "object", properties: { inputPath: { type: "string", description: "Path to the input video file" }, outputPath: { type: "string", description: "Path for the output audio file" }, format: { type: "string", description: "Audio format (mp3, aac, etc.)" } }, required: ["inputPath", "outputPath", "format"] }
  • src/index.ts:46-50 (registration)
    Registers all tools (including 'extract_audio') for listing via MCP ListToolsRequest by providing the toolDefinitions array.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions }; });
  • src/index.ts:56-68 (registration)
    Registers the generic tool call handler in MCP server that dispatches to handleToolCall switch based on tool name, thus executing 'extract_audio'.
    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