videoreader reads frames very slowly. how can I improve it?

4 次查看(过去 30 天)
I have a movie, and selected list of frames (called frameNums) I want to read.
I tried reading them like this :
VR=VideoReader(aviFilename)
for t = 1:numel(frameNums)
currFrameNum = frameNums(t)
VR.read(currFrameNum)
%do something%
end
but this does not read the exact current frame at some of my movies (a probelm which sevral of others already noticed). so I switched to this:
VR=VideoReader(aviFilename)
videoFrameCount=0
for t = 1:numel(frameNums)
currFrameNum = frameNums(t)
while (hasFrame(VR) && (currFrameNum~=videoFrameCount))
CurrFrame = readFrame(VR);
videoFrameCount=videoFrameCount+1;
end
%do something%
end
which works out great, but if my first frame number is really big (like 22533) it takes forever to read the frame, and I cant work like that.
any tips of how to improve this?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by