Video Cut Detector
This is a simple command line tool to analyse a video file and output a list of (probable) locations of cuts (shot-changes) in the video.
Getting StartedYou can find the cut detector itself in /Sketches/MH/Video/CutDetector in the trunk of the subversion repository.
Running CutDetector.pyRun ShotChangeDetector.py from the command line and you'll get usage information:
So for example, if you run it with the following command line:
> ./ShotChangeDetector.py myvideofile.avi
Then as the cut detector runs, XML listing the frame numbers of where probably cuts (shot changes) have been detected will be sent to standard output, for example:
<?xml version="1.0" encoding="ISO-8859-1"?>
The cuts are listed by frame number, starting from zero for the first frame.
The 'confidence' value is the confidence the algorithm has that what was detected actually is a shot change. It is basically a measure of how much the picture suddenly changed. The higher the value, the more likely it is to be a cut.
Sensitivity ThresholdYou can specify the threshold value used for shot change detection. The default is 0.9, meaning that any possible cuts with a confidence value of less than 0.9 are not output. Sensible values are probably about 0.75 or greater. The cut detector will not accept values less than or equal to zero.
Specify the threshold as a floating point value immediately before the video filename, for example:
> ./ShotChangeDetector.py 0.85 myvideofile.avi
The best choice of threshold value will vary depending of the type of video content. The best way to choose is to experiment. Using 0.9 as the starting point for this is probably a good idea.
Displaying the videoYou can optionally ask to be shown the video live (without sound unfortunately!) as the cut detection takes place. Use the --show command line option to do this. For example:
> ./ShotChangeDetector.py --show myvideofile.aviThe video will be rate limited to 25fps, irrespective of the actual frame rate of the video. Detected cuts will be sent to standard output as usual.
Bear in mind that becuase the detection algorithm needs to compare multiple frames, the detected cuts will be output several frames after they were detected - do not expect them to be displayed the moment the shot change happens in the displayed video!
-- Matt, April 2007
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved