Class KeyFrameDetectorBlock
- Assembly
- VisioForge.Core.dll
Key frame detector block for automatic identification and analysis of significant video frames. This block analyzes video content to detect key frames (I-frames) and scene changes using advanced computer vision algorithms. Features real-time detection, configurable sensitivity, JSON export functionality, and event-driven notifications for each detected key frame. Essential for video indexing, thumbnail generation, scene analysis, content summarization, and automated video editing applications requiring frame-level precision. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class KeyFrameDetectorBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
KeyFrameDetectorBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.KeyFrameDetectorBlock class with default key frame detection settings.
public KeyFrameDetectorBlock()Fields
TAG
Logging tag used to identify log messages from this key frame detector block.
protected const string TAG = "KeyFrameDetectorBlock"Field Value
Properties
Input
Gets the input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
JSONFilename
Gets or sets the JSON filename to export detected key frame timestamps. When specified, all detected key frame timecodes will be saved to this file for post-processing analysis and video indexing.
public string JSONFilename { get; set; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Constructs and initializes the key frame detector and its associated GStreamer elements. This method creates the detector element, establishes input and output pads, configures JSON export if specified, and prepares the block for real-time key frame detection and scene change analysis.
public override bool Build()Returns
- bool
-
trueif the detector was successfully built and configured;falseif initialization failed.
CleanUp()
Releases all resources and performs cleanup operations for this key frame detector block. This method disposes of the GStreamer elements and resets the build state.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper. Note: This detector returns null as it operates differently from standard filter elements.
public BaseElement GetCore()Returns
- BaseElement
-
Always returns null for this detector type.
GetElement()
Gets the underlying GStreamer element that performs the key frame detection.
public Element GetElement()Returns
- Element
-
The GStreamer Element instance representing the key frame detector.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this key frame detector block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance that will manage this block.
OnKeyFrameDetected
This event occurs whenever a new key frame is detected in the video stream. Provides real-time notification with precise timestamp information for immediate processing or UI updates during key frame analysis.
public event EventHandler<TimeSpan> OnKeyFrameDetected