try
{
int timeScale = mov.getTimeScale();
int begin = (int)Math.floor(start * timeScale);
int finish = (int)Math.floor(end * timeScale);
Pict oldPic = mov.getPict(begin);
this.cache = chopFrame(oldPic);
// get the first visual track from mov
Track visualTrack = mov.getIndTrackType(1,
StdQTConstants.visualMediaCharacteristic,
StdQTConstants.movieTrackCharacteristic);
mov.setTime(new TimeRecord(timeScale, (int) begin));
Boolean go = true;
int lastTime = 0;
while (go)
{
// user terminated execution
if (Thread.interrupted())
{
throw new SchemeException(new Pair(), null, null);
} // if (Thread.interrupted())
// find next frame
TimeInfo ti = visualTrack.getNextInterestingTime(
StdQTConstants.nextTimeMediaSample, mov.getTime(), 1);
// if looped to earlier frame or finished selected section
if ((lastTime > ti.time) || (ti.time >= finish))
{
go = false;
} // if ((lastTime > ti.time) || (ti.time >= finish))
else
{
mov.setTime(new TimeRecord(timeScale, ti.time));
Pict newPic = mov.getPict(mov.getTime());
float score = frameDifference(newPic);
if ((score > this.threshold)
&& (mov.getTime() - this.lastCut
> this.blockRange * mov.getTimeScale()))
{