Skip to main content

rskit_media/ops/
scene_detect.rs

1//! Configuration types for the `DetectScenes` operation.
2
3use serde::{Deserialize, Serialize};
4
5/// Configuration for scene boundary detection.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct SceneDetectConfig {
8    /// Scene change threshold (0.0–1.0). Lower values detect more scene changes. Default: 0.3.
9    pub threshold: f32,
10    /// Minimum duration in seconds between detected scenes.
11    pub min_scene_duration: f64,
12    /// Detection algorithm to use.
13    pub method: SceneDetectMethod,
14}
15
16impl Default for SceneDetectConfig {
17    fn default() -> Self {
18        Self {
19            threshold: 0.3,
20            min_scene_duration: 1.0,
21            method: SceneDetectMethod::ContentAware,
22        }
23    }
24}
25
26/// Scene detection algorithm.
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
28#[non_exhaustive]
29pub enum SceneDetectMethod {
30    /// Content-aware detection using perceptual hashing.
31    ContentAware,
32    /// Simple threshold-based detection on pixel differences.
33    Threshold,
34}