video-metadata-inspector
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVideo Metadata Inspector
视频元数据检查工具
Extract and analyze comprehensive metadata from video files including duration, resolution, codec, frame rate, and technical specifications.
从视频文件中提取并分析全面的元数据,包括时长、分辨率、编解码器、帧率以及技术规格。
Purpose
用途
Video metadata inspection for:
- Format verification and compatibility checking
- Quality assessment and validation
- Transcoding planning and optimization
- Video library cataloging
- Technical specification reports
视频元数据检查可用于:
- 格式验证与兼容性检查
- 质量评估与验证
- 转码规划与优化
- 视频库编目
- 技术规格报告
Features
功能特性
- Basic Info: Duration, resolution, frame rate, file size
- Codec Details: Video/audio codec, profile, bitrate
- Technical Specs: Aspect ratio, pixel format, sample rate
- Metadata: Title, artist, creation date, tags
- Batch Analysis: Process multiple files in one operation
- Export Formats: JSON, CSV, human-readable text
- 基础信息:时长、分辨率、帧率、文件大小
- 编解码器详情:视频/音频编解码器、配置文件、比特率
- 技术规格:宽高比、像素格式、采样率
- 元数据:标题、创作者、创建日期、标签
- 批量分析:一次操作处理多个文件
- 导出格式:JSON、CSV、易读文本格式
Quick Start
快速开始
python
from video_metadata_inspector import VideoMetadataInspectorpython
from video_metadata_inspector import VideoMetadataInspectorInspect single video
Inspect single video
inspector = VideoMetadataInspector()
inspector.load('video.mp4')
metadata = inspector.get_metadata()
print(f"Duration: {metadata['duration_seconds']:.2f}s")
print(f"Resolution: {metadata['width']}x{metadata['height']}")
print(f"FPS: {metadata['fps']}")
inspector = VideoMetadataInspector()
inspector.load('video.mp4')
metadata = inspector.get_metadata()
print(f"Duration: {metadata['duration_seconds']:.2f}s")
print(f"Resolution: {metadata['width']}x{metadata['height']}")
print(f"FPS: {metadata['fps']}")
Export full report
Export full report
inspector.export_report('report.json', format='json')
inspector.export_report('report.json', format='json')
Batch inspect directory
Batch inspect directory
inspector.batch_inspect(
input_files=['video1.mp4', 'video2.mkv'],
output='metadata.csv',
format='csv'
)
undefinedinspector.batch_inspect(
input_files=['video1.mp4', 'video2.mkv'],
output='metadata.csv',
format='csv'
)
undefinedCLI Usage
CLI 使用方法
bash
undefinedbash
undefinedBasic metadata
Basic metadata
python video_metadata_inspector.py input.mp4
python video_metadata_inspector.py input.mp4
Full technical details
Full technical details
python video_metadata_inspector.py input.mp4 --verbose
python video_metadata_inspector.py input.mp4 --verbose
Export to JSON
Export to JSON
python video_metadata_inspector.py input.mp4 --output metadata.json --format json
python video_metadata_inspector.py input.mp4 --output metadata.json --format json
Batch inspect directory
Batch inspect directory
python video_metadata_inspector.py *.mp4 --output metadata.csv --format csv
python video_metadata_inspector.py *.mp4 --output metadata.csv --format csv
Compare multiple videos
Compare multiple videos
python video_metadata_inspector.py video1.mp4 video2.mp4 --compare
undefinedpython video_metadata_inspector.py video1.mp4 video2.mp4 --compare
undefinedAPI Reference
API 参考
VideoMetadataInspector
VideoMetadataInspector
python
class VideoMetadataInspector:
def load(self, filepath: str) -> 'VideoMetadataInspector'
def get_metadata(self) -> Dict[str, Any]
def get_basic_info(self) -> Dict[str, Any]
def get_video_info(self) -> Dict[str, Any]
def get_audio_info(self) -> Dict[str, Any]
def get_format_info(self) -> Dict[str, Any]
def export_report(self, output: str, format: str = 'json') -> str
def batch_inspect(self, input_files: List[str], output: str = None,
format: str = 'csv') -> pd.DataFrame
def compare_videos(self, video_files: List[str]) -> pd.DataFramepython
class VideoMetadataInspector:
def load(self, filepath: str) -> 'VideoMetadataInspector'
def get_metadata(self) -> Dict[str, Any]
def get_basic_info(self) -> Dict[str, Any]
def get_video_info(self) -> Dict[str, Any]
def get_audio_info(self) -> Dict[str, Any]
def get_format_info(self) -> Dict[str, Any]
def export_report(self, output: str, format: str = 'json') -> str
def batch_inspect(self, input_files: List[str], output: str = None,
format: str = 'csv') -> pd.DataFrame
def compare_videos(self, video_files: List[str]) -> pd.DataFrameMetadata Categories
元数据分类
Basic Information
基础信息
- Duration (seconds, formatted)
- Resolution (width × height)
- Frame rate (FPS)
- File size
- Aspect ratio
- 时长(秒,格式化显示)
- 分辨率(宽 × 高)
- 帧率(FPS)
- 文件大小
- 宽高比
Video Stream
视频流
- Video codec (H.264, H.265, VP9, etc.)
- Codec profile and level
- Bitrate (kbps)
- Pixel format (yuv420p, etc.)
- Color space and range
- 视频编解码器(H.264、H.265、VP9等)
- 编解码器配置文件与级别
- 比特率(kbps)
- 像素格式(yuv420p等)
- 色彩空间与范围
Audio Stream
音频流
- Audio codec (AAC, MP3, Opus, etc.)
- Sample rate (Hz)
- Channels (mono, stereo, 5.1, etc.)
- Audio bitrate (kbps)
- 音频编解码器(AAC、MP3、Opus等)
- 采样率(Hz)
- 声道数(单声道、立体声、5.1声道等)
- 音频比特率(kbps)
Container Format
容器格式
- Container type (MP4, MKV, AVI, etc.)
- Creation date
- Metadata tags (title, artist, description)
- Number of streams
- 容器类型(MP4、MKV、AVI等)
- 创建日期
- 元数据标签(标题、创作者、描述)
- 流的数量
Use Cases
使用场景
Format Verification:
python
inspector.load('video.mp4')
info = inspector.get_video_info()
if info['codec'] == 'h264' and info['width'] >= 1920:
print("✓ Meets requirements: 1080p H.264")Transcoding Planning:
python
undefined格式验证:
python
inspector.load('video.mp4')
info = inspector.get_video_info()
if info['codec'] == 'h264' and info['width'] >= 1920:
print("✓ Meets requirements: 1080p H.264")转码规划:
python
undefinedCheck if transcoding needed
Check if transcoding needed
metadata = inspector.get_metadata()
if metadata['video_codec'] != 'h265' or metadata['bitrate_kbps'] > 5000:
print("Transcode recommended")
**Quality Assessment:**
```pythonmetadata = inspector.get_metadata()
if metadata['video_codec'] != 'h265' or metadata['bitrate_kbps'] > 5000:
print("Transcode recommended")
**质量评估:**
```pythonAnalyze video quality metrics
Analyze video quality metrics
info = inspector.get_metadata()
quality_score = (
(info['width'] * info['height']) / 2073600 * 50 + # Resolution score
min(info['fps'] / 60, 1) * 25 + # Frame rate score
min(info['bitrate_kbps'] / 10000, 1) * 25 # Bitrate score
)
undefinedinfo = inspector.get_metadata()
quality_score = (
(info['width'] * info['height']) / 2073600 * 50 + # Resolution score
min(info['fps'] / 60, 1) * 25 + # Frame rate score
min(info['bitrate_kbps'] / 10000, 1) * 25 # Bitrate score
)
undefinedCommon Checks
常见检查
Is video 4K?
python
metadata['width'] >= 3840 and metadata['height'] >= 2160Is video HDR?
python
'hdr' in metadata.get('color_space', '').lower()Is audio stereo?
python
metadata['audio_channels'] == 2Is codec modern?
python
metadata['video_codec'] in ['h265', 'vp9', 'av1']视频是否为4K?
python
metadata['width'] >= 3840 and metadata['height'] >= 2160视频是否为HDR?
python
'hdr' in metadata.get('color_space', '').lower()音频是否为立体声?
python
metadata['audio_channels'] == 2编解码器是否为现代格式?
python
metadata['video_codec'] in ['h265', 'vp9', 'av1']Limitations
局限性
- Cannot extract corrupt/damaged video metadata
- Some proprietary formats may have limited support
- DRM-protected content cannot be analyzed
- Metadata extraction may be slow for very large files
- Requires FFmpeg/FFprobe for full codec details
- 无法提取损坏视频的元数据
- 部分专有格式可能支持有限
- 受DRM保护的内容无法分析
- 超大文件的元数据提取可能较慢
- 需要FFmpeg/FFprobe才能获取完整的编解码器详情