Interface DetectScenesOptions

Options for a detectScenes call.

At minimum, a frames async iterable must be provided. All other options are optional and map to SceneDetectorConfig fields.

interface DetectScenesOptions {
    frames: AsyncIterable<Frame, any, any>;
    methods?: SceneDetectionMethod[];
    hardCutThreshold?: number;
    gradualThreshold?: number;
    minSceneDurationSec?: number;
    clipProvider?: "local" | "openai";
}

Properties

frames: AsyncIterable<Frame, any, any>

Async iterable of decoded video frames in time order. Each frame must contain a raw RGB pixel buffer, a timestamp, and a sequential index.

methods?: SceneDetectionMethod[]

Detection methods to use. Multiple methods are combined by taking the maximum diff score across all methods.

Default

['histogram', 'ssim']
hardCutThreshold?: number

Diff score threshold above which a frame transition is classified as a hard cut. Applied to histogram chi-squared distance (0-1).

Default

0.3
gradualThreshold?: number

Diff score threshold for gradual transitions (dissolves, fades). Transitions with scores between this and hardCutThreshold are classified as gradual cuts.

Default

0.15
minSceneDurationSec?: number

Minimum scene duration in seconds. Scene boundaries that would create scenes shorter than this are suppressed.

Default

1.0
clipProvider?: "local" | "openai"

CLIP embedding provider for semantic scene detection. Only used when methods includes 'clip'.

Default

'local'