简体   繁体   中英

How do I get the TOTAL NUMBER of FRAME of a Video file?

How do I get the TOTAL NUMBER OF FRAME of a Video file? I'm developing Video Velocity Meter Software That compute the average velocity of a moving object in a video but the problem is I can't figure out how to get the TotalNumberOfFrame of specific video.

Formula:

Total time= ObjectFrameRate (f/s) * (1/ TotalNumberOfFrame)

AveVelocity=Displacement/TotalTime

A solution would be to use the "Dexter 1.0 TypeLib". You need to add a reference to it first. It's found under the COM objects (the lib is by MS). Then you could use this code:

string filePath = "C:\\testVideo.avi";
MediaDet md = new MediaDetClass(); 
md.Filename = filePath; 
md.CurrentStream = 0;
double FrameRate = md.FrameRate;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM