Skip to main content
Glama

getVideoInfo

Extract detailed metadata from video files, including resolution, duration, and format, to streamline video analysis and processing workflows.

Instructions

获取视频文件的详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes视频文件路径

Implementation Reference

  • MCP tool handler for 'getVideoInfo' that delegates to VideoEngine.getVideoInfo and returns the result formatted as MCP response content.
    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 of getVideoInfo in VideoEngine using ffmpeg.ffprobe to extract comprehensive video metadata including duration, dimensions, FPS, bitrate, format, 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') }); }); }); }
  • Registration of the 'getVideoInfo' tool in the MCP server's list of tools, defining its name, description, and input schema.
    { name: 'getVideoInfo', description: '获取视频文件的详细信息', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: '视频文件路径' } }, required: ['filePath'] } },
  • TypeScript type definitions for getVideoInfo input parameters (MCPToolParams) and output (MCPToolResults).
    getVideoInfo: { filePath: string; }; // 批量处理工具参数 batchProcess: { tasks: Omit<BatchTask, 'id' | 'status' | 'createdAt'>[]; }; // 获取支持格式工具参数 getSupportedFormats: Record<string, never>; // 取消任务工具参数 cancelTask: { taskId: string; }; // 获取任务状态工具参数 getTaskStatus: { taskId: string; }; } // MCP工具返回值类型 export interface MCPToolResults { clipVideo: ProcessResult; mergeVideos: ProcessResult; splitVideo: ProcessResult; getVideoInfo: VideoInfo; batchProcess: {

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

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