[futurebasic] Quicktime frames

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2002 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Wed, 6 Nov 2002 05:32:32 -0400
I am going bonkers trying to get a good estimate of a movies frames from Quicktime movies using MPEG.

with a 50 second movie that is actually about 2400 frames, I get a sample count of just 6 from  GetMediaSampleCount. That figures somehow, I think this movie was assembled from 5-6 clips. But otherwise, its nuts. 


The below gives a frame count of 35110!!!

Works for other movies just fine. This is a corruption of some Apple code that gives the same result using GetTrackNextInterestingTime.


rc

Al Staff, you gotta know this.. :) Help.

Local FN CountVideoSamples(theMovie as long)
DIM as OSErr myErr
DIM as long myCount,TimeValue
DIM as Short myFlags
DIM as OSType myTypes(1)
myErr = 0
myCount = 0
TimeValue = -1 // _kBogusStartingTime// a bogus starting time

myFlags    = _nextTimeMediaSample + _nextTimeEdgeOK // we want the first sample in the movie
myTypes(0) = _VisualMediaCharacteristic // we want video samples

inc(myCount) // First frame
GetMovieNextInterestingTime(theMovie,myFlags, 1, myTypes(0),0,FN Long2Fix(1),@TimeValue, =_nil)
myErr = FN GetMoviesError

long if myErr = _NoErr

myErr = FN GetMoviesError
if myErr then Exit FN

myFlags    = _nextTimeStep // we want the next frame in the movie's media
myTypes(0) = _VisualMediaCharacteristic // we want video samples

While gTimeValue& >= 0
GetMovieNextInterestingTime(theMovie, myFlags, 1, myTypes(0),TimeValue, FN long2fix(1), @TimeValue, =_nil)
myErr = FN GetMoviesError
if myErr then exit FN
long if  TimeValue < 0 OR TimeValue > FN GetMovieDuration(theMovie)
TimeValue = -1
Xelse
inc(myCount)
End if
wend

End if

end FN = myCount