Skip to main content
Glama

getVideoInfo

Extract video metadata like duration, resolution, and format details from files to analyze content properties and verify specifications.

Instructions

获取视频文件的详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes视频文件路径

Implementation Reference

  • MCP tool handler that receives arguments, calls VideoEngine.getVideoInfo, and returns the result as a formatted text response.
    private async handleGetVideoInfo(args: MCPToolParams['getVideoInfo']) { const result = await this.videoEngine.getVideoInfo(args.filePath); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Core implementation using FFprobe to extract comprehensive video metadata including duration, dimensions, FPS, bitrate, container format, video codec, and file size.
    public async getVideoInfo(filePath: string): Promise<VideoInfo> { return new Promise((resolve, reject) => { ffmpeg.ffprobe(filePath, (err: any, metadata: any) => { if (err) { reject(new Error(`获取视频信息失败: ${err.message}`)); return; } const videoStream = metadata.streams.find((s: any) => s.codec_type === 'video'); if (!videoStream) { reject(new Error('未找到视频流')); return; } const audioStream = metadata.streams.find((s: any) => s.codec_type === 'audio'); resolve({ duration: metadata.format.duration || 0, width: videoStream.width || 0, height: videoStream.height || 0, fps: this.parseFps(videoStream.r_frame_rate || '0/1'), bitrate: parseInt(metadata.format.bit_rate || '0'), format: metadata.format.format_name || '', codec: videoStream.codec_name || '', size: parseInt(metadata.format.size || '0') }); }); }); }
  • Tool registration definition including name, description, and JSON input schema requiring 'filePath'.
    { name: 'getVideoInfo', description: '获取视频文件的详细信息', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: '视频文件路径' } }, required: ['filePath'] } },
  • TypeScript type definition for getVideoInfo input parameters.
    getVideoInfo: { filePath: string; };
  • TypeScript type definition for getVideoInfo output returning VideoInfo.
    getVideoInfo: VideoInfo;

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/pickstar-2002/video-clip-mcp'

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