Skip to main content
Glama

extract_audio

Extract audio from video files to create standalone audio files in formats like MP3 or AAC using FFmpeg processing.

Instructions

Extract audio from a video file

Input Schema

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

Implementation Reference

  • Handler function for the 'extract_audio' tool. Validates inputs, constructs FFmpeg command to extract audio without video (-vn -acodec), runs it, and returns completion message.
    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}`
        }]
      };
    }
  • Input schema definition for the 'extract_audio' tool, specifying required parameters: inputPath, outputPath, and format.
    {
      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)
    Registration of all tools, including 'extract_audio', by returning the toolDefinitions array in response to ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: toolDefinitions
      };
    });

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