home / skills / benchflow-ai / skillsbench / ffmpeg-media-info

This skill analyzes media file properties such as duration, resolution, bitrate, codecs, and streams using FFprobe/FFmpeg.

npx playbooks add skill benchflow-ai/skillsbench --skill ffmpeg-media-info

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

Files (1)
SKILL.md
2.7 KB
---
name: FFmpeg Media Info
description: Analyze media file properties - duration, resolution, bitrate, codecs, and stream information
---

# FFmpeg Media Info Skill

Extract and analyze media file metadata using ffprobe and ffmpeg.

## When to Use

- Get video/audio file properties
- Check codec information
- Verify resolution and bitrate
- Analyze stream details
- Debug media file issues

## Basic Info Commands

```bash
# Show all file info
ffmpeg -i input.mp4

# JSON format (detailed)
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

# Simple format
ffprobe -v quiet -print_format json -show_format input.mp4
```

## Duration

```bash
# Get duration in seconds
ffprobe -v error -show_entries format=duration \
  -of default=noprint_wrappers=1:nokey=1 input.mp4

# Duration with timestamp format
ffprobe -v error -show_entries format=duration \
  -of default=noprint_wrappers=1:nokey=1 -sexagesimal input.mp4
```

## Resolution

```bash
# Get video resolution
ffprobe -v error -select_streams v:0 \
  -show_entries stream=width,height \
  -of csv=s=x:p=0 input.mp4

# Get resolution as JSON
ffprobe -v error -select_streams v:0 \
  -show_entries stream=width,height \
  -of json input.mp4
```

## Bitrate

```bash
# Get overall bitrate
ffprobe -v error -show_entries format=bit_rate \
  -of default=noprint_wrappers=1:nokey=1 input.mp4

# Get video bitrate
ffprobe -v error -select_streams v:0 \
  -show_entries stream=bit_rate \
  -of default=noprint_wrappers=1:nokey=1 input.mp4
```

## Codec Information

```bash
# Video codec
ffprobe -v error -select_streams v:0 \
  -show_entries stream=codec_name,codec_long_name \
  -of default=noprint_wrappers=1 input.mp4

# Audio codec
ffprobe -v error -select_streams a:0 \
  -show_entries stream=codec_name,codec_long_name \
  -of default=noprint_wrappers=1 input.mp4
```

## Sample Rate and Channels

```bash
# Audio sample rate
ffprobe -v error -select_streams a:0 \
  -show_entries stream=sample_rate \
  -of default=noprint_wrappers=1:nokey=1 input.mp4

# Audio channels
ffprobe -v error -select_streams a:0 \
  -show_entries stream=channels \
  -of default=noprint_wrappers=1:nokey=1 input.mp4
```

## Stream Count

```bash
# Count video streams
ffprobe -v error -select_streams v -show_entries stream=index \
  -of csv=p=0 input.mp4 | wc -l

# Count audio streams
ffprobe -v error -select_streams a -show_entries stream=index \
  -of csv=p=0 input.mp4 | wc -l
```

## Frame Rate

```bash
# Get frame rate
ffprobe -v error -select_streams v:0 \
  -show_entries stream=r_frame_rate \
  -of default=noprint_wrappers=1:nokey=1 input.mp4
```

## Notes

- Use `-v error` to suppress warnings
- `-of json` for structured output
- `-select_streams` to target specific streams (v:0 for first video, a:0 for first audio)

Overview

This skill extracts and analyzes media file metadata using ffprobe and ffmpeg. It reports duration, resolution, bitrate, codecs, stream counts, frame rate, sample rate, and channel layout. The output can be plain text, CSV, or structured JSON for downstream processing. It helps validate media properties and troubleshoot playback or encoding issues.

How this skill works

The skill runs targeted ffprobe/ffmpeg queries to read container and stream-level metadata without re-encoding. Commands use options like -select_streams, -show_entries, and -of json to return precise fields (duration, codec_name, width/height, bit_rate, r_frame_rate, sample_rate, channels). It suppresses nonessential logs with -v error and can count streams or format results for scripts or human review.

When to use it

  • Confirm video or audio codec before transcoding
  • Verify resolution and frame rate for delivery specs
  • Check duration and bitrate for file length and quality estimates
  • Count audio/subtitle streams and their properties
  • Debug playback or compatibility issues with specific players

Best practices

  • Use -v error to suppress warnings and get clean outputs
  • Prefer -of json for programmatic parsing and automation
  • Target specific streams with -select_streams (v:0, a:0) to avoid ambiguous results
  • Combine specific -show_entries to limit output to only needed fields
  • Validate results on representative files when building automated checks

Example use cases

  • Automated CI step that fails builds if video resolution or codec doesn’t match spec
  • Pre-transcoding inspection to choose appropriate encoder and bitrate
  • Batch reporting for a media library showing duration, codecs, and stream counts
  • Troubleshooting playback: identify unsupported codecs or unusual frame rates
  • Client delivery verification: confirm audio channel layout and sample rate

FAQ

Can this skill handle remote files or URLs?

ffprobe and ffmpeg can inspect many remote streams if ffmpeg supports the protocol; provide the URL instead of a local path and verify network access.

How do I get machine-readable output for scripts?

Use -of json (or other structured formats) with -show_format and -show_streams to receive JSON that is easy to parse in scripts or automation tools.