These memory issues are occurring essentially because images are being captured faster than the machine can encode them with the selected AVI codec and write them to disk. As such, after a period of time, the frame memory buffer overflows.
One option to work around this issue is to reduce the resolution size of the data you are capturing. For a list of the resolution formats supported by your camera, enter the following at the MATLAB Command Prompt:
a = imaqhwinfo('winvideo',1)
a.SupportedFormats
Another option is to use a different codec to compress the AVI-file data, which may ultimately result in less data being written to disk. Note that caution must be taken if this option is used, because most codecs are not designed for real-time compression As such, they may have difficulty "keeping up" with the frame rate. Because of this issue, it is often helpful to use no AVI compression at all.
For information on setting a different codec with your AVI-file, enter the following at the MATLAB command prompt:
Best Answer