Principle:0xsline OpenChatCut Export Plan Validation
| Knowledge Sources | |
|---|---|
| Domains | Video_Export, Validation, Media_Processing |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Validation principle that normalizes and checks export parameters (resolution, codec, FPS, frame range, timeline structure) before rendering, failing fast on incompatible or malformed requests rather than producing broken output.
Description
Export Plan Validation is the preflight stage of a video export pipeline. Before any rendering begins, the export request is validated and normalized into a concrete ExportPlan — a fully-resolved description of what to render, with all defaults filled in and all constraints checked.
Key checks include:
- Timeline validity: The state must be a valid `TimelineState` with an items array.
- Codec/format compatibility: Audio format requires audio codec (mp3/wav); video format requires video codec (h264/vp8/prores).
- Resolution scalability: The canvas dimensions must scale exactly to the requested resolution; the server renderer rejects fractional scale products.
- FPS validity: Must be one of the supported options (24, 25, 30, 50, 60).
- Bitrate bounds: Video bitrate must be an integer between 1 Mbps and 80 Mbps.
- Nested timeline resolution: If a full project is provided, the sequence graph is validated and the nested timeline's render plan is resolved.
- Frame range normalization: Start/end frames or seconds are normalized into a concrete inclusive frame range.
This principle ensures that rendering never starts with ambiguous or contradictory parameters.
Usage
Use this principle when:
- Designing a video export pipeline that needs to fail fast on bad inputs.
- Building a render plan that downstream stages (materialization, rendering) can consume without re-validation.
- Supporting both simple (single timeline) and complex (nested project) export targets.
Theoretical Basis
The mechanism is a validate-then-normalize pipeline:
- Parse: Raw request fields are typed and checked.
- Resolve: Defaults are filled (e.g., codec defaults to `h264` for video, `mp3` for audio).
- Cross-validate: Format/codec/resolution constraints are checked together.
- Compute: Derived values (total frames, duration, scale, filename) are calculated.
- Emit: A frozen `ExportPlan` is returned for downstream consumption.
# Abstract algorithm (NOT real implementation)
def plan_export(request):
state = validate_timeline_state(request.state)
codec = request.codec or default_codec(request.format)
assert_compatible(request.format, codec)
resolution = validate_resolution(request.resolution, state)
frame_range = normalize_frame_range(request.start_frame, request.end_frame)
total_frames = compute_total_frames(state, frame_range)
return ExportPlan(
state=state, codec=codec, resolution=resolution,
frame_range=frame_range, total_frames=total_frames,
duration_seconds=total_frames / state.fps,
)