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)}"

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