MPEG SDK --> MpegAnalyzer
An MpegAnalyzer analyzes an MPEG video for events and transitions.
The sensitivity of the analysis can be controlled by setting the sensitivity of the algorithms between 0.0 and 1.0 for least to highest sensitivity.
The Clip resulting from the analyze() function contains location and type of each transition or event detected. This clip can be summarized with the function summarizeClip() into a FrameList which contains one frame per point of interest. The summarizing process can be controlled by setting attributes to remove black frames, frames that are too close together, etc.
FrameList's can be saved as a HTML file that shows thumbnail images for each frame in the list. The attributes of the HTML file can be set using the setHTMLAttributes function. Attributes include number of columns, thumbnail size, title, description and footer.
MpegAnalyzer
~MpegAnalyzer
analyze
getSensitivity
howBlack
isBlack
saveToHTML
setHTMLAttributes
setSensitivity
setSummaryAttributes
summarizeClip
If a MIN_DIST or MAX_DIST distance between frames is given, then
if frame[i+1] - frame[i] < min_dist => frame[i+1] is removed
public MpegAnalyzer ( string filename ) ;
Constructor. Construct an MpegAnalyzer for the specified file.
public ~ MpegAnalyzer ( ) ;
Destructor.
public void setSensitivity ( float sensitivity ) ;
Set the sensitivity of the algorithm. Sensitivity values range between 0 and 1. [0..1].
public float getSensitivity ( ) const ;
Return the current sensitivity setting for the analyzer.
public void analyze ( Clip & clip ,
unsigned int types = VSegType :: CUT ,
Clip :: CallBack cb = 0 ,
void * clientData = 0 ) ;
Perform the analysis of the frames within the video segment specified by the Clip for the current file. If Clip already contains results from previous analysis, the new results will be concatenated with the old ones.
One or more transition/event type can be detected by or'ing the corresponding VSegType, e.g.
analyze(clip, VSegType::CUT | VSegType::DISSOLVE);
| clip | specifies the start and end frame to search |
| types | what type of transition or events to search for |
public bool isBlack ( int frame ,
float threshold = 0 . 20) ) ;
Determine whether a frame is black.
A frame is black if the maximum pixel value is below the specified threshold and the contrast is also low.
| threshold | a value between 0.0 and 1.0 |
public float howBlack ( int frame ) ;
Returns how black a frame is.
How black is calculated on the maximum pixel value and the contrast level.
Returns a value between 0.0 and 1.0
public bool setSummaryAttributes ( SummaryAttribute attr ,
string param = "" ) ;
Set Clip summary attributes.
public void summarizeClip ( const Clip & clip ,
FrameList & frame_list ,
Clip :: CallBack cb = 0 ,
void * clientData = 0 ) ;
Convert a clip into a frame list by using the middle frame of each transition, and the first and last frame of each event in the clip. These frames are then culled according to the SummaryAttributes.
If a MIN_DIST or MAX_DIST distance between frames is given, then
if frame[i+1] - frame[i] < min_dist => frame[i+1] is removedif frame[i+1] - frame[i] > max_dist + min_dist => frame (frame[i] + max_dist) is added.
If REMOVE_BLACK is specified, then frames of the given percentage black are removed.
If REMOVE_SIMILAR is specified, then if adjacent frames are sufficiently similar, the later frame is removed.
public bool setHTMLAttributes ( HTMLAttribute attr ,
string param = "" ) ;
Set HTML page summary attributes.
public void saveToHTML ( const char * pathname ,
const FrameList & list ,
Clip :: CallBack cb = 0 ,
void * clientData = 0 ) ;
Save the FrameList to a HTML format. The HTML page contains thumbnail images of all the frames in the FrameList.
| pathname | is the complete pathname of the html file |
| list | is the FrameList of frames to store. |
| callback | function, returns percentage complete as int. |
| clientData | data to pass to cb |
Click here to return to the top of the page.