Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0xsline OpenChatCut Media Probing

From Leeroopedia
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:

  1. Run ffprobe: Execute `ffprobe -show_streams -show_format -of json` on the source.
  2. Parse JSON: Extract streams and format from the raw output.
  3. Classify streams: Find the first audio and video stream.
  4. Parse rational FPS: Convert "num/den" strings to rounded floats.
  5. Detect risks: Apply heuristic checks to derived metadata.
  6. Return ProbeResult: A structured, typed object.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment