Working with multiple cameras
Top  Previous  Next

In general, interfacing to multiple cameras is as easy as dropping a few ActiveDcam objects on the surface of your application.

1. Start by creating a new project. Depending on the development environment you are using, refer to one of the following chapters for more details:
Visual Basic
Visual C++
VB.NET
Visual C#

2. Configure each ActiveDcam object for a different camera by clicking a corresponding ActiveDcam window and modifying the Camera property. Do not configure different ActiveDcam objects for the same camera. Multiple instances of ActiveDcam cannot acquire video from the same camera. For the same reason, if you run several ActiveDcam-based applications, make sure that each of them connects to a different camera.

3. Add FrameAcquired event handlers per each ActiveDcam object following the procedure for your language environment. Due to the multithreading nature of ActiveDcam, they will not interfere with each other.

4. Add the acquisition command for each ActiveDcam object to initiate the video streaming. In VB.NET you might have the following lines in your code:

AxActiveDcam1.Acquire = True
AxActiveDcam2.Acquire = True
AxActiveDcam3.Acquire = True

5. If you want to process the situation when a camera is being plugged or unplugged, add CameraPlugged and CameraUnplugged events to your code.

6. For more information refer to the code of MultiDcam and PlugUnplug samples.


The same general rules apply if you use DirectShow. You can run several instances of the Video Capture Source Filter in your system or in your application, provided each instance is connected to a different camera. If you execute several copies of a DirectShow-based video capture application such as Microsoft's Amcap, each of them will attempt to automatically configure itself for a different camera and memorize corresponding camera settings in the system registry upon exiting. The same automatic configuration routine will apply to multiple instances of the Video Capture Source Filter running in one application. For more information refer to DirectShow Programming Reference.