Context
We need a cheap, reliable way to determine video length without deriving it from frame-processing workflows. Duration should be available before or independently of frame extraction so planning, validation, and accounting do not require expensive decode work.
Goal
Inspect the best implementation path for getting video duration with minimal compute, IO, dependency, and operational cost.
Questions to answer
- Can we read duration from container metadata only, avoiding frame decode entirely?
- Which backend/tooling is the best fit for this package:
ffprobe, PyAV/FFmpeg bindings, OpenCV metadata, MediaInfo, cloud/object-store metadata, or another approach?
- What are the failure modes for common formats/codecs, variable frame rate videos, truncated files, remote files, and missing/incorrect metadata?
- What is the cheapest acceptable fallback when metadata is unavailable or untrusted?
- How should this integrate with existing readers/processors/pipeline semantics without coupling duration lookup to frame extraction?
Evaluation criteria
- Avoids decoding frames in the common path.
- Minimizes bytes read for local and remote inputs.
- Has predictable dependency and packaging implications.
- Handles common video containers accurately enough for pipeline planning.
- Exposes clear errors or fallback behavior when duration cannot be determined cheaply.
Deliverable
Propose an implementation approach, including dependency choice, API placement, fallback behavior, tests, and documentation updates. Compare the approach with how Spark, Beam/Dataflow, Daft, Hugging Face Datasets, and Ray/Ray Data would typically treat this kind of metadata extraction, and justify any deviation for this codebase.
Context
We need a cheap, reliable way to determine video length without deriving it from frame-processing workflows. Duration should be available before or independently of frame extraction so planning, validation, and accounting do not require expensive decode work.
Goal
Inspect the best implementation path for getting video duration with minimal compute, IO, dependency, and operational cost.
Questions to answer
ffprobe, PyAV/FFmpeg bindings, OpenCV metadata, MediaInfo, cloud/object-store metadata, or another approach?Evaluation criteria
Deliverable
Propose an implementation approach, including dependency choice, API placement, fallback behavior, tests, and documentation updates. Compare the approach with how Spark, Beam/Dataflow, Daft, Hugging Face Datasets, and Ray/Ray Data would typically treat this kind of metadata extraction, and justify any deviation for this codebase.