Need to iterate through an array faster
6 views (last 30 days)
I'm currently reading frames from one video and writing them to another, I have a huge bottleneck in my for loop.
vidObj = VideoReader('inputVideo.wmv');
outputVideo = VideoWriter('outputVideo.avi');
outputVideo.FrameRate = 24;
%Change FrameRate without changing video length
numberFrames=vidObj.Duration * vidObjB.FrameRate;
Is there a way to pass Frames directly without indexing? Python allows you to do 'for item in list....' is there something in matlab that does the same?
OCDER on 29 Jan 2019
Do not use read. Use readFrame instead, since read will re-read everything from beginning to end.
i = 1;
i = i + 1;
If that doesn't work, are you using a solid state hard drive, or a spinning magnetic hard drive? The SSD might speed things up as this could be a read/write speed issue. Otherwise the compression/decompression could be the slow step.