Handling large AVI videos
Show older comments
Im using MATLAB R2010b with Core2Duo 2.1GHz & 3 GB RAM. I need to analyse AVI videos frame-by-frame. Im using AVIREAD but it let's me read videos only upto 15 sec or 2-3 MB. How can I read larger videos into Frames ?
Answers (2)
Jiro Doke
on 7 Apr 2011
You say you need to analyze the video "frame-by-frame". That seems to indicate that you don't need to store all of the frames in memory at once. You can just do the processing one frame at a time and clear it as you move on to the next frame.
vid = VideoReader('video.avi');
for iFrame = 1:vid.NumberOfFrames
frame = read(vid, iFrame);
%
% analyze the frame
%
end
Walter Roberson
on 6 Apr 2011
0 votes
2 - 3 Mb ? Ummm, how big are your frames and what frame rate are you using? I estimate 15 seconds at being roughly 400 megabyte at 24 frames per second of 768 x 512 with 3 bytes per pixel.
5 Comments
Viraj Lad
on 7 Apr 2011
Walter Roberson
on 7 Apr 2011
What frame rates are the files? 20 seconds of 640 x 480 at 24 frames per second would exceed 400 megabytes.
Compression can have great deal to do with the size, especially if large portions of the background are static.
Are you using the 32 bit version of Matlab for Windows? If so then at the point where you would do the reading of the file, insert a call to memory() http://www.mathworks.com/help/techdoc/ref/memory.html to find out how much free memory you have available.
Viraj Lad
on 7 Apr 2011
Walter Roberson
on 7 Apr 2011
What does aviinfo() return for the file?
Walter Roberson
on 7 Apr 2011
Also, to cross-check, did you invoke memory() at the command prompt, or did you put the call in right at the place the file would be read? To me the values look like what would be returned at the command prompt (unless your program did almost nothing before trying to read the file.)
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!