Principle:0xsline OpenChatCut Format Normalization
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Media_Processing, Encoding, Media_Import |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Transcoding principle that converts heterogeneous source media into a canonical format (H.264/AAC MP4, ≤1920px, constant frame rate) using FFmpeg with hardware acceleration, while stream-copying already-compatible sources.
Description
Format Normalization ensures all media in the system conforms to a predictable format for editing and rendering:
- Video codec: H.264 (with hardware-accelerated encoding via NVENC/VAAPI when available).
- Audio codec: AAC (transcoded only if source audio is incompatible; stream-copied otherwise).
- Resolution: Capped at 1920px on the longest edge; smaller sources are not upscaled.
- Frame rate: Variable frame rate (VFR) sources are converted to constant frame rate (CFR).
- Bitrate: Recommended based on resolution (1.5–8 Mbps).
- Compatibility check: If the source already has compatible video and audio codecs, FFmpeg stream-copies (no re-encoding) for speed.
The normalization is adaptive:
- Stream plan: `resolveStreamPlan` determines whether video and/or audio need transcoding based on codec compatibility.
- Hardware decode: Uses `hwaccel` for decode when the encoder is NVENC.
- Encoder attempts: Tries hardware encoder first, falls back to software on failure.
- Admission control: Validates the output meets minimum quality standards.
Usage
Use this principle when:
- Normalizing diverse user-supplied media into a consistent format.
- Deciding whether to transcode or stream-copy based on source compatibility.
- Leveraging hardware acceleration for faster transcoding.
Theoretical Basis
The adaptive transcoding decision:
# Abstract algorithm (NOT real implementation)
def normalize(input_path, output_path, probe_meta):
stream_plan = resolve_stream_plan(probe_meta)
target = target_dimension(probe_meta, max_dim=1920)
bitrate = recommended_bitrate(target)
if not stream_plan.transcode_video and not stream_plan.transcode_audio:
# Stream copy — no re-encoding
ffmpeg_copy(input_path, output_path)
else:
encoder = resolve_h264_encoder() # hardware or software
encode_normalized(
input_path, output_path, probe_meta,
target_w=target.w, target_h=target.h,
target_bitrate=bitrate, target_fps=probe_meta.fps,
convert_to_cfr=probe_meta.variable_frame_rate,
stream_plan=stream_plan,
)
Related Pages
Implemented By
Uses Heuristic
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment