multiple webcams

hi wonderful people of openframeworks! I just found your codebase and it looks perfect!

I’m tyring to get mulitple webcam running using the movieGrabberExample file. I just added another ofVideoGrabber, but I get an error it can’t connect pins. I’m using 2 identical Trust 1400T webcams which do work both when I just use 1 ofVideoGrabber instance.

Does someone know why? and how I can fix this?

Here is my code:

  
  
#include "testApp.h"  
  
  
  
  
  
//--------------------------------------------------------------  
void testApp::setup(){  
  
	camWidth 		= 320;	// try to grab at this size.  
	camHeight 		= 240;  
  
	vidGrabber.setVerbose(true);  
	vidGrabber.listDevices();  
	vidGrabber.setDeviceID(0);  
    vidGrabber.initGrabber(camWidth,camHeight);  
  
    vidGrabber2.setVerbose(true);  
	vidGrabber2.setDeviceID(1);  
    vidGrabber2.initGrabber(camWidth,camHeight);  
	//vidGrabber.videoSettings();  
  
  
  
	videoInverted 	= new unsigned char[camWidth*camHeight*3];  
	videoTexture.allocate(camWidth,camHeight, GL_RGB);  
  
}  
  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
	ofBackground(100,100,100);  
  
	vidGrabber.grabFrame();  
    vidGrabber2.grabFrame();  
    vidGrabber2.isFrameNew();  
	if (vidGrabber.isFrameNew()){  
		int totalPixels = camWidth*camHeight*3;  
		unsigned char * pixels = vidGrabber.getPixels();  
		for (int i = 0; i < totalPixels; i++){  
			videoInverted[i] = 255 - pixels[i];  
		}  
		videoTexture.loadData(videoInverted, camWidth,camHeight, GL_RGB);  
	}  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	ofSetColor(0xffffff);  
	vidGrabber.draw(20,20);  
	vidGrabber2.draw(400,420);  
	videoTexture.draw(20+camWidth,20,camWidth,camHeight);  
}  
  
  
//--------------------------------------------------------------  
void testApp::keyPressed  (int key){  
  
	// in fullscreen mode, on a pc at least, the  
	// first time video settings the come up  
	// they come up *under* the fullscreen window  
	// use alt-tab to navigate to the settings  
	// window. we are working on a fix for this...  
  
	if (key == 's' || key == 'S'){  
		vidGrabber.videoSettings();  
	}  
  
  
}  
  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(){  
  
}  
  

Hi there,

I bought a couple of different webcams and I have some nice results.

I’m using:

  • Trust WB-1400T (works on Mac with macam <-- google “macam webcam”)
  • Logitech Quickcam Connect
  • Microsoft Lifecam VX-1000 (works great under Vista, not tested on Mac)

Though strangely, one of the streams is always very slow… (randomly).

Greetings Roxlu

actually there is a pretty active community here - we just don’t always have the same setup as you and not every question gets answered on the first pass – especially hardware ones. be patient and friendly :slight_smile:

very important question: what platform are you on? it’s hard to tell with your question. that will help people answer for sure…

if it’s windows. theo, who wrote the videoinput library that OF uses on windows will be back online in a few days an he may have some ideas about how to debug. One thing to note is that if you are on a pc, try “amCap” to test the hardware and on a mac, try hackTv (and I can’t remember off the top of my head what to try in linux). about multiple cameras there are other folks on the forum who have more experience who could jump in, but I know it has been done. One thing to be very careful is maxing out the throughput on your usb ports, if you use, for example, two cameras hooked into a hub, etc…

take care,
zach

[quote author=“roxlu”]Hi there,
Though strangely, one of the streams is always very slow… (randomly).
[/quote]

maybe its because you don’t have enough usb bandwidth. I had a similair problem in another problem, and there i could manually decrease the bandwidth for the cam, and that solved it. That was with videoglide for mac.

Thanks! I’ll try it.