Passtape.
Menu

How Passtape works

The main data flow

Passtape separates description from execution:

MediaGraph
    ↓ prepare(request)
PreparedPlan
    ↓ start output or request a frame
Runtime services
    ↓
Native decode → prepared operations → display or encode

MediaGraph is immutable after construction. PreparedPlan contains the fixed programs, formats, resource requirements, and diagnostics for one graph and execution request. Frame execution does not walk the original graph.

If you have not worked on a media engine before, read Media engine background first. It explains the domain constraints this design responds to — frame sizes, stateful decoders, color metadata, and loudness measurement — in a few minutes. A glossary at the end of this document defines the recurring terms.

Graph model

Every edge references a named output port with a declared media type. Operations declare their complete input, output, and parameter schema. This lets graph construction reject invalid wiring before a backend is involved.

Video, audio, masks, text, and tensors can travel through ordinary graph outputs. Operations with multiple outputs execute their demanded ports together, while unused ports are removed during preparation.

Graph time and source time are separate. Trimming selects the visible graph range; retiming controls how that range maps back to the source. Keyframed parameters are evaluated in graph time.

Preparation

Preparation is the compiler-like stage. It starts from demanded outputs, validates descriptors, selects backend implementations, resolves formats, inserts required conversions, and produces pass tapes for execution.

The request contributes facts that do not belong in the graph: output size, cadence, destination, codec requirements, cache budgets, concurrency limits, and whether hardware paths are required or preferred.

Preparation may fuse an operation with an immediately following conversion when the backend declares that combined implementation. It can also keep nested temporal programs intact when an operation needs neighboring frames.

Native surfaces and zero-copy

The platform-neutral engine describes surface requirements without exposing Metal, Core Video, D3D11, or Vulkan in the graph interface. A platform backend owns the corresponding native resources.

On macOS, VideoToolbox decodes into Core Video pixel buffers. Metal creates texture views over that storage, and intermediate frames come from reusable Core Video pools. Encoding accepts prepared pixel buffers without requiring Passtape to copy frame pixels through CPU memory.

Zero-copy is a property of the complete prepared path, not an operation in isolation. Format conversion, resizing, CPU-buffer output, or an incompatible codec may introduce a new surface or explicit readback. Preparation reports the selected path and any permitted fallback.

Execution

Video execution consumes precompiled pass tapes. It records the operations for one frame into at most one Metal command buffer on the current macOS backend. A source-only frame that already matches its destination can avoid GPU command submission entirely.

Audio executes as bounded blocks of planar floating-point samples on the CPU. Decode, processing, and encoding reuse allocated storage where possible. Pitch-preserving retiming delegates to the native macOS time-pitch implementation while the surrounding pipeline remains block based.

Sequential output sessions overlap decoding, GPU work, and encoding with bounded queues. Interactive requests instead prioritize latency and wait for the requested result before returning.

Runtime ownership

Native media frameworks often require mutable state to stay on an owning thread. Passtape’s concurrent runtime therefore uses worker-owned audio and video lanes rather than placing non-thread-safe native objects behind a shared mutex.

Applications send work through a thread-safe interface. Each worker retains ownership of its decoders, caches, command queues, and output state. This makes concurrency an execution concern rather than something every graph caller must reconstruct.

Extending Passtape

A semantic operation descriptor belongs to the platform-neutral engine. Its implementation belongs to a backend. The same operation identity can therefore have Metal, Vulkan, D3D11, or CPU implementations without changing saved graphs.

Runtime-generated effects follow the same split. An application registers the descriptor and native implementation in a candidate runtime generation, prepares the affected graph, then publishes the ready runtime and plan together. Existing playback can continue on the previous generation while compilation happens.

This separation is the central design rule: graph interfaces express media intent; platform backends own native execution details.

Detailed internals

Background

Planning and execution

Media paths

Caching and interactive use

Runtime behavior and backends

Reference

Media Engine Background

Passtape’s design follows from a few facts about media that hold on every platform. This chapter explains them for readers who have not worked on a media engine before. The rest of this document assumes them.

Decoded video is enormous

Compressed video is small; decoded video is not. One decoded 1080p BGRA frame is about 8 MB (1920 × 1080 pixels × 4 bytes). A 4K frame is about 33 MB. At 30 frames per second, decoded 4K video is roughly one gigabyte of pixels every second.

Copying that much data — between CPU and GPU memory, or even within GPU memory — competes with the actual rendering work for memory bandwidth. This is why:

  • Passtape keeps pixels on the GPU from decode to display or encode whenever the prepared path allows it (zero-copy);
  • intermediate frames live in reused, pooled surfaces — GPU-resident pixel storage such as a Metal texture or a Core Video pixel buffer — rather than fresh allocations;
  • every cache in the engine has a byte budget, because even a few dozen frames is a large amount of memory.

Video decoders are stateful

A video codec stores most frames as differences from nearby frames. Only occasional keyframes are complete images; the frames between them cannot be reconstructed without decoding their predecessors. A decoder is therefore a stateful, mostly forward-moving machine:

  • decoding a frame usually requires having decoded the frames before it;
  • seeking backward, or far forward, means reopening near an earlier keyframe and decoding forward to the requested frame;
  • decoded frames are worth caching, because producing one again is expensive.

This is why Passtape sources use serial decode workers that favor nearby forward requests, why interactive sessions retain decoded frames, and why sequential export simply decodes in order.

Native media frameworks pick their threads

Hardware decoders, encoders, and the OS frameworks around them (VideoToolbox, Media Foundation, VA-API) generally require their mutable state to stay on one owning thread. Wrapping such an object in a shared lock does not make it safe. Passtape therefore gives each worker its own decoders, caches, and command queues — worker-owned lanes — and applications talk to the runtime through a thread-safe interface.

Color is metadata, not pixels

Two frames can contain identical bytes and represent different colors. What the stored numbers mean is defined by color metadata: which red, green, and blue the format refers to, how stored values map to physical light, how RGB relates to the YCbCr encoding most codecs use, and whether the full numeric range is used. Getting it wrong does not crash — it produces a subtly wrong image: washed-out blacks, a green tint, wrong brightness. A media engine must carry color metadata with every frame and convert between interpretations explicitly. Video color metadata describes how Passtape does this.

Audio runs on its own clock

Video is a sequence of frames, tens per second. Audio is a stream of samples, typically 48,000 sample frames per second. Audio is also small: one second of 48 kHz stereo f32 PCM (uncompressed audio samples) is under 400 KB, against the gigabyte-scale second of 4K video above. The two media types therefore get different pipelines: video renders individual frames on the GPU, while audio processes blocks of samples on the CPU. They meet only at the output, where a container interleaves them by timestamp.

Interactive and sequential output want opposite things

An export wants throughput. Decoding, GPU work, and encoding run at the same time on different frames, connected by bounded queues. When a queue fills — the encoder cannot keep up, the disk is slow — the stages before it must pause. This is backpressure: a full downstream stage pausing upstream work so memory use stays bounded.

Interactive playback and scrubbing want latency. Show the frame the user asked for as soon as possible, and abandon work for frames they no longer care about.

Passtape prepares one plan and lets the output session choose which behavior applies.

Loudness is measured, not guessed

How loud audio sounds is not its peak sample value. Delivery platforms specify perceived loudness in LUFS (Loudness Units relative to Full Scale), measured by the ITU BS.1770 algorithm; many streaming services normalize programmes to around −14 LUFS. True peak, in dBTP, estimates the analog peak between samples by oversampling. Hitting a loudness target is therefore a measurement pass followed by a gain adjustment — see Loudness normalization.

Runtime and Output Sessions

MediaRuntime owns the services reused across graph preparations and output requests. Its generic video and audio providers supply decoded media, while the matching backends execute prepared programs.

Every output follows the same path:

MediaGraph
  -> ExecutionRequest
  -> MediaRuntime::prepare
  -> PreparedPlan
  -> video, audio, or audio/video output session
  -> output target

Building a graph

Graph construction is request-neutral: the graph describes media intent and knows nothing about output size, codecs, or destinations. The preferred API is the imperative builder:

let mut graph = MediaGraph::builder("transcode");
let input = graph.add_video_source("input", range, source)?;
let output = graph.add_video_output("output", input)?;
let graph = graph.build();

Built-in operations use named options that keep their wiring explicit:

let amount = graph.add_scalar_parameter("amount", 0.5)?;
let mixed = graph.add_operation(video_mix::Options {
    id: "mix",
    active_range: range,
    first,
    second,
    amount,
})?;

The graph names the semantic operation. Request-specific preparation selects the implementation supplied by the active backend. The operation catalog lists each operation’s inputs and parameters.

Requesting an output

A RequestedVideoOutput connects a logical graph output to a concrete target. The target advertises its format and cadence (its frame timing) before preparation, then opens its sink after those settings have been resolved.

let target = RequestedVideoOutput::new(output.node_id(), target);
let plan = runtime.prepare(graph, &target.execution_request())?;
runtime.start_video_output(plan, target)?.run()?;

When the final path is not known until execution, keep a path-independent specification in the requested output:

let requested = RequestedVideoOutput::new(output.node_id(), specification);
let plan = runtime.prepare(graph, &requested.execution_request())?;
let requested = requested.bind_target(|specification| specification.at(staging_path));
runtime.start_video_output(plan, requested)?.run()?;

bind_target consumes the same specification used during preparation. This prevents application code from accidentally rebuilding different codec, format, or container settings when it attaches an atomic staging path.

Output dimensions are part of the target request. They do not add an operation to the graph because they describe how the final logical output is delivered:

let request = VideoOutputRequest {
    size: OutputSize::Dimensions(OutputDimensions {
        width: 1_280,
        height: 720,
    }),
    ..VideoOutputRequest::default()
};
let target = target.with_request(request);

Preparation resolves the dimensions and verifies that the backend can produce them. Frame execution applies the resize when the output is materialized.

VideoOutputDestination::GpuSurface keeps pixels in backend storage for display or encoding. VideoOutputDestination::CpuBuffer explicitly requests a tightly packed CpuVideoFrame for CPU consumers such as thumbnails or pixel analysis. CPU output must be allowed by the request’s preparation policy.

Running a session

run advances through the prepared output range, renders each frame, responds to sink backpressure, and finalizes the destination. Interactive callers can render explicit times directly or use a latest-request frame scheduler.

File backends can build their video sink with EncodedVideoPipeline. It keeps rendering, compression, and container writing as separate stages, with a fixed packet queue between the encoder and muxer (the component that writes encoded packets into the container file). If the container stops accepting packets, that bound propagates backpressure to frame rendering instead of letting compressed data accumulate without limit.

Video, audio, and media sessions also provide run_with_control. It accepts a thread-safe cancellation token and reports exact work accepted by the destination. See output control.

Sequential run calls discard decoded history. Interactive requests can opt into several levels of reuse — decoded frames, prepared programs, intermediate results, and rendered outputs. See caching and reuse.

Audio sessions

Audio uses the same request, preparation, target, and session pattern through RequestedAudioOutput and AudioOutputSession. Calling with_audio consumes a video runtime and returns a runtime whose type includes AudioServices. Only that configured runtime exposes start_audio_output, so missing audio services are caught at compile time. The session executes prepared audio blocks on their sample timeline.

Combined media output

A destination containing any non-empty set of streams uses RequestedMediaOutput and MediaOutputSession:

let outputs = MediaOutputs::audio_video(
    video.node_id(),
    video_request,
    audio.node_id(),
    audio_request,
)
.with_text_tracks([
    TextTrackOutput::new(english_captions.node_id())
        .with_language("en-US")?
        .enabled_by_default(true),
    TextTrackOutput::new(spanish_captions.node_id()).with_language("es")?,
])?;
let target = RequestedMediaOutput::new(outputs, target);
let plan = runtime.prepare(graph, &target.execution_request())?;
runtime.start_media_output(plan, target)?.run()?;

The selected graph outputs are prepared together. Text graph outputs compile into timed cue tracks; they are destination data, not rendered video, so they stay selectable in containers that support captions. Video-only and audio-only destinations use MediaOutputs::video and MediaOutputs::audio.

The earliest start becomes time zero in the destination, so an output that starts later keeps that delay. Video keeps its frame cadence and audio keeps its sample timeline. The session submits the earliest available timestamp first, but lets the other stream proceed when that input applies backpressure. It keeps at most one pending frame and one pending audio block, and marks each stream complete as soon as its timeline ends.

MediaOutputSession is available on a media runtime configured with both video and audio services, even when only one stream is selected. Callers with a lane-only runtime or a lane-specific destination should use VideoOutputSession or AudioOutputSession instead.

The selected graph outputs own timeline completeness: delayed starts and gaps must materialize black video or silence before they reach a file destination. Destinations may therefore require monotonically contiguous samples without inventing media for missing graph intervals.

Observing the runtime

MediaRuntime::stats returns cumulative preparation, source, rendering, submission, backpressure, output-run, and decoded-media-cache statistics. Duration collection is opt-in so normal frame and audio-block execution avoids clock reads. See runtime statistics.

Operations

Operations transform media inside a graph. Each operation has a stable ID, ordered inputs and parameters, and one or more statically named outputs. Preparation selects an implementation from the active backend.

Built-in operations expose named options through ops:

let transformed = graph.add_operation(video_transform_2d::Options {
    id: "transform",
    active_range: range,
    input,
    translation_x,
    translation_y,
    scale_x,
    scale_y,
    rotation_degrees,
    anchor_x,
    anchor_y,
    crop_left,
    crop_top,
    crop_right,
    crop_bottom,
})?;

This keeps the graph builder small as operations are added. The complete operation catalog — each operation’s inputs, outputs, parameters, and edge-case behavior — lives in the main documentation; this chapter explains the machinery they all share.

Descriptors

Plugins and data-driven graphs can use OperationOptions with an OperationDescriptor directly. The descriptor is the complete contract, so the node cannot repeat or disagree with its operation ID, inputs, or outputs.

Multi-output operations declare their ports once and return an OperationOutputs collection. Names are resolved while building the graph; runtime edges carry compact OutputRef values:

let descriptor = OperationDescriptor::new(
    OpRef::new("example.video.split", 1),
    "Split video",
    &[MediaType::Video],
    OutputDescriptor::new("image", MediaType::Video),
)
.with_output_schema(&[
    OutputDescriptor::new("image", MediaType::Video),
    OutputDescriptor::new("matte", MediaType::Mask),
]);

let outputs = graph.add_operation(OperationOptions {
    id: "split",
    active_range: range,
    descriptor: &descriptor,
    inputs: &[input],
    params: &[],
})?;
let image = outputs.get("image").expect("declared output");
let matte = outputs.get("matte").expect("declared output");

The graph snapshot retains the complete named schema and validation compares it with the registered descriptor, so reordering same-media ports cannot silently change routing. Only demanded ports — the ports a downstream output actually needs — are scheduled. When several ports from one operation are needed, the backend receives them together in one execute_passes call; its pass and output slices are aligned, and each pass identifies its port through VideoPass::output_port_id or AudioPass::output_port_id. Audio and visual ports cannot be mixed on one operation because they use different clocks and execution pipelines.

Data ports

Ports carry one media type: Video, Mask, Audio, Text, Tensor, or Data, the last for images of numbers such as depth or an STMap, stored in a 32-bit float data format and never color-converted. InputDescriptor::data(name, channels) declares a data input that needs at least that many channels, so an STMap input asks for two, and preparation refuses a narrower format before any frame renders. OutputDescriptor::data(name, format) declares a data output of a fixed data format, as the range measurement’s 1 × 1 Rg32Float is. A backend’s implementation can take its output size from a named input with with_video_output_size_from_input, as the STMap warp takes the map’s. A data input reaches its operation exactly as stored, so the operation chooses its own filtering, edges and pixel centres in shader code.

Parameters and keyframes

Typed parameters may be constant or keyframed in graph timeline time. Scalar, two-dimensional point, and RGB values are supported. A keyframe controls the span after it with hold, linear, preset easing, or a custom cubic Bézier timing curve:

let curve = ScalarKeyframeCurve::new([
    Keyframe::new(range.start(), 0.0, KeyframeInterpolation::Linear),
    Keyframe::new(range.end(), 1.0, KeyframeInterpolation::Hold),
])?;
let amount = graph.add_keyframed_parameter("amount", curve)?;

Values before the first keyframe use its value, and values after the last use the last value. Preparation stores the immutable curve once; frame execution evaluates it at the pass time without traversing the graph.

Scalar spans also support KeyframeInterpolation::ValueBezier(CubicBezierValue). Unlike CubicBezier timing easing, its vertical controls are absolute parameter values. It can therefore leave a value and return to it, or overshoot either endpoint. For example, controls [0.25, 10.0] and [0.75, 10.0] between values 2.0 and 2.0 reach 8.0 halfway through the span. Horizontal controls stay in [0, 1], measured from the start of the span, and all coordinates must be finite. Value handles apply to scalar curves; point and RGB curves retain timing easing.

The curve constructor prepares value-segment polynomial coefficients once. Random-access sampling finds the span by binary search; sequential audio sampling keeps its span cursor and Bézier solver hint. Neither path allocates per sample. KeyframeInterpolation::sample_scalar exposes the same scalar evaluator for an editor’s local value readout without constructing a whole curve. Exact keyframe times return the authored values. Range validation includes the curve’s interior extrema, and parameter fingerprints include every handle coordinate.

Decibel gain streams evaluate both keys and controls in decibels before mapping the result to linear amplitude. Preview and export consume these same streams.

Temporal operations

An operation that needs neighboring frames declares their exact time offsets:

let descriptor = descriptor
    .try_with_temporal_offsets(&[previous_frame, next_frame])
    .expect("temporal offsets must be representable");

Preparation derives the enclosing TemporalWindow and compiles those samples into the video pass tape. The output frame rate does not change which samples the operation receives. Ordinary operations declare no offsets. Temporal audio operations are rejected until audio execution can supply neighboring blocks.

Cache policy

Custom operations are not eligible for rendered-output reuse by default. An operation can opt in with with_cache_policy(OperationCachePolicy::Deterministic). This is a correctness promise: inputs, parameters, requested time, source content revisions, and versioned implementation identity must contain every output-affecting dependency. Operations that use hidden mutable state, randomness, external resources, or unrepresented environment state must keep the default Never policy.

An operation can also declare with with_time_independent() that time never changes its output. A pass of it that is deterministic, reads only constant parameters and only inputs that are themselves unchanging becomes a static value, computed once and reused at every frame, as Caching and Reuse describes. Operations that read the frame’s time or context must not declare it.

What is not an operation

Output resizing is not a graph operation. It is an output-target setting because it changes how a logical output is delivered without changing the graph’s media transformation topology.

Fused conversions

A backend can declare that an operation also performs selected immediately following conversions. Preparation uses this only when the operation result feeds that conversion and nothing else. The combined pass removes the surface between them while preserving the graph operation and converted format.

Video Segments

Passtape prepares stable timeline ranges rather than individual frames:

[0s, 5s)   clip A
[5s, 7s)   clip A + clip B + transition
[7s, 10s)  clip B

This produces three segments because the active sources and operations change at 5 and 7 seconds. Every frame within a segment reuses the same execution structure; only timestamps and parameter values vary.

Where segments are used

MediaGraph
  -> semantic analysis finds stable topology ranges
SemanticPlan
  -> preparation selects requested ranges and compiles segment programs
PreparedPlan
  -> frame execution finds the segment for a requested time

Semantic analysis first creates backend-neutral segments. Preparation filters them to the requested outputs and creates a VideoSegmentProgram. Frame execution uses the program to find active sources and its pass tape.

Program shape

pub struct VideoSegmentProgram {
    id: u32,
    semantic_id: Arc<str>,
    time_range: TimeRange,
    active_source_indices: Box<[SourceIndex]>,
    pass_tape_index: VideoPassTapeIndex,
    temporal_window: TemporalWindow,
    cache_key: Option<ResultIdentity>,
}
  • id identifies the program within this prepared plan.
  • semantic_id identifies the matching global semantic span across preparations. It remains equal while the graph ID, active topology, and span boundaries remain equal; it is opaque and not persistent.
  • time_range is half-open: it includes its start and excludes its end.
  • active_source_indices identifies the sources needed in the range.
  • pass_tape_index selects the work to execute for each frame.
  • temporal_window records how much neighboring source time the operations need before and after each frame.
  • cache_key makes deterministic rendered work eligible for reuse. It includes relevant source content revisions, operations and parameters, selected pass implementations, output settings, timeline range, and backend. It is absent when a source or operation has not promised deterministic output.

The cache key is an in-process reuse fingerprint, not a media checksum or a persistent file identifier.

Operations declare exact neighboring offsets. Windows summarize their furthest offsets and add along an operation chain. For example, two effects that each need the previous frame require input from two frames earlier. Parallel branches use the larger enclosing window.

Preparation propagates the exact offsets through upstream operations. The pass tape contains the resulting source requests and pass jobs at relative times. Frame execution adds the requested output time, acquires those decoded frames, and follows the fixed tape.

When an offset reaches outside the selected stable-topology segment, execution repeats the current frame for that sample. This keeps the first and last output frames renderable without executing a tape against different topology.

The type is defined in src/prepared_plan/program.rs.

Pass Tapes

A VideoPassTape is the ordered recipe a backend executor follows for every frame in a video segment.

Preparation creates one tape for each prepared segment. The segment owns the timeline range and stores an index into the prepared plan’s tape table. Tape times are relative to the requested output frame, so one immutable tape works throughout the segment.

It is similar to a list of GPU commands, but it is not raw GPU work yet. Each pass names the selected backend implementation, its inputs, its parameters, and where its result goes. A backend executor turns that information into GPU or CPU work.

Tape shape

Each tape contains three kinds of records:

pub struct VideoPassTape {
    source_slots: Box<[VideoSourceSlot]>,
    passes: Box<[VideoPass]>,
    output_slots: Box<[VideoOutputSlot]>,
    // Per value: the format and capabilities its storage must have.
    surface_descriptor_indices: Box<[VideoSurfaceDescriptorIndex]>,
    // Per value: the reusable allocation slot for an operation result.
    // Decoded source values have no slot.
    surface_slot_indices: Box<[Option<VideoSurfaceSlotIndex>]>,
    // Per slot: the descriptor used when allocating that reusable surface.
    surface_slot_descriptor_indices: Box<[VideoSurfaceDescriptorIndex]>,
}

pub struct VideoSourceSlot {
    source_index: SourceIndex,
    value_index: VideoValueIndex,
    time_offset: RationalTime,
}

pub struct VideoPass {
    kind: VideoPassKind,
    implementation_id: Arc<str>,
    time_offset: RationalTime,
    input_values: Box<[VideoValueIndex]>,
    temporal_input_values: Box<[VideoTemporalInput]>,
    output_value: VideoValueIndex,
    parameter_stream_indices: Box<[ParameterStreamIndex]>,
    recyclable_values: Box<[VideoValueIndex]>,
}

pub enum VideoPassKind {
    Operation(OperationIndex),
    Conversion,
}

pub struct VideoOutputSlot {
    output_index: OutputIndex,
    value_index: VideoValueIndex,
}
  • Source slots identify decoded frames and their times relative to the requested output frame.
  • Passes transform those frames in dependency order. VideoPassKind distinguishes graph operations from format conversions inserted by preparation. An operation pass keeps semantic input and parameter order. A conversion pass has one input and no parameter streams. Temporal passes also identify neighboring values for each semantic input; backends can consume them in one scan through VideoPassInputs::temporal_samples. Each pass records intermediate values whose surfaces become reusable after that pass.
  • Output slots identify the results sent to requested graph outputs.

The runtime can decode the source slots, execute the passes from first to last, and materialize the output slots. It does not need to traverse MediaGraph or sort operations for every frame. See frame execution for how a backend runs this recipe.

How records connect

Source slots and passes each produce a logical video-frame result. Passtape calls each result a value. A value can therefore be a decoded source frame or an intermediate frame produced by an operation.

Records refer to values using dense VideoValueIndex numbers:

source A -> value 0
source B -> value 1
mix(value 0, value 1) -> value 2
requested output -> value 2

The three surface arrays describe storage without allocating it. Each value position holds a surface-descriptor index; the descriptor describes the value’s format and required capabilities, not an allocated texture or buffer. Operation results additionally map to prepared surface slots — reusable allocations planned so that frame execution never searches for free storage at runtime — and each slot has its own descriptor covering every value that will use it. Surface planning explains how the descriptors and slots are computed.

The contracts are defined in src/prepared_plan/video_pass.rs and compiled in src/prepared_plan/prepare.rs.

Surface Planning

A video pass tape describes frame results as logical values. Surface planning describes the storage each value will require when the tape runs.

Passtape does not allocate GPU resources during preparation. It creates a table of VideoSurfaceDescriptor records instead:

pub struct VideoSurfaceDescriptor {
    format: VideoFormat,
    required_capabilities: VideoSurfaceCapabilities,
}
  • format contains the required dimensions, pixel format, and color metadata.
  • required_capabilities records the access a compatible surface must support.

The current capabilities are:

CapabilityMeaning
DECODE_WRITEA hardware decoder can write the surface.
SHADER_READA video shader can read the surface.
RENDER_WRITEA video render pass can write the surface.
CPU_READBACKThe surface can be copied into CPU-addressable memory.

A value can require several capabilities. For example, a decoded source consumed by a mix operation requires both DECODE_WRITE and SHADER_READ.

Each VideoPassTape stores one VideoSurfaceDescriptorIndex for every dense VideoValueIndex. Compatible values share entries in the prepared plan’s descriptor table:

value 0 -> descriptor 0: BGRA 1920x1080, decode write + shader read
value 1 -> descriptor 0: BGRA 1920x1080, decode write + shader read
value 2 -> descriptor 1: BGRA 1920x1080, render write

A data image’s value (depth, an STMap, IDs) has a descriptor in its own 32-bit float data format, R32Float, Rg32Float or Rgba32Float, with unspecified color metadata. Its format differs from every color format, so a data value never shares a descriptor or a surface slot with a picture, and no pass writes a picture into a surface that held numbers.

The runtime will later acquire a surface whose actual capabilities contain all of the descriptor’s required capabilities. The descriptor does not choose a concrete texture, pool entry, queue transition, or API object.

Output format selection

A video output request names one preferred pixel format and may list ordered fallbacks. Preparation selects the first format supported by the backend and the required graph conversion. The selected format is stored in VideoOutputPlan, so execution never negotiates formats per frame.

An encoder target can therefore prefer its native input while accepting a more general surface when the backend cannot prepare that native layout. Callers that require an exact format leave the fallback list empty.

Working set

PreparedPlan::video_surface_working_set records the maximum number of each descriptor used by one frame’s operation results and output transforms. This is deterministic because the pass tapes and output materialization steps are fixed during preparation.

Preparation records the last pass that reads each intermediate value and assigns operation results to reusable surface slots. A slot is reassigned only after its previous value’s final read. For example, a linear chain of three passes needs two intermediate slots rather than three:

pass 1 -> slot 0
pass 2 -> slot 1  (then slot 0 becomes available)
pass 3 -> slot 0

Each slot’s descriptor combines the capabilities required by every value that uses it. Frame execution therefore follows fixed slot indices and does not search for reusable surfaces.

Decoded source surfaces are owned by the source provider and are never reused as operation outputs. Surfaces retained by requested outputs are also excluded from reuse so a later pass cannot overwrite a displayed or encoded frame.

A backend can use the table to prewarm its surface pools before frame execution. It is a minimum working set, not a hard allocation limit. Decoder reference frames belong to the decoder, and a display or encoder may retain submitted frames until its bounded backpressure allows more work.

Frame execution describes when those surfaces are acquired and who owns their handles.

The contracts are defined in src/prepared_plan/video_surface.rs and compiled in src/prepared_plan/prepare.rs.

Frame Execution

Frame execution happens after graph analysis and request-specific preparation. It is the per-frame part of the engine:

once:       MediaGraph -> MediaRuntime::prepare -> PreparedPlan
per frame:  VideoOutputSession -> decoded sources -> VideoFrameExecutor -> target

For a requested time, the runtime’s VideoFrameRenderer selects the prepared video segment. It asks each VideoSourceFrameProvider for the required source frames, passing each source identity, source-local time, decoder constraints, and surface descriptor. A temporal pass tape contains the exact neighboring offsets declared by its operations. At a segment boundary, an unavailable neighbor repeats the current frame. The provider returns each decoded surface and the exact source-local range that surface represents.

The provider does not choose the graph’s working format. Preparation inserts pixel or color conversion passes before operations that need them. A requested output resize is resolved during preparation and applied when that output is materialized.

Interactive sessions may reuse those frames through the decoded frame cache. Sequential output sends ordinary decoded frames directly to execution and does not retain a history. Temporal execution keeps only its prepared decode working set so adjacent output frames do not repeatedly seek and decode the same neighborhood. This working set is separate from the caller’s optional cache budget, and preparation rejects a temporal schedule whose estimated decoded surfaces exceed the engine limit.

The renderer supplies the resolved surfaces to VideoFrameExecutor, which runs the center and neighboring pass jobs in prepared order and materializes only the requested center-time outputs. Materialization can retain the final surface as-is or resize it to dimensions resolved from the output request. The executor gives the backend one frame boundary around this work, allowing a GPU backend to record all passes and output conversions before submitting them together.

This stage runs for every requested frame, but it does not repeat preparation: it never traverses MediaGraph, chooses implementations, or sorts operations. An output session adds cadence, target selection, backpressure, and finalization around this per-frame path.

Runtime traits

Rust uses a trait to define behavior that different types can implement.

  • VideoSourceFrameProvider supplies decoded source surfaces; its concrete implementation owns media lookup, demuxing, and decoding.
  • VideoFrameBackend acquires intermediate surfaces, executes prepared passes, materializes outputs, and completes the recorded frame.

For example, a macOS implementation can decode into Core Video surfaces and execute passes with Metal while the prepared plan remains platform-neutral.

Ownership

The executor retains source handles, holds intermediate handles while the frame runs, and returns the materialized outputs to the caller. The backend owns the actual allocation and pooling. These lifetimes keep pixels on the GPU and stop a surface from being reused while it is still needed.

The prepared plan and executor backend must have the same stable backend ID. This prevents a pass tape compiled for one backend from being run by another.

The contracts are defined in src/video_frame.rs and src/video_frame/render.rs. The surrounding runtime and session interface is defined in src/runtime.rs.

Audio Blocks

Audio is processed as decoded PCM samples. It uses its own sample clock: a 48 kHz output contains 48,000 sample frames per second.

Passtape prepares one AudioBlockProgram for each timeline span where the active audio work stays the same:

pub struct AudioBlockProgram {
    time_range: TimeRange,
    sample_range: AudioSampleRange,
    pass_tape_index: AudioPassTapeIndex,
    format: AudioFormat,
}

Each program points to an ordered pass tape:

decode 44.1 kHz stereo
  -> resample to 48 kHz
  -> run graph operations
  -> send to output

The source provider only decodes the file’s native PCM format. Audio formats identify every speaker and its storage order, so stereo is not confused with two unrelated channels. Preparation inserts explicit resampling or channel conversion passes when needed. The backend executes those passes and the graph operations in order.

The current audio operations use the requested output format as their working format, so differently formatted sources are converted before processing.

AudioOutputSession divides the programs into fixed-size blocks, executes them, and sends the results to a file, device, or other destination. The preparation policy selects the block size.

See src/prepared_plan/audio_pass.rs and src/audio_block.rs.

Loudness Normalization

Loudness normalization is an explicit two-pass graph workflow: measure the programme’s loudness first, then apply one gain that brings it to the target. Media engine background explains why loudness is measured rather than derived from peaks.

Prepare the unnormalized audio output in its delivery format, then scan that prepared output:

let analysis = runtime.analyze_audio_loudness(plan, output_node)?;
let settings = AudioLoudnessSettings::new(-14.0, -1.0)?;
let normalization = analysis.normalization(settings);

The settings request an integrated loudness of −14 LUFS with a true-peak ceiling of −1 dBTP.

Analysis implements ITU-R BS.1770, the standard loudness measurement: K-weighting (a frequency curve approximating how loudly humans perceive each frequency), speaker-position weighting, overlapping 400 ms measurement blocks, and absolute and relative gates that exclude silence and very quiet passages from the average. True peak is measured with four-times oversampling to estimate peaks that fall between samples. LFE channels do not contribute to programme loudness.

Rebuild the graph with the resolved normalization before its audio output:

let normalized = graph.add_operation(ops::audio_normalize::Options {
    id: "delivery-normalization",
    input: programme_audio,
    normalization,
})?;

media.audio.normalize applies one constant gain to every channel. The gain is the smaller of the amount needed to reach the loudness target and the amount allowed by the true-peak ceiling. It does not clip or limit samples, so a peak-constrained programme can remain quieter than the requested loudness. The ceiling applies to the graph PCM measured before encoding. Lossy codecs can introduce new reconstructed peaks; validate the encoded deliverable separately when its decoded peak is part of the delivery contract.

Analysis is never part of ordinary graph preparation. Callers decide when to scan and can keep the resulting graph separate from the editable programme. The resolved gain retains the analyzed graph identity, graph version, and timeline range. The typed operation rejects it when rebuilding another graph revision and uses the measured range automatically. Preserve the graph identity and version for a delivery-only rebuild; increment the version and analyze again after changing programme content. Analyze again when changing delivery format.

Long-running EBU Tech 3341 vectors and the release throughput matrix are explicitly invoked:

cargo test -p passtape-engine ebu_tech_3341 -- --ignored
cargo test --release -p passtape-engine loudness_analysis_benchmark_matrix \
  -- --ignored --nocapture

Video Color Metadata

VideoFormat carries the information needed to interpret pixel values:

pub struct ColorMetadata {
    pub primaries: ColorPrimaries,
    pub transfer: TransferFunction,
    pub matrix: YcbcrMatrix,
    pub range: ColorRange,
}
  • primaries identify which physical red, green, and blue the format refers to. A mismatch shifts saturation: colors look too vivid or too muted.
  • transfer defines the relationship between linear light and stored values. A mismatch renders the image too dark or too bright.
  • matrix describes RGB and YCbCr conversion. A mismatch tints the whole frame.
  • range distinguishes video range (which reserves the codes near 0 and 255) from full range. A mismatch washes out blacks or crushes shadows.

None of these mistakes fail loudly — the pixels remain “valid,” just wrong — which is why the engine carries the metadata explicitly instead of guessing.

Sources provide this metadata. A missing declaration remains Unspecified instead of being labeled as a known color space. Format-preserving operations, prepared values, surface descriptors, and outputs keep the metadata with the frame. OutputColor::Source preserves it; OutputColor::Metadata requires an explicit output interpretation.

Transparency is kept to the output in formats that carry alpha. An output that shows frames on screen asks for OutputAlpha::Opaque, which lays each frame over black in the output’s conversion, in linear light, as an encoder without alpha does. Without it, a translucent pixel with nothing under it would show at full strength, since a screen ignores alpha.

OutputAlpha::Mode requests an explicit alpha representation. Nested GPU programs use their declared surface mode; EXR writers and bounded linear readbacks request premultiplied pixels. OutputAlpha::Source preserves the source path’s mode, which may change when a composition is frozen, so it is not a promise of premultiplied output. Frozen rendered pictures use linear BT.2020 half-float surfaces rather than inheriting an 8-bit background’s encoding, preserving HDR, negative values and fractional alpha.

Passtape does not silently reinterpret pixels. For an operation with several video inputs, the first input selects the working color metadata. If the backend implementation requires a pixel format, that requirement changes only the pixel storage; it does not replace the working color metadata.

Preparation rejects inputs that cannot be reconciled deterministically. When complete input and working metadata differ, preparation inserts a conversion pass before the operation. The same happens before an output whose requested format differs. Identical conversions of one value are shared. The prepared plan reports FormatConversionInserted when conversion passes are present.

Pixel storage follows the same rule. A backend advertises exact conversion pairs and an operation may require a specific pixel format. Preparation inserts only conversions the backend explicitly supports; otherwise it rejects the plan. Scaling support is also declared per pixel format. Changing pixel layout requires complete color metadata because YCbCr matrix and range affect how the stored values are encoded.

Scaling preserves the pixel format and color metadata of its input. Backends declare support separately for packed RGB and planar YCbCr because those layouts require different sampling and output-storage paths.

For RGB storage such as BGRA or half-float RGBA, matrix and range are retained for a later YCbCr conversion but do not change the RGB arithmetic. Primaries and transfer function define the pixel transform between RGB formats.

Camera log footage

Besides the display and HDR transfers, TransferFunction names the camera log encodings: ARRI LogC3 (with the exposure index it was shot at) and LogC4, Sony S-Log3, RED Log3G10, Canon Log 2 and Log 3, Panasonic V-Log, Blackmagic Film Generation 5, and Apple Log. ColorPrimaries names their gamuts: ARRI Wide Gamut 3 and 4, S-Gamut3 and S-Gamut3.Cine, REDWideGamutRGB, Cinema Gamut, V-Gamut, and Blackmagic Wide Gamut Generation 5. Every one of them is D65, so a change of primaries is one matrix, derived from each vendor’s chromaticities.

Sources rarely declare these, so an application usually supplies them. A backend that advertises log decoding accepts them as the input of a color conversion and never as an output. The conversion that linearises a frame decodes the curve and changes the primaries in the same pass, keeping values below 0 and above 1 when the output is linear half-float. Decoded values are relative scene exposure: an 18% grey card is 0.18.

TransferFunction::log_decode gives each curve’s parameters, so the backends’ shaders cannot disagree. Most curves are defined on the 0–1 signal a legal-range file stores from code 64 to 940. Sony and Panasonic define theirs on the 10-bit code over 1023, so a video-range S-Log3 or V-Log source is mapped back to its codes before the curve.

Showing scene-linear pictures on SDR displays

An SDR output encoded with Rec709 clips everything above reference white. Rec709ToneMapped is BT.709 with a highlight roll-off for showing scene-linear pictures, such as camera log footage: light up to 0.8 passes unchanged, and an extended Reinhard shoulder, continuous in slope, compresses 0.8 to 16 into 0.8 to 1 before the BT.709 curve. Reference white itself shows at 0.9. The roll-off runs per channel in the output’s primaries, inside the output conversion, so it costs no pass of its own. Files carry it tagged as BT.709. Its decode applies the exact inverse.

Aces2Rec709 is the ACES 2.0 output transform for SDR Rec.709 at 100 nits, encoded with BT.1886’s gamma 2.4: the film-like rendering ACES pipelines show camera footage with. Scene 0.18 shows at 10% of display white, reference white at about 46%, and display white is reached at 128 times reference white, with ACES’s chroma and gamut compression along the way. Its output primaries must be BT.709. The conversion’s matrix takes the input to AP1, adapted from D65 to ACES’s D60 with Bradford, and the encode runs the transform’s per-pixel steps: a colour appearance model’s lightness, colourfulness and hue, the tone scale, and gamut compression against hue tables of 362 entries. passtape-engine’s aces module ports the Academy’s reference, builds the tables once and lays every constant out as one array, which macOS reads as a generated program-scope constant array (aces_data.metal, kept current by a test) and the web reads as the conversion kernel’s buffer. Both match OpenColorIO 2.6 within 0.002 of a code value. Files carry it tagged as BT.709. Decoding it reads display light with gamma 2.4, not the scene it came from. The port is Apache-2.0 (crates/passtape-engine/LICENSE-ACES).

Data images

A data image holds numbers, not color: depth, motion vectors, object IDs or a lens map. It is stored in one of three data formats, R32Float, Rg32Float or Rgba32Float, and built with VideoFormat::data, which leaves the color metadata Unspecified and the alpha opaque. Color formats never hold data, and graph validation refuses a source whose data format declares color metadata or alpha.

A data image is its own media type at graph ports, MediaType::Data, as a mask is. A source whose format is a data format produces a data port, so a data image wired into a color operation, or a picture wired into a data input, fails when the graph is validated rather than when its pixels look wrong.

Preparation never converts into or out of a data format. No color conversion, alpha conversion, clamp or pixel-format change is inserted on a data value; an operation that would need one refuses the plan, and backends never advertise such a conversion. Data inputs reach their operation unchanged. A data input may require a number of channels, as an STMap needs two, and preparation refuses a narrower data format before any frame renders. Masks and data carry no color, so an operation’s working color metadata comes from its first picture input. Numbers become color only where an operation makes a picture of them: the data preview’s output, opaque, and the STMap warp’s and depth mask’s, with straight alpha, all in the linear working color, linear BT.2020, while their data inputs stay as stored.

A graph output of media type Data can be requested, and its value is read back unchanged, in its own data format. Asking for it in a color format is refused when the plan is prepared, since that would need a conversion out of data.

OpenEXR sources and export

Foxberry platform scope

Foxberry’s Mac editor and WebGPU timeline can read numbered EXR originals, including raw Z used by Depth Defocus. The web timeline resolves local frame maps or signed Drive frame URLs without substituting video proxies. Local changing-beauty/Z playback and backward seeking have a small correctness fixture; this is not a real-time or long-session qualification. Animated STMap correctness on this newly enabled web timeline path still needs separate qualification.

Web export and frame reads also accept numbered EXR originals. Local frames come from the captured frame map; cloud frames are signed from captured version IDs. Long exports refresh sequence URLs in place without changing frame numbers or versions, so active readers keep their source identity. A two-frame local and simulated-Drive test compares EXR output with native floats within the existing backend tolerance, including an explicit URL refresh after graph load. This does not qualify real Drive outages or long export sessions.

The web source viewer and non-WebGPU viewer still refuse sequence playback. EXR stills, static STMaps and offline EXR/map output remain available.

One shared codec

passtape-exr wraps vendored OpenEXRCore, built natively on macOS and Linux and into passtape-exr-wasm for browser Workers. These builds use the same layer selection, colour conversion and half-float rounding. OpenEXRCore is BSD-3-Clause and its libdeflate dependency is MIT, compatible with Passtape’s MIT licence.

The codec reads half and float channels in scanline and tiled files, including multiple parts and layers. Supported compressions are none, RLE, ZIPS, ZIP, PIZ, PXR24, B44, B44A, DWAA and DWAB. Deep data, HTJ2K, zstd, unsigned-integer channels and subsampled channels are unsupported. Luminance-chroma decoding is refused with a reason rather than interpreted as RGB.

The default layer is the first part’s unprefixed readable colour layer, otherwise the first readable colour layer, otherwise the first layer. Foxberry exposes the probed layers per footage item, so two items may read different passes from one asset. Choosing a Cryptomatte data layer exposes its values; selecting objects to build a Cryptomatte matte uses separate strict set reads. Native and browser Passtape sources support those reads for stills and sequences through persisted ID selections; Foxberry web retains the sequence restriction described above. Picking and name-selection controls are not yet available.

Colour, data and windows

Colour channels become premultiplied colour in Passtape’s linear BT.2020 working space: Rgba16Float for half channels and, on the Mac, Rgba32FloatColor for 32-bit float channels, so values beyond half’s 65504 survive for operations that read them. Rounding to half saturates at ±65504, and NaN and infinity in a file decode as 0 and ±65504. The source primaries come from the part’s chromaticities, with BT.709 when absent, or from the footage asset’s explicit linear override. ACEScg therefore converts from AP1 primaries; it is never treated as display-referred. Missing alpha is one. Negative values and highlights above one are preserved.

Data reads skip colour conversion and premultiplication. One channel uses R32Float, two use Rg32Float, and three or four use Rgba32Float, with an unused fourth channel zero. Half samples widen exactly. Layer reads use the layer’s channel order; raw reads select one to four named channels in a specified order, including from colour layers. Data previews convert these values only for viewing; depth mattes and STMaps consume the raw data.

An unprefixed R/G pair without B is one unnamed data layer, so two-channel STMaps can select both UV channels. Other unprefixed scalar channels remain separate layers; RGB(A) maps still select R/G as raw data from their colour layer.

The decoded surface covers the data window, including its origin. The display window defines the composition frame. Foxberry offsets the surface to align that frame and preserves the surrounding pixels through masks and effects, then crops where the item’s frame is drawn into its parent. A missing sequence frame produces transparent colour or zero ordinary data, never a neighbouring frame. Strict Cryptomatte reads instead fail with the source-frame diagnostic, so missing coverage cannot silently change the effect being masked.

macOS scheduling

EXR decompression runs on a process-wide Rayon pool sized to the available cores minus two, with at least one worker. Independent scanline chunks or tiles write straight into pooled IOSurface-backed pixel buffers. Metal reads that storage without a separate pixel upload.

Each sequence has a reader and scheduler, a 1.5 GiB decoded-frame budget, file reads four frames ahead and up to two frames decoding at once. On a seek the requested frame takes priority over look-ahead work. Cached requests return the existing surface; a cache miss may wait for the requested decode. Decompression itself runs off the UI and render threads. Stills decode once and register as static surfaces. These caches are separate from VideoToolbox’s video cache.

When requests skip frames, the native sequence stops speculative reads and decodes and trims its ring to the requested frame. Already running work finishes. An adjacent frame request restores normal look-ahead, including reverse playback. This keeps skipped-frame playback and scrubbing from competing with a large queue of future decodes; it does not guarantee realtime decoding.

Native Cryptomatte sources share one complete-set cache across every rank reader. Stills and sequence reservations share a 1 GiB provider rank budget. A sequence reserves up to two complete frames, reducing to one if necessary; a set that cannot fit one frame is refused. Removing only some rank registrations keeps the whole set’s reservation until its last reader is removed. The ordinary per-layer 1.5 GiB cache is not multiplied by the Cryptomatte rank count.

Each sequence frame must match the reference set’s parts, channels, data/display windows and pixel aspect, and pass full-float ID/coverage validation before any rank is published. Names may change without invalidating selected IDs. Uploads use private Metal textures and at most 128 rows of staging. Finite coverage above one is preserved; only conversion to an ordinary mask clamps it. Failed frames remain unavailable during preview and export. Seeks discard superseded decodes.

Strict sequence reads cap each compressed file at 1 GiB and read one pending frame ahead. This input cap and the rank reservation are separate limits, not a bound on total editor memory: compressed bytes, staging, beauty caches and frames retained by the engine also consume memory. Full-size sequence performance and peak residency remain unqualified.

Linux scheduling

Linux EXR sources use a background CPU worker per sequence and owner-thread Vulkan uploads. Ordinary color/raw sequences retain up to two decoded frames within 1 GiB, with one-frame look-ahead after adjacent forward or reverse requests. Zero substitution is an explicit preview option, not the export default.

LinuxSources::register_cryptomatte_sequence registers all ranks of one strict metadata-declared set together. It decodes one complete CPU set on demand without look-ahead, then uploads unpublished images using at most 128 rows of reusable staging per image. Every frame must preserve rank layout, windows and pixel aspect; manifest names may change. Failed frames never substitute zero coverage.

Stills and sequences share a 1 GiB GPU reservation; a sequence reserves two full sets for its current and replacement frame. CPU ranks, compressed input (separately capped at 1 GiB), codec scratch, staging and engine-retained outputs are additional memory. Files must remain immutable. Hosts call exr_sequence_control’s cancel_pending() alongside engine output cancellation: queued work is cleared, active decoding drains, and obsolete generations cannot publish. Provider destruction joins the worker. Synthetic 4096×2304 beauty/raw/strict export and source-turnover checks pass on RTX 4090; the Linux qualification record reports timing and process-memory observations. Real-footage throughput and long-running memory stability remain unqualified.

The Linux sequence tests passed on an RTX 4090 (driver 595.99.02), including ordinary color/raw frames, strict complete-set uploads across multiple staging bands, manifest changes, failure without substitution, seeks, mixed-frame rejection and partial engine-cache reuse. Cryptomatte provenance identifies the registration and immutable frame, so cached ranks can combine with reuploaded ranks from that same frame. These correctness fixtures do not measure full-size sequence playback throughput.

LinuxSources::remove(identity) releases one registration. A shared sequence keeps its worker and reservation until its last rank alias is removed; that last removal drains the worker. Stop dependent outputs first. Already returned surfaces remain valid, but reusing an identity for changed content requires discarding old prepared plans and engine caches.

Browser scheduling and Spools

A pool of at most eight decode Workers shares the compressed file and decoded output through SharedArrayBuffer. Each Worker owns a wasm codec instance and decodes a band of chunks. The engine uploads the resulting half-float or data buffer to a GPU texture. Frames enter the pool serially; each frame still decodes across all band Workers. Reusable, geometrically grown input and output buffers remain leased until every band answers. Workers never receive cached compressed buffers or caller-owned output buffers, avoiding retention of fresh backing stores in Worker heaps after source replacement. A successful decode copies exactly the frame bytes into the caller’s buffer; a failure leaves it unchanged. This adds one compressed-input copy and one full decoded-frame copy. Staging retains its largest capacity until the pool closes: a 4916×2592 RGBA half-float frame needs a 128 MiB output staging allocation, in addition to caller frames, input staging, codec memory and GPU textures. Overscan throughput and total peak-memory qualification remain open. The sequence reader retains two output slots, with file reads two frames ahead. Compressed frames have a 1 GiB cache budget, reduced to 128 MiB per reported GB on devices below 8 GB.

Cryptomatte uses a dedicated strict worker, sharing the codec and compressed-file cache rather than the ordinary full-frame decode pool. It transfers one complete set band of at most 128 rows at a time and waits for the GPU upload before decoding the next. Copies preserve raw float words. The engine publishes all rank textures together only after the final band validates and GPU error scopes confirm allocation and upload succeeded. Failed workers are recreated for the next frame request. Changed layouts, missing files and invalid coverage fail explicitly; manifest availability alone does not affect raw reads. Sequence reads are on demand, without decoded look-ahead.

The browser admits unpublished plus staged Cryptomatte rank textures against a shared 1 GiB limit, releasing sequence frames not needed by the current output before admission. Rank-budget and device texture-dimension checks precede compressed frame acquisition. It refuses worker inputs larger than 1 GiB and reuses one compressed-input shared buffer. These are separate bounds: file acquisition, compressed caches, wasm high-water memory, transfer/upload staging, engine pools, beauty and intermediates remain additional costs. Full-host peak memory and full-size playback throughput are not yet qualified.

During playback, skipped timeline frames stop extending speculative EXR read-ahead, so queued future frames do not keep competing with demanded frames. Already running work drains. Sequential delivery resumes the normal horizon; exports keep read-ahead throughout.

Foxberry imports local files immediately and uploads sequences into folders in Spools Drive. A remote sequence resolves frame versions to signed URLs in batches and caches bytes by version, so refreshing a URL does not discard them. The timeline marks cached spans and playback holds while an uncached frame is pending. Cached playback still depends on decode and render throughput; the cache does not promise real-time 4K playback. Spools generates display thumbnails through the shared codec with an sRGB conversion.

Scene-linear export

For backend-only Linux rendering, LinuxOutput::exr_part reads a completed output into a shared-codec scanline ZIP part. It accepts explicit data/display windows and channel names. Linear full-range RGBA16F keeps its primaries and is written with associated alpha; numeric R32F/RG32F/RGBA32F and R16F mask output bypass color processing. The caller owns metadata, compression selection, encoding and file publication. Numeric parts require lossless compression. Readback and planar assembly hold complete CPU frames; this adapter does not stream pixels to disk.

Foxberry’s EXR Sequence (half, PIZ) preset reads the composition back as linear BT.2020 half-float pixels, bypassing the display transform. It writes RGB or RGBA, with compression chosen from none, RLE, ZIPS, ZIP, PIZ and B44, starting at frame 1001. There is no audio. Data and display windows both cover the exported composition frame; source overscan is not exported. Eligible plate shot records, frame rate, pixel aspect and chromaticities are carried in the headers.

Native export overlaps rendering with writer threads, with two frames in flight, and publishes from a staging folder. Browser export uses the shared writer in the engine Worker, processing one frame through readback, encode and local file write before starting the next. A browser with directory-picker support creates a unique subfolder under the chosen parent. Failure or cancellation removes the partial folder; if cleanup fails, the error identifies the folder left behind. Browser export does not upload the output to Drive.

Verification and performance limits

pnpm --filter @general-motion/passtape-bench test:exr-parity compares 55 colour layers byte for byte between native decoding and one/eight browser Workers. The matrix covers all ten compressions, half/float, scanline/tiled storage, primaries, alpha, windows, parts and layers. It also compares opaque composition captures through the actual editors’ offscreen media-registration and rendering paths, plus standalone backend captures. Alpha is checked in decoded buffers and exercised through blending in the opaque renders. These are local-file checks, not Spools or UI automation tests.

The native sequence-source benchmark sustained 24 fps for 240-frame UHD PIZ, DWAA and ZIP sequences. Full editor playback with cold SSD reads and a Spools mount remains to be measured. Busy-machine browser measurements took 28–39 ms per 4K frame on eight Workers, with inconsistent playback over 48 frames; an idle-machine playback run is still needed.

Caching and Reuse

Editing is repetitive: the same graph is prepared after every small change, and the same frames are rendered after every scrub. The runtime therefore reuses work at several levels. Every level follows the same rules:

  • an entry is keyed by everything that can change its result, so an older entry can never satisfy a request it does not exactly match;
  • memory stores are byte- or entry-bounded and evict least-recently-used entries; the disk tier keeps expensive, frequently reused results;
  • reuse of media is opt-in per request, because retention costs memory, except for static values, which no time changes.

Intermediate values, static values and rendered outputs are named by a ResultIdentity. It is value-based: sources contribute their media facts, operations their kernel, version, parameter values and resource contents, and every result the identities of its inputs and its format. Graph IDs, node IDs, parameter and resource IDs and their change counters stay out, so the same work built in another graph or process has the same identity, and an edit changes the identity of the edited node and everything downstream of it, and nothing upstream. Every identity also names a reproducibility profile: the backend, the engine build and each pass’s implementation. A source rendered from a child graph, such as a compound clip or a freeze frame, is identified by a hash of that graph’s content. Identities are stable within one key-format version, which every key starts with, and are suitable for persistent storage.

File sources start uncacheable. A caller supplies with_content once it knows the file’s content fingerprint, including the selected stream or layer. The runtime identity still locates a decoder; it is separate from the content identity used to share rendered work. Unhashed or proxy sources remain uncacheable. Text uses its full graphic fingerprint; the document compiler enables caching for bundled fonts, whose bytes enter the engine build fingerprint, and leaves system-font text uncacheable.

The engine build fingerprint covers Passtape implementation sources, bundled fonts, manifests, compiler version, target features, optimization settings and the two local hosts’ dependency lockfiles. It is independent of checkout paths and build timestamps. The native configuration also includes the OS build and GPU identity in its profile.

Semantic analysis computes node identities before choosing backend passes. Preparation adds the chosen implementations and formats. Fused video passes retain the original steps’ identity facts, so removing intermediate surfaces does not rename the final result. Only materialised values enter the stores.

The levels, from cheapest to most complete:

semantic analysis     reuse graph validation and topology
prepared programs     reuse compiled pass instructions
decoded media         reuse decoder output
intermediate values   reuse unchanged upstream pass results
static values         reuse results no time changes, such as a still's work
rendered outputs      reuse complete frames and audio blocks

Semantic analysis

The runtime retains semantic analysis for the most recently prepared immutable graph snapshot. Preparing another output request from a clone of that snapshot reuses validation and topology analysis; request-specific lowering still selects formats and execution programs independently. Successfully analyzing a different snapshot replaces the cached analysis, even when the new snapshot has the same graph ID or version.

Prepared programs

Compiled video and audio pass instructions are retained separately. When a new graph snapshot keeps the same graph ID, routing, formats, backend implementations, and output requirements, preparation reuses those immutable instructions and only reconnects them to the new plan’s tables. Parameter values do not invalidate a prepared program because passes read the new plan’s parameter streams at execution time.

The runtime retains at most 256 prepared programs by default. Applications can change this entry limit with set_prepared_program_cache_capacity, inspect it with prepared_program_cache_stats, or release it with clear_prepared_program_cache.

Decoded media

Sequential run calls discard decoded history. Explicit video requests can retain decoded frames with with_decoded_frame_retention; explicit audio-block requests can use with_decoded_block_retention. Each runtime-owned store has its own byte budget and reuses only deterministic media that exactly matches the requested decoder settings and time or sample range. Callers can inspect or clear each store through the matching runtime methods. The decoded frame cache describes the video policy in detail.

Intermediate values

Explicit requests can retain deterministic intermediate pass results with with_intermediate_value_retention(IntermediateValueRetention::interactive()). This is useful after a graph edit: unchanged upstream work can be reused while changed downstream passes run again. A key is a pass’s result identity plus the time it was computed at. A neighbouring frame outside the current segment repeats the current frame, so a pass that reads neighbouring frames also includes the segment’s bounds, and so does everything downstream of it. Video and audio have separate byte-bounded stores, and sequential run calls bypass and clear them.

Static values

A static value is a pass result that no time changes, computed once and reused at every frame. Three kinds of pass qualify:

  • a source that is deterministic and stationary, such as a still image, a text graphic or one held frame of a file, and renders no nested program. Its identity and content revision name its pixels. Only sources the backend registers as deterministic qualify: the macOS backend’s images do, and its files when registered through deterministic_descriptor(revision), which the editor does for its media; file sources are otherwise never static, while the web backend’s stills do not yet, because the browser package uploads their pixels by file name outside the runtime’s source registration;
  • a conversion or gap over a static value;
  • a pass of an operation that declares time never changes its output, as the lens map, the STMap warp and the depth matte do, when it is deterministic, fuses no other operation, reads no neighbouring times, every parameter it reads is constant and every input is a static value. An operation that does not declare itself time-independent is never frozen, whatever its parameters, and a lens map with a keyframed coefficient runs at every time.

Only the frontier is kept: a static value read by a pass that runs every frame, by a tensor pass or by an output. A static value read only by other static values is interior. Once the frontier value is in the store, the frame executor’s pass selection, which runs only passes whose results the frame reads, never runs the interior, so a chain of conversions and operations over a still holds one value, not one per pass. A gap on the frontier is not kept either, since clearing a surface costs less than holding a full frame of nothing.

still ─ conversion ─ warp ─ (frontier) ─ per-frame composite ─ output
  interior, skipped once     kept           runs every frame
  the warp is stored

The frame executor keeps static values in its own store of 512 MiB (256 MiB in a browser), whatever intermediate retention a request asks for, so playback and sequential run calls through one runtime share them, and an export computes a still’s work once. Each runtime has its own store, so an editor’s preview and its export each hold up to that much GPU memory. Keys leave out the graph, the segment, the time and the node’s identity: operation, version, implementation, parameter values, resources, inputs and output format decide them, so the same work in another plan or segment is shared. A value enters the store once its frame is submitted, and an evicted value is computed again on its next use.

Any change to a runtime’s sources, through sources_mut, update_sources or clear_caches, drops every static value, since a source registered again under its identity may hold other pixels. static_video_value_stats reports activity and residency, clear_static_video_values releases them, and a backend reset clears them.

Rendered outputs

The runtime can retain completed deterministic video frames and audio blocks. Explicit requests opt in with with_requested_rendered_output_retention(RenderedOutputRetention::interactive()), and the latest-frame scheduler enables this policy by default. Complete sequential output does not fill this memory cache.

A video frame is keyed by its segment’s identity, which covers every output’s value and how it is materialised, plus the output index and time. An audio block is keyed by the identity of the value its output plays, its format and its exact sample range. Changing source content, parameters, implementations, output settings, backend, or engine build produces a different key, so an older result cannot satisfy the new request. Video and audio use independent stores. The interactive policy applies its 256 MiB budget to each enabled store, in addition to decoded-frame retention. Discard bypasses retained output without clearing older entries; callers can release those entries through the runtime’s rendered-output clear methods.

stats().rendered_outputs() reports combined activity and residency; the runtime also exposes separate video and audio cache snapshots.

Persistent native artifacts

The native editor and command-line renderer share a SQLite-indexed store under ~/Library/Application Support/General Motion/Render Artifacts. Set GM_RENDER_ARTIFACTS_DIR to use another directory; an empty override is an error. Runtime creation reports an inaccessible store instead of silently turning it off.

Memory lookup comes first, then disk, then execution. A complete-frame hit skips source decoding and GPU execution; an intermediate hit uploads the saved planes and resumes the downstream passes. Only deterministic values are eligible. Reduced-detail drafts are never persisted as full-quality outputs or intermediates. Scene models contribute verified packed-model hashes, independently of the keys used to load them; a scene containing an unhashed model is not reusable.

exact request → memory lookup → disk lookup → execute on a miss
                                              ↓
                                  bounded background readback
                                              ↓
                                  compress → publish → evict

The store retains rendered video outputs, float PCM audio blocks, and declared-expensive video intermediates, currently scenes and lens maps. Offline warming also measures each GPU pass batch and retains deterministic intermediates taking at least 2 ms. It isolates batches in separate command buffers to measure their GPU time; interactive playback keeps its usual submission strategy and can reuse these saved intermediates. Video payloads contain tight raw planes with format, color, alpha and the stored raster dimensions. Payloads use zstd with a checksum. Immutable files are published through temporary files; bucket leases coordinate readers, writers and eviction across processes. The index reserves an entry before its file is published, so interrupted writes cannot leave published bytes outside the budget. Corrupt compressed entries are removed and recomputed. The default disk budget is 20 GiB. The editor’s Storage settings offer 5, 20 or 100 GiB, applied on restart; every writer reads the saved shared budget during eviction. Eviction scores compute time, reuse and bytes rather than allowing a one-off export to displace expensive work solely by being newer.

The editor’s Free space action evicts unlocked disk artifacts without changing the shared budget. Objects leased by readers or writers are kept.

Cache-hit accounting uses a bounded background queue and may drop updates under contention; reading a cached frame never waits for a usage-index write.

Playback offers writes without waiting. Staging and the writer queue have byte limits; pressure drops writes, and rendering remains usable if persistence fails. Batch warming waits for writes and reports persistence errors or dropped writes instead of claiming completion. GPU readback waits on the submitted command on the writer thread. Runtime artifact statistics report hits, misses, bytes read and written, readback time, dropped writes and errors.

Animated lens preparation

The web player solves inverse lens tables in a helper worker, using the exact renderer parameters and output dimensions. Two-frame lookahead retains CPU results until needed; speculative uploads do not compete with the current frame’s GPU tables. The GPU cache protects the active frame’s tables, allowing its usual eight-entry limit to grow to that working set plus one fallback entry. It shrinks again when fewer tables are protected. Worker failures affect their request and allow a later retry. Static lens maps remain ordinary static values.

Decoded Frame Cache

Decoding a video frame is expensive. When an interactive caller requests the same part of a source again, Passtape can keep the decoded frame and reuse it instead of decoding it again.

For each requested source time:

  1. The runtime looks for a decoded frame that covers that time.
  2. If it finds one, it reuses the frame’s surface.
  3. Otherwise, the source provider decodes the frame and the runtime caches it.

A decoded frame includes the exact source-time range it covers. This matters because several requested times can refer to the same video frame.

Only sources marked SourceCachePolicy::Deterministic enter this cache. That policy promises that identity, content revision, source time, and decode settings fully determine the returned media. Live, procedural, or externally mutable sources should keep the default Never policy.

If deterministic media changes without receiving a new source identity, set a new VideoSource::with_content_revision value. Previously decoded frames then have a different cache identity and cannot be reused.

The cache is disabled by default. Interactive sessions enable it by selecting a retention policy:

let session = session.with_decoded_frame_retention(
    DecodedVideoFrameRetention::interactive(),
);

VideoFrameRequestScheduler uses the interactive policy by default.

The cache has a byte limit. When it reaches that limit, it removes the decoded frames that have gone unused for the longest time.

Changing source registration can change what an identity resolves to, so sources_mut() drops every retained frame. A video lane that changes only some sources can call update_sources(identities, update) instead. It drops frames only for the listed identities, which must include every source the update adds, removes, or replaces, and keeps the rest.

Temporal operations use a separate, preparation-bounded working set for the neighboring frames needed during execution. They do not raise this cache’s caller-selected byte limit.

The contracts are defined in src/video_frame/decoded.rs.

Video Frame Requests

Interactive output should render what the user wants now, not every frame requested on the way there. VideoFrameRequestScheduler therefore keeps only the newest pending graph time.

let scheduler = VideoFrameRequestScheduler::for_plan(session.plan());

// This handle can also be cloned into the UI thread.
scheduler.request_frame(timeline_time);

// The output owner supplies destination timing separately.
session.render_latest_request(&scheduler, presentation_time)?;

// Run look-ahead decoding only when no current request needs service.
session.prefetch_next_frames(&scheduler);

The output thread calls render_latest_request. If another request arrives while a decoder or GPU call is running, Passtape lets that synchronous call finish and discards the result at the next safe boundary. A request arriving while destination submission is already underway cannot undo that submission. The next request is then serviced before the method returns. The session also stops retrying a backpressured frame once that frame becomes obsolete. Drive the output session from a worker thread because decoding and backend execution are synchronous.

Discarding obsolete frames means a viewer shows nothing new while requests arrive faster than frames finish, as during continuous scrubbing. A viewer can opt in to presenting them after a quiet period:

let options = VideoFrameRequestOptions::for_runtime_budget(budget)
    .with_superseded_frames(SupersededFramePolicy::PresentAfter(interval));

An obsolete frame is then submitted only when nothing has been submitted for interval, and render_latest_request returns VideoFrameRequestStatus::SubmittedSuperseded with the newer request still pending. The default, SupersededFramePolicy::Discard, never submits one. A frame other than the one the caller asked for can therefore reach the destination. Destinations that identify frames by presentation time should call render_latest_request_at(&scheduler, |rendered| ...), which derives that time from the graph time actually rendered.

After submitting a frame, the worker can call prefetch_next_frames when idle to decode a small number of later source frames into the runtime’s byte-bounded decoded-frame store. A new request makes older prefetch work obsolete. Prefetch does not run video operations. It is best-effort: a failure is recorded in runtime statistics but does not turn an already displayed frame into an error.

Temporal operations already acquire their exact neighboring frames during normal rendering, using their separate preparation-bounded working set. Frame-request prefetch skips those segments.

The contracts are defined in src/runtime/frame_request.rs.

Output Control

Long-running output sessions can be cancelled and can report accepted work:

let cancellation = CancellationToken::new();
let cancel_handle = cancellation.clone();

// Give `cancel_handle` to the UI or coordinator. It can stop this session with:
// cancel_handle.cancel();

session.run_with_control(&cancellation, |progress| {
    if let Some(video) = progress.video_frames() {
        println!("{} / {} frames", video.completed(), video.total());
    }
})?;

CancellationToken is cheap to clone and safe to send to another thread. All clones share one signal. Cancellation cannot be reset, so each output session should use a new token.

OutputProgress reports video in frames and audio in sample frames. The totals come from the prepared timelines, and completed counts advance only after the destination accepts the media. Backpressure retries do not increase progress.

The progress callback runs on the output thread. It should return quickly and send any slower UI or logging work elsewhere.

Cancellation is checked between decoded frames or audio blocks and while a destination applies backpressure. Work already inside a synchronous decoder or backend call returns before cancellation is observed. The session then asks the destination to abandon its partial output and returns a Cancelled error. Destinations that can finalize asynchronously may also observe cancellation while finalization is in progress.

The contracts are defined in src/runtime/control.rs, and the session methods are defined in src/runtime.rs, src/runtime/audio_output.rs, and src/runtime/media_output.rs.

Runtime Statistics

MediaRuntime keeps cumulative statistics for the work it performs. Callers take snapshots between synchronous runtime operations:

let stats = runtime.stats();

println!("rendered {} video frames", stats.video().frames_rendered());
println!("submitted {} audio blocks", stats.audio().blocks_submitted());

The snapshot separates the main stages of the engine:

  • preparation counts analysis-cache hits and misses plus the outcomes of request-specific lowering (turning the analyzed graph into backend execution programs);
  • video counts source requests, rendered frames, accepted frames, and backpressure;
  • frame-request counts started requests, obsolete renders, and nearby-frame prefetch;
  • audio counts source requests, rendered and accepted blocks, sample frames, and backpressure;
  • output runs combine completed, cancelled, and failed video, audio, and audio/video calls to run or run_with_control;
  • prepared-program statistics report reused and rebuilt pass instructions, evictions, and current residency;
  • decoded-video and decoded-audio statistics report cache activity and current residency.

Counters are always active and use saturating arithmetic. Duration collection is disabled by default because reading a clock for every frame or audio block adds work to hot paths. It can be enabled when profiling:

runtime.reset_stats();
runtime.set_timing_collection_enabled(true);

Reset before enabling timing and leave it enabled for the complete measurement window when calculating averages from counters and durations. Counters remain active while timing is disabled, so enabling timing after work has already run makes durations cover only part of the counter window.

Video and audio source statistics are a subset of render statistics. Source durations measure provider calls, while render durations include source acquisition and backend execution. A provider failure therefore increments both source and render failures. A decoded-video or decoded-audio cache hit avoids the matching provider and does not increment source_requests.

Output run duration covers a complete run or run_with_control call, including destination backpressure and finalization. Manually driven sessions using render_frame, render_range, or finish do not contribute to output-run statistics.

reset_stats clears counters and durations without releasing the cached semantic plan, prepared programs, or decoded media. Prepared-program and decoded-media hit, miss, and eviction counters reset while their entries and capacities remain unchanged. It also preserves whether timing collection is enabled.

The public snapshot types are defined in src/runtime_stats.rs.

Platform Zero-copy Prototype

PROTOTYPE — throw this code away after it answers the question.

Question

Can Windows and Linux execute a GPU video operation between hardware decode and hardware encode without Passtape having to move frame pixels through CPU memory?

This probe uses FFmpeg only as disposable orchestration around the operating system GPU APIs. It is not a proposal to make FFmpeg a Passtape dependency.

The probe establishes an API-level zero-copy candidate when:

  • decoding produces hardware frames;
  • the effect consumes and produces hardware frames;
  • encoding directly accepts those hardware frames; and
  • the filter graph contains no hwdownload, hwupload, or software scaler.

That does not prove that a driver performs no internal GPU copy. Use PIX on Windows or a vendor GPU profiler on Linux to inspect resource history and copy engines while this probe runs.

Windows

Requirements:

  • Windows 10 or later;
  • a hardware H.264 decoder and encoder;
  • a recent FFmpeg build containing d3d11va, scale_d3d11, and h264_mf;
  • Python 3.11 or later.

Run from the repository root:

python crates/passtape/prototypes/platform-zero-copy/probe.py windows C:\path\to\input.mp4

The probe verifies the expected Ryzen 5 5600G host, discovers the installed display adapters, then selects the GeForce RTX 3060 by PCI vendor ID (0x10de). It requires exactly one NVIDIA adapter so that vendor selection is unambiguous, and fails rather than silently using the AMD iGPU or another machine. The candidate path is:

D3D11VA decode -> ID3D11Texture2D -> scale_d3d11 -> ID3D11Texture2D -> Media Foundation H.264 encode

Capture the process in PIX and verify that Media Foundation uses the same RTX 3060, that the frame does not visit a CPU-visible upload/readback heap, and that no unexpected copy pass occurs at API boundaries.

Linux

Requirements:

  • a VA-API-capable GPU and driver;
  • Vulkan support for the same physical GPU;
  • a recent FFmpeg build containing vaapi, vulkan, scale_vulkan, and h264_vaapi;
  • Python 3.11 or later.

Run from the repository root:

python3 crates/passtape/prototypes/platform-zero-copy/probe.py linux /path/to/input.mp4

The probe verifies the expected Ryzen 5 5600G host, discovers every DRM render node, and selects its integrated AMD GPU by PCI vendor ID (0x1002). Automatic selection requires exactly one AMD render node; an explicit override is checked against the discovered device. It sets LIBVA_DRIVER_NAME=radeonsi, verifies H.264 encode support with vainfo, and derives the Vulkan device from that exact VA-API device. This prevents an accidental AMD-to-NVIDIA frame transfer.

Override automatic selection when necessary:

python3 crates/passtape/prototypes/platform-zero-copy/probe.py linux \
  /path/to/input.mp4 --render-node /dev/dri/renderD129

The candidate path is:

VA-API decode -> DMA-BUF mapping -> Vulkan scale -> DMA-BUF mapping -> VA-API H.264 encode

The current Linux probe intentionally rejects the NVIDIA adapter. NVIDIA’s Linux path requires a separate NVDEC/Vulkan/NVENC prototype because its VA-API compatibility driver does not support encoding.

Use the profiler for the installed driver (Intel GPA, Radeon GPU Profiler, or Nsight Systems) to check copy-engine activity and Vulkan image transitions.

Output

The probe prints one JSON report containing the discovered CPU, GPU devices, selected device, and media capabilities. verdict has one of these values:

  • api-level-zero-copy-candidate: the entire command completed with hardware frames and no explicit software transfer;
  • unsupported: the installed FFmpeg build or GPU lacks a required capability;
  • failed: the path exists but failed while processing the supplied media.

Use --frames to change the bounded run length. Use --dry-run on any platform to inspect the generated command without executing it.

WGSL compilation probe

The pipeline probes deliberately use native FFmpeg filters first, separating surface interoperability from shader-language translation. Compile the included WGSL operation into the two native shader formats with:

cargo run --manifest-path \
  crates/passtape/prototypes/platform-zero-copy/kernel-compiler/Cargo.toml -- \
  crates/passtape/prototypes/platform-zero-copy/invert.wgsl \
  /tmp/passtape-platform-kernels

This produces:

  • invert.hlsl, suitable for a Direct3D compute pipeline after compilation to DXBC/DXIL; and
  • invert.spv, suitable for a Vulkan compute pipeline.

The compiler is MIT/Apache-2.0 licensed Naga. It does not introduce a GPU runtime or surface abstraction, so choosing WGSL as source does not itself add a frame copy. This translation-only probe uses ordinary RGBA storage textures; a production backend must separately validate how native multi-plane NV12 surfaces are viewed or adapted for these bindings without a copy.

Glossary

Short definitions of the recurring terms in this document. Passtape-specific terms link to the chapter that explains them.

  • Backend — the platform-specific half of the engine. It implements the execution contracts (decode, passes, output) with native APIs such as Metal and VideoToolbox, while the graph stays platform-neutral.
  • Backpressure — a full downstream stage (encoder, container, display) pausing upstream work so queues and memory stay bounded.
  • Cadence — the frame timing of an output: which timestamps it expects and at what rate.
  • Container — the file format (MOV, MP4, M4A, …) that holds encoded video, audio, and text tracks. Writing packets into it is muxing; reading them out is demuxing.
  • Data image — an image of numbers, not color, such as depth, an STMap or object IDs, stored in a 32-bit float data format and never color-converted. See Video color metadata.
  • Demanded output — a graph output that the execution request actually asks for. Preparation starts from demanded outputs and drops unused work.
  • Graph time vs. source time — graph time is the timeline position of the composition; source time is the position inside one media file. Trimming selects the visible graph range; retiming maps it back to source time.
  • Keyframe (codec) — a compressed frame that is a complete image. Frames between keyframes are stored as differences and require prior decoding. Unrelated to a keyframe (parameter), a timed value on an animation curve.
  • Lowering — the request-specific part of preparation: turning the analyzed graph into concrete formats and backend execution programs.
  • LUFS / dBTP — the units of measured loudness and true peak. See Loudness normalization.
  • Pass — one prepared unit of execution: a graph operation or an inserted conversion, with its inputs, parameters, and result.
  • Pass tape — the ordered list of passes a backend follows for every frame in a segment. See Pass tapes.
  • PCM — uncompressed audio samples. Planar storage keeps each channel in its own array; interleaved storage alternates channels sample by sample.
  • Preparation — the compiler-like stage between graph and execution: validation, implementation selection, format resolution, and pass-tape compilation. See How Passtape works.
  • Premultiplied alpha — color channels stored already multiplied by their alpha value, so compositing blends with a single multiply-add.
  • Sample frame — one audio sample across all channels; 48 kHz audio has 48,000 sample frames per second.
  • Segment — a timeline range where the active sources and operations stay the same. See Video segments.
  • Static value — a pass result no time changes, such as the work over a still image, computed once and reused at every frame. See Caching and reuse.
  • STMap — a data image whose first two channels give, for each output pixel, the source position to read, in Nuke’s convention.
  • Surface — GPU-resident pixel storage, such as a Metal texture or a Core Video pixel buffer. See Surface planning.
  • Value — one logical frame result inside a pass tape: a decoded source frame or an intermediate produced by a pass.
  • Working format — the pixel format and color interpretation an operation computes in; preparation inserts conversions to and from it.
  • YCbCr / chroma subsampling — the luma-plus-color-difference encoding most codecs use. 4:2:0 and 4:2:2 store color at reduced resolution because eyes resolve brightness more finely than color.
  • Zero-copy — moving a frame from decode through effects to encode or display without copying its pixels through CPU memory.