If MS had granted we lowly VB users all the power of DirectShow, you'd be
able to use IMediaSeeking::SetTimeFormat to set the time format to frames
and then read the duration. Unfortunately, though, we only get to use the
IMediaPosition object, its corresponding Duration property, and the
AvgTimePerFrame property of the IBasicVideo object. Maybe one day they'll
let us grow up and give us real toys to play with.
Enough ranting already. I basically do this:
dblOneFrame = objBasicVideo.AvgTimePerFrame
dblFrameRT = objMediaPosition.Duration / dblOneFrame
There's intrinsic repetition here, though: the AvgTimePerFrame property has
clearly gone through similar calculations already (how can you calculate the
average duration of a frame without first knowing the length of the video
and number of frames within it?), only to become part of another calculation
to give us what it already knew!
Quote:
> Hi all,
> I want to user DirectX to get the duration of AVI file
> in Frame not in Second. Is any body can help me?