Principle:0xsline OpenChatCut Media Probing
| Knowledge Sources | |
|---|---|
| Domains | Media_Analysis, Media_Import, Probing |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Analysis principle that extracts structured metadata from media files using FFprobe, normalizing raw stream/format data into a compact summary with dimensions, codecs, frame rate, and quality-risk flags.
Description
Media Probing is the inspection stage of the import pipeline. It wraps FFprobe (`ffprobe -show_streams -show_format -of json`) and normalizes the raw JSON output into a `ProbeResult` with:
- Duration: In seconds (from format or stream metadata).
- Dimensions: Width and height from the video stream.
- Frame rate: Parsed from `avg_frame_rate` or `r_frame_rate` rational strings (e.g., "30000/1001" → 29.97).
- Track detection: Boolean flags for audio and video track presence.
- Codecs: Video and audio codec names.
- Quality risks: Auto-detected planning risks:
- `low_resolution` — width < 720 or height < 480
- `mono_audio` — single audio channel
- `very_short` — duration under 3 seconds
- `variable_frame_rate` — avg and nominal FPS differ
- `low_frame_rate` — FPS below 20
The probe is pure and total — it never throws on malformed input, making it safe to run in the browser, server, and offline tests alike.
Usage
Use this principle when:
- Inspecting media files before import to assess quality and compatibility.
- Determining whether a file needs format normalization.
- Detecting quality risks for user-facing warnings.
- Running in any context (browser, server, CLI) since the parser is pure.
Theoretical Basis
The probe-and-normalize pattern:
- Run ffprobe: Execute `ffprobe -show_streams -show_format -of json` on the source.
- Parse JSON: Extract streams and format from the raw output.
- Classify streams: Find the first audio and video stream.
- Parse rational FPS: Convert "num/den" strings to rounded floats.
- Detect risks: Apply heuristic checks to derived metadata.
- Return ProbeResult: A structured, typed object.