Skip to main content
Glama
misbahsy

Video & Audio Editing MCP Server

by misbahsy

extract_audio_from_video

Extract and save audio from video files using customizable codecs like MP3, AAC, or WAV for standalone audio output.

Instructions

Extracts audio from a video file and saves it.

Args: video_path: The path to the input video file. output_audio_path: The path to save the extracted audio file. audio_codec: The audio codec to use for the output (e.g., 'mp3', 'aac', 'wav'). Defaults to 'mp3'. Returns: A status message indicating success or failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
audio_codecNomp3
output_audio_pathYes
video_pathYes

Implementation Reference

  • server.py:18-40 (handler)
    The handler function for the 'extract_audio_from_video' MCP tool. It extracts audio from the input video using FFmpeg-python, with optional audio codec specification, and returns a success or error message.
    @mcp.tool()
    def extract_audio_from_video(video_path: str, output_audio_path: str, audio_codec: str = 'mp3') -> str:
        """Extracts audio from a video file and saves it.
        
        Args:
            video_path: The path to the input video file.
            output_audio_path: The path to save the extracted audio file.
            audio_codec: The audio codec to use for the output (e.g., 'mp3', 'aac', 'wav'). Defaults to 'mp3'.
        Returns:
            A status message indicating success or failure.
        """
        try:
            input_stream = ffmpeg.input(video_path)
            output_stream = input_stream.output(output_audio_path, acodec=audio_codec)
            output_stream.run(capture_stdout=True, capture_stderr=True)
            return f"Audio extracted successfully to {output_audio_path}"
        except ffmpeg.Error as e:
            error_message = e.stderr.decode('utf8') if e.stderr else str(e)
            return f"Error extracting audio: {error_message}"
        except FileNotFoundError:
            return f"Error: Input video file not found at {video_path}"
        except Exception as e:
            return f"An unexpected error occurred: {str(e)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool extracts and saves audio, implying a mutation (creates a new file), but lacks details on permissions, file overwriting behavior, error handling, or performance aspects like processing time. The mention of a status message in returns hints at outcome reporting, but it's vague.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by Args and Returns sections. It's front-loaded and efficient, with no redundant sentences. However, the Args/Returns formatting might be slightly verbose for a simple tool, but it adds clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters with 0% schema coverage and no annotations or output schema, the description does a decent job explaining inputs and the return as a status message. However, as a mutation tool, it lacks details on side effects (e.g., file creation/overwrite), error cases, or integration with sibling tools, leaving gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful context for all 3 parameters: 'video_path' as input file, 'output_audio_path' as save location, and 'audio_codec' with examples and default. This clarifies usage beyond the schema's basic titles, though it could specify path formats or codec constraints more.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Extracts audio from a video file and saves it.' This specifies the action (extracts), resource (audio from video), and outcome (saves). However, it doesn't explicitly differentiate from sibling tools like 'convert_audio_format' or 'remove_silence', which also process audio, though the extraction focus is distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't mention when to choose this over 'convert_audio_format' (which might handle existing audio files) or other audio-related siblings. There's no context on prerequisites, such as needing a valid video file, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/misbahsy/video-audio-mcp'

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