[英]How to get frames count of a video file with EmguCV?
我正在使用以下代码从视频文件中获取所有帧。 但是,当我为示例视频运行代码时, double FramesCount
为1402402
并在第467
号帧上弹出错误。
PS:我认为实际帧数约为〜467,因为视频文件只有15秒(15秒* 30fps =〜450帧)
_capture = new Capture(OpenFile.FileName);
FramesCount = (int)_capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_COUNT);
for(int i = 0; i < FramesCount - 1; i++)
{
FramesArray.Add(_capture.QueryGrayFrame().Resize(ImageWidth, ImageHeight, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR));
}
如何获得确切的帧数?
该代码:
int framecount = (int)Math.Floor(capt.GetCaptureProperty(CapProp.FrameCount)); //get count of frames
double framerate = capt.GetCaptureProperty(CapProp.Fps); //get fps
如果仍然有用,对我来说很好。 我喜欢21,6666667秒的视频,它返回的帧数正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.