[英]What's the fastest way to get a video frame count in MATLAB?
Paging through a video with 1423 frames (192X1080 resolution) consumed 63 seconds using this code: 使用以下代码在具有1423帧(192X1080分辨率)的视频中分页花费了63秒:
vidObj = VideoReader(videoname);
nFrames = 0;
while hasFrame(vidObj)
readFrame(vidObj);
nFrames = nFrames + 1;
end
Loading the same video returned a frame count in a mere 4 seconds. 加载相同的视频仅需4秒钟即可返回帧计数。
How can the video frame counting be sped-up? 如何加快视频帧计数?
All you have to do is fetch the NumberOfFrames
property from the VideoReader
object: 您所要做的就是从VideoReader
对象获取NumberOfFrames
属性 :
vidObj = VideoReader(videoname);
nFrames = vidObj.NumberOfFrames;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.