|
Description
SceneDetector is a powerful COM component for scene recognition and scene processing. It incorporates award-winning HandySaw DS technologies for extremely accurate and fast optical scene recognition.
In contrast to HandySaw DS it is oriented to software companies and developers who wants extend their products.
SceneDetector object processes video file and returns list of found scenes. Also it can save thumbnails for eash scene and it can inform caller application immediately about each new found scene via callback interfaces during processing.
Main features
- Detects scenes almost in any video file that can be played by Windows Media Player
- Fast and accurate algorithm
- Easy integration
- Reports new scene right after it defined, during processing. It is not needed to wait detection finish
- Can generate thumbnails - first and last frames images for each scene and save them in BMP or JPG files
- It is possible to specify source, splitter and video decoder filters to use during processing
- Can detect "white" and "black" scenes
Demo version and price
Contact me.
Documentation
Data types
sdScenesMergeKind enum
Used to give instructions what to do with short scenes.
typedef enum tagsdScenesMergeKind
{
| sdMergeDelete = 0, |
Short scene removed |
| sdMergeWithPrev = 1, |
Short scene merged with previous |
| sdMergeWithNext = 2, |
Short scene merged with next |
| sdMergeWithBoth = 3 |
Short (middle), previous and next scenes merged into one single scene |
} sdScenesMergeKind;
DetectorParameters structure
This structure contains scene detection engine parameters.
typedef struct tagDetectorParameters
{
| BSTR VideoFileName; |
Full video file name for detection. |
| int Threshold; |
Detection threshold value.
Recommended default 19.
Can be from 0 to 255.
This parameter is the main.
When difference of two frames is larger then this value, new scene begin.
Thus: lower Threshold - more scenes. |
| int UpLumaTresh; |
Used in "white fadeouts" detection.
Recommended default -1.
Can be from -1 to 255.
"-1" disables this feature.
When overall frame brighness is larger then this value, new scene begin.
Whith this feature it is possible to define sequence of such bright frames as separate scene. |
| int BottomLumaTresh; |
Used in "black fadeouts" detection.
Recommended default -1.
Can be from -1 to 255.
"-1" disables this feature.
When overall frame brighness is less then this value, new scene begin.
Whith this feature it is possible to define sequence of such dark frames as separate scene. |
| int MinSceneLength; |
Sets a minimum duration of a detected scene (in frames).
Recommended default 5.
Can be from 0 to any positive value.
If length of the defined scene is less than this value, this scene merged with previous, next or both scenes, according to Merge field value(see below). |
| int RegisterGraph; |
Control registration of internal processing graph in
he Running Object Table(ROT).
Can be 1(register in ROT) or 0(does not register). |
| BSTR SourceFilterMoniker; |
Display name of the desired source filter moniker used in the internal processing graph.
If NULL - default filter used. |
| BSTR SplitterFilterMoniker; |
Display name of the desired splitter filter moniker used in the internal processing graph.
If NULL - default filter used. |
| BSTR DecoderFilterMoniker; |
Display name of the desired decoder filter moniker used in the internal processing graph.
If NULL - default filter used. |
| sdScenesMergeKind Merge; |
When scene length is less then MinSceneLength, scene modified according to value of this parameter. |
} DetectorParameters;
ThumbnailsParameters structure
This structure contains thumbnails generation parameters.
typedef struct tagThumbnailsParameters
{
| int JpegFormat; |
Select file format. 0 - generate BMP files, 1 - generate JPEG files. |
| int JpegQuality; |
JPEG compression quality. Integer from 0 to 100. |
| int ImagesPerScene; |
Images per scene number. 1 - only start frame, 2 - start and end frames of each scene. |
| double Scale; |
Thumbnail scaling factor. 1 - fullsize picture. Floating point value. |
| BSTR FileName; |
Thumbnails filenames template. String for "C" "printf" function with one integer field.
For example: "d:\filedir\filename%05d.jpg"
You must specify full pathname with proper extension. Frame number will be inserted instead of %d symbols to obtain file name for specific thumbnail. |
} ThumbnailsParameters;
ISceneDetector interface
This interface provides methods for scene detection:
DetectScenesInFile method
| HRESULT _stdcall DetectScenesInFile([in] DetectorParameters * Params, [in] ThumbnailsParameters * ThumbnailsParams, [out] SAFEARRAY(long) * Scenes ); |
This main scene detection method.
Pass detection parameters in Params and pointer to SAFEARRAY in Scenes.
If Scenes is NULL function does not return detected scenes list.
Caller does not need to create SafeArray before calling this method.
If Scenes is not NULL and after function call *Scenes is not NULL too caller must destroy *Scenes SafeArray.
Pass non NULL pointer as ThumbnailsParams to turn on thumbnails generation and specify it's parameters. Pass NULL to disable thumbnail generation.
Returns an HRESULT value. Possible values include the following:
| 0 |
Success |
| 0x80040601 |
Unspecified error |
| 0x80040602 |
DirectShow is not installed or version is too old |
| 0x80040603 |
Cannot obtain video duration. May be still image |
| 0x80040604 |
Bad argument |
| 0x80040605 |
Cannot create device context |
| 0x80040606 |
Object is busy with another task |
| 0x80040607 |
Framerate equals zero. May be still image |
| 0x80040608 |
Cannot build graph |
ISceneDetectorEvents events interface
This events interface provides methods for retrieving scene detection info in real time fashion.
NewScene method
| HRESULT NewScene([in] long SceneIndex, [in] long Start, [in] long Stop ); |
Event fired by detector when new scene defined.
SceneIndex starts from 0.
Start and Stop also starts from 0 and are frame numbers.
Status method
| HRESULT Status([in] long ScenesFound, [in] long CurrentFrame, [in] long TotalFrames, [out] long * AbortProcess ); |
Event fired every 50 ms and informs client about process status.
AbortProcess is pointer to variable. Thus client can set *AbortProcess to 1 value to cancel current scene detection.
|