@pickstar-2002/video-info-mcp
Version:
🎬 基于 MCP 协议的专业视频信息分析工具,支持多格式视频文件的详细信息提取和技术参数分析
109 lines • 5.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenerateReportArgsSchema = exports.CalculateBitrateArgsSchema = exports.AnalyzeStreamsArgsSchema = exports.GetVideoInfoArgsSchema = exports.VideoInfoSchema = exports.FormatSchema = exports.AudioStreamSchema = exports.VideoStreamSchema = void 0;
const zod_1 = require("zod");
// 视频流信息
exports.VideoStreamSchema = zod_1.z.object({
index: zod_1.z.number(),
codec_name: zod_1.z.string(),
codec_long_name: zod_1.z.string(),
profile: zod_1.z.string().optional(),
codec_type: zod_1.z.literal('video'),
width: zod_1.z.number(),
height: zod_1.z.number(),
coded_width: zod_1.z.number().optional(),
coded_height: zod_1.z.number().optional(),
closed_captions: zod_1.z.number().optional(),
film_grain: zod_1.z.number().optional(),
has_b_frames: zod_1.z.number().optional(),
sample_aspect_ratio: zod_1.z.string().optional(),
display_aspect_ratio: zod_1.z.string().optional(),
pix_fmt: zod_1.z.string(),
level: zod_1.z.number().optional(),
color_range: zod_1.z.string().optional(),
color_space: zod_1.z.string().optional(),
color_transfer: zod_1.z.string().optional(),
color_primaries: zod_1.z.string().optional(),
chroma_location: zod_1.z.string().optional(),
field_order: zod_1.z.string().optional(),
refs: zod_1.z.number().optional(),
is_avc: zod_1.z.string().optional(),
nal_length_size: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
r_frame_rate: zod_1.z.string(),
avg_frame_rate: zod_1.z.string(),
time_base: zod_1.z.string(),
start_pts: zod_1.z.number().optional(),
start_time: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
duration_ts: zod_1.z.number().optional(),
duration: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
bit_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
max_bit_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
bits_per_raw_sample: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
nb_frames: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
extradata_size: zod_1.z.number().optional(),
disposition: zod_1.z.record(zod_1.z.number()).optional(),
tags: zod_1.z.record(zod_1.z.string()).optional()
});
// 音频流信息
exports.AudioStreamSchema = zod_1.z.object({
index: zod_1.z.number(),
codec_name: zod_1.z.string(),
codec_long_name: zod_1.z.string(),
profile: zod_1.z.string().optional(),
codec_type: zod_1.z.literal('audio'),
sample_fmt: zod_1.z.string(),
sample_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
channels: zod_1.z.number(),
channel_layout: zod_1.z.string().optional(),
bits_per_sample: zod_1.z.number().optional(),
initial_padding: zod_1.z.number().optional(),
r_frame_rate: zod_1.z.string(),
avg_frame_rate: zod_1.z.string(),
time_base: zod_1.z.string(),
start_pts: zod_1.z.number().optional(),
start_time: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
duration_ts: zod_1.z.number().optional(),
duration: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
bit_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
max_bit_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
nb_frames: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
extradata_size: zod_1.z.number().optional(),
disposition: zod_1.z.record(zod_1.z.number()).optional(),
tags: zod_1.z.record(zod_1.z.string()).optional()
});
// 格式信息
exports.FormatSchema = zod_1.z.object({
filename: zod_1.z.string(),
nb_streams: zod_1.z.number(),
nb_programs: zod_1.z.number(),
format_name: zod_1.z.string(),
format_long_name: zod_1.z.string(),
start_time: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
duration: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
size: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
bit_rate: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
probe_score: zod_1.z.number().optional(),
tags: zod_1.z.record(zod_1.z.string()).optional()
});
// 完整的视频信息
exports.VideoInfoSchema = zod_1.z.object({
streams: zod_1.z.array(zod_1.z.union([exports.VideoStreamSchema, exports.AudioStreamSchema])),
format: exports.FormatSchema
});
// 工具参数
exports.GetVideoInfoArgsSchema = zod_1.z.object({
filePath: zod_1.z.string().describe('视频文件路径')
});
exports.AnalyzeStreamsArgsSchema = zod_1.z.object({
filePath: zod_1.z.string().describe('视频文件路径'),
includeMetadata: zod_1.z.boolean().optional().describe('是否包含元数据信息')
});
exports.CalculateBitrateArgsSchema = zod_1.z.object({
filePath: zod_1.z.string().describe('视频文件路径'),
sampleDuration: zod_1.z.number().optional().describe('采样时长(秒),用于计算峰值码率')
});
exports.GenerateReportArgsSchema = zod_1.z.object({
filePath: zod_1.z.string().describe('视频文件路径'),
format: zod_1.z.enum(['json', 'text', 'markdown']).optional().describe('报告格式')
});
//# sourceMappingURL=types.js.map