get-ffmpeg-version
Check the installed FFmpeg version to verify compatibility for video processing tasks like resizing and audio extraction.
Instructions
Get the version of FFmpeg installed on the system
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp-ffmpeg.ts:73-102 (handler)Inline handler function for the get-ffmpeg-version tool. Executes 'ffmpeg -version', parses the version with regex, returns formatted text response with version or error if FFmpeg not found.
server.tool( "get-ffmpeg-version", "Get the version of FFmpeg installed on the system", {}, async () => { try { const { stdout, stderr } = await execAsync('ffmpeg -version'); // Extract the version from the output const versionMatch = stdout.match(/ffmpeg version (\S+)/); const version = versionMatch ? versionMatch[1] : 'Unknown'; return { content: [{ type: "text" as const, text: `FFmpeg Version: ${version}\n\nFull version info:\n${stdout}` }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { isError: true, content: [{ type: "text" as const, text: `Error getting FFmpeg version: ${errorMessage}\n\nMake sure FFmpeg is installed and in your PATH.` }] }; } } ); - src/mcp-ffmpeg.ts:73-102 (registration)Registers the get-ffmpeg-version tool on the MCP server with empty input schema and the inline handler function.
server.tool( "get-ffmpeg-version", "Get the version of FFmpeg installed on the system", {}, async () => { try { const { stdout, stderr } = await execAsync('ffmpeg -version'); // Extract the version from the output const versionMatch = stdout.match(/ffmpeg version (\S+)/); const version = versionMatch ? versionMatch[1] : 'Unknown'; return { content: [{ type: "text" as const, text: `FFmpeg Version: ${version}\n\nFull version info:\n${stdout}` }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { isError: true, content: [{ type: "text" as const, text: `Error getting FFmpeg version: ${errorMessage}\n\nMake sure FFmpeg is installed and in your PATH.` }] }; } } ); - src/mcp-ffmpeg.ts:11-11 (helper)Promisified exec function used by the get-ffmpeg-version handler to run the ffmpeg command asynchronously.
const execAsync = promisify(exec);