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

4 views (last 30 days)
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?

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!