MATLAB Answers


Capture from Multiple Webcams

Asked by Greg
on 21 Apr 2011
Latest activity Answered by Chamil Ranathunga on 30 Aug 2015

Hi everyone, I am trying to use the Image Acquisition Toolbox to capture images from six webcams at the same time. The problem I am having is that only five actually work in MATLAB, even though all six will preview at the same time in other webcam programs. Is there a way to get MATLAB to use MJPEG instead of YUY2? The cameras do support MJPEG, which uses considerably less bandwidth, but it does not show up in matlab.

I am on windows 7 x64, with 12 gb of RAM. The CPU usage is below 30% with all cameras previewing. Are there any limitation I don't know about that would cause only 5 to work at a time? Maybe matlab is limiting memory or cpu usage, even though I have plenty? Any suggestions?



Hi Greg...I want to connect more than two webcams and take real time video using them..Can you please suggest me the way how I can do this? How the devices can be synchronized?

I am on Windows 7(32 bit), with 4GB RAM. I am using LogiTech Quick Cam/Go and Logitech C120. Please suggest. Thank you.

Hey greg im facing the same problem as Mr.Chakraborty. Using a PCI usb card, I was able to acquire video from 4 cameras on my desktop but on my laptop, I cant seem to get video from more than 2 cameras. I tried a usb hub as well but it wont let me get video from more than 2 cameras though it shows all the four cameras on the image acquisition tool box. can u help?

Hello, I am not able to connect more than 1 camera to the image acquisition blocks from simulink. It is not even getting recognized. can you please suggest what I should be doing. I am using a Windows 7 PC with 16 GB RAM and 2013 a matlab version

Log in to comment.

4 Answers

Answer by David Tarkowski on 22 Apr 2011

The most likely issue is that you are running into bandwidth limitations somewhere on your PC. My first thought was that it was a USB bandwidth limitation, but if you are able to acquire from five cameras simultaneously, I would guess that you are using at least two or three USB root controllers. This would mean that the culprit is likely not the USB bus, but the bridge between the USB controllers and the rest of the PC. If that is the case, there isn't too much that you can do. If you use an PCIe expansion card like this one (just the first example that I found) that might work, but that is really just a hunch.

We don't generally support JPEG compression from cameras since JPEG is a lossy compression method. This means that data is lost and the returned images are not true representations of the data that was captured by the camera. I can look into adding that in for a future version of the toolbox, but I'll have to think about it.


Thanks David,
I do have 2 USB root controllers. The problem is, in TinCam, which is just a simple webcam viewer that supports multiple webcams, I can view all six cameras simultaneously. While in Matlab, 5 cameras will stream fine, and when I preview the sixth, it will show just the first frame and nothing else. Same resolution/FPS/everything. Why?
I understand JPEG is lossy, but I think its best to give the customer the option!
Thanks again


The issue is almost certainly the lack of JPEG compression in the toolbox. TinCam is probably using the JPEG compression which uses significantly less bandwidth.

Hey im facing the same problem. Using a PCI usb card, I was able to acquire video from 4 cameras on my desktop but on my laptop, I cant seem to get video from more than 2 cameras. I tried a usb hub as well but it wont let me get video from more than 2 cameras though it shows all the four cameras on the image acquisition tool box. can u help? and can u please tell me about the usb root controller thing?
I am working on a core i3 with 3gb ram and 64bit windows 7 ultimate.

Log in to comment.

Answer by Mark Jones on 28 Apr 2011

When all 6 are plugged in, do all 6 at least show up using IMAQHWINFO?

Is it always the same camera that is not accessible and if so, is this camera accessible from MATLAB when it is the only camera plugged in?


Yes, they do: AdaptorDllName: 'C:\Program Files\MATLAB\R2010b\toolbox\imaq\imaqadaptors\win64\mwwinvideoimaq.dll' AdaptorDllVersion: '4.0 (R2010b)' AdaptorName: 'winvideo' DeviceIDs: {[1] [2] [3] [4] [5] [6] [7]} DeviceInfo: [1x7 struct]

(The 7th is a Novel-H9D camera that is not plugged in)

It is always the 6th camera that I start that does not work. If I then stop all of the others, it will work by itself. It definitely seems like a bandwidth issue, but it is curious that 6 work in TinCam, but 5 in Matlab.

i am also facing the same problem, but i am able to run 3 webcam only.Please guide me to take image from 6 webcam for image processing. I am running Matlab R2011b version on 64bit 4gb ram window 7 pc.

I am working on stereovision. I want to acquire images simultaneously from 2 Logitech webcams connected via USB ports. But I am getting the images with a long delay. How can I reduce the delay between the two captures or make the 2 cams trigger simultaneously?

Log in to comment.

Answer by Tunc Askan on 3 Sep 2014

Here is my case, may be it helps the community ;).

  • 16 Logitech HD 920 Webcams running at 15 fps, Full HD, RGB > ~90 MBs data flow per webcam
  • Motherboard with Intel X79 Chipset, 64 GB RAM
  • Windows 7 64 Bit
  • Matlab R2013b & R2014a

Matlab image engine is not able to transfer the acquired video data (nearly 1.4 GBs for my case) directly to HDD during the capture, even if you use SSDs with enough bandwidth (source: Matlab Support). So, if you want to capture frame synchronized videos you need let whole data flow to RAM during the capture. Here is important to check the specs of your motherboard, chipset, USB host controllers etc. in order to avoid a bottleneck (check chipset diagrams). I'm using in my case 3 extra USB host controllers (<>) and two host controllers on the motherboard (bandwidth limited!). And the most important thing is to use the Microsoft USB Webcam driver, not the driver of the webcam! My experience is, you are not able to control the frame rate and capture synchronized through imaq when you don' t use Microsoft drivers. Below you can find an image, which shows the trigger times for 16 webcams.

  1 Comment

I am trying to record videos using two logitech c170 webcam at 15fps each. But I am unable to do so. Can you help me with this.

Windows 7 64 Bit

Matlab R2014a

I am using laptop which has 4GB RAM

Log in to comment.

Answer by Chamil Ranathunga on 30 Aug 2015

Remove your logitec webcam softwares .Only keep the drivers .then it will work


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!