home / skills / dkyazzentwatwa / chatgpt-skills / video-metadata-inspector

video-metadata-inspector skill

/video-metadata-inspector

This skill inspects video metadata to quickly reveal duration, resolution, codecs, frame rate, and bitrate for quality checks and transcoding planning.

npx playbooks add skill dkyazzentwatwa/chatgpt-skills --skill video-metadata-inspector

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
4.5 KB
---
name: video-metadata-inspector
description: Use when asked to inspect video file metadata, get video duration, resolution, codec information, frame rate, or bitrate.
---

# Video 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

## Quick Start

```python
from video_metadata_inspector import VideoMetadataInspector

# 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']}")

# Export full report
inspector.export_report('report.json', format='json')

# Batch inspect directory
inspector.batch_inspect(
    input_files=['video1.mp4', 'video2.mkv'],
    output='metadata.csv',
    format='csv'
)
```

## CLI Usage

```bash
# Basic metadata
python video_metadata_inspector.py input.mp4

# Full technical details
python video_metadata_inspector.py input.mp4 --verbose

# Export to JSON
python video_metadata_inspector.py input.mp4 --output metadata.json --format json

# Batch inspect directory
python video_metadata_inspector.py *.mp4 --output metadata.csv --format csv

# Compare multiple videos
python video_metadata_inspector.py video1.mp4 video2.mp4 --compare
```

## API Reference

### 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.DataFrame
```

## Metadata Categories

### Basic Information
- Duration (seconds, formatted)
- Resolution (width × height)
- Frame rate (FPS)
- File size
- Aspect ratio

### Video Stream
- Video codec (H.264, H.265, VP9, etc.)
- Codec profile and level
- Bitrate (kbps)
- Pixel format (yuv420p, etc.)
- Color space and range

### Audio Stream
- Audio codec (AAC, MP3, Opus, etc.)
- Sample rate (Hz)
- Channels (mono, stereo, 5.1, etc.)
- Audio bitrate (kbps)

### Container Format
- Container type (MP4, MKV, AVI, etc.)
- Creation date
- Metadata tags (title, artist, description)
- Number of streams

## 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
# Check if transcoding needed
metadata = inspector.get_metadata()
if metadata['video_codec'] != 'h265' or metadata['bitrate_kbps'] > 5000:
    print("Transcode recommended")
```

**Quality Assessment:**
```python
# 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
)
```

## Common Checks

**Is video 4K?**
```python
metadata['width'] >= 3840 and metadata['height'] >= 2160
```

**Is video HDR?**
```python
'hdr' in metadata.get('color_space', '').lower()
```

**Is audio stereo?**
```python
metadata['audio_channels'] == 2
```

**Is codec modern?**
```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

Overview

This skill inspects video files and returns comprehensive metadata such as duration, resolution, codecs, frame rate, bitrates, and container details. It is built for fast format verification, quality assessment, transcoding planning, and cataloging of video libraries. The output can be exported as JSON, CSV, or human-readable reports for integration into workflows.

How this skill works

The inspector parses each video with a media probing backend to extract stream-level and container-level tags, including video/audio codec, profile, pixel format, sample rate, and creation metadata. It computes derived values like aspect ratio, formatted duration, and bitrate-per-stream, and can run in batch mode to produce consolidated CSV/JSON reports. Optional verbose output gives full technical fields for troubleshooting and transcoding decisions.

When to use it

  • Verify uploaded files meet platform codec/resolution policies
  • Audit a library to plan bulk transcoding or storage optimization
  • Generate technical metadata reports for editors or QA teams
  • Automatically tag and catalog video assets for a media database
  • Compare multiple files to detect mismatched codecs, resolutions, or bitrates

Best practices

  • Run on a representative sample before large-scale batch processing to estimate runtime and output size
  • Use the exported JSON for automated pipelines and CSV for spreadsheet review
  • Enable verbose/technical mode when planning transcodes to capture codec profile and pixel format
  • Validate tool prerequisites (FFmpeg/ffprobe) on the host to ensure full codec detection
  • Exclude DRM-protected or known-corrupt files from automated batches to avoid failures

Example use cases

  • Check if an incoming delivery is 1080p H.264 and under the platform bitrate limit
  • Scan a directory of originals to decide which files should be transcoded to a modern codec like H.265 or AV1
  • Produce a metadata CSV for an asset management system including duration, resolution, and audio channels
  • Compare two exports of the same program to confirm identical codecs, frame rates, and bitrates
  • Generate a human-readable report for production that lists creation date, title tags, and container details

FAQ

What dependencies are required?

The inspector requires a media probing tool such as FFmpeg/ffprobe accessible on the host for full codec and stream detail extraction.

Can it inspect DRM-protected or corrupted files?

No. DRM-protected content cannot be analyzed and severely corrupted files may fail to yield metadata.