Skip to content

Video capture devices

Selecting a video capture device. First of all, set VideoSource = vs_VideoCaptureDevice to select the video capture devices as video source.

Then select the current video capture device by assigning the VideoDevice property, which is an index in the VideoDevices property, that contains VideoDevicesCount items.

It is possible to select the video capture device programmatically by its name (as it appears in the VideoDevices list), e.g.:

VideoGrabber.VideoDevice = VideoGrabber.VideoDeviceIndex ("Logitech HD Pro Webcam C920")

The name of the current video capture device is reported by VideoDeviceName.

When a video capture device is selected, its device-dependent properties are reloaded from the registry and the OnVideoDeviceSelected event occurs.

Note: these registry settings can be reset to their default values by invoking ResetVideoDeviceSettings while the component is inactive. This is rarely needed, but may be useful if the current settings result in a black video.
Identifying the video capture device by its hardware identifier (instead of its manufacturer's name)
When using several video capture devices of the same brand and model that can't be distinguished in the VideoDevices list, use VideoDeviceIndexFromId that returns the index of the device in the VideoDevicesId list.

E.g.:

VideoGrabber.VideoDevice = VideoGrabber.VideoDeviceIndexFromId ("devicepnpusbvid046dpid0826mi02739103c9a00002{65e8773d-8f56-11d0-a3b9-00a0c9223196}globalHD Webcam C525R");

Connecting/disconnecting a video capture device
When a video capture device is connected or disconnected, the OnDeviceArrivalOrRemoval event occurs. This event reports the name and index of the video capture device in the VideoDevices list.
After the video capture device has been disconnected, IsVideoDeviceConnected returns true, until the device is reconnected.
If the related device is used for preview or recording, the OnDeviceLost event occurs when the device is disconnected, and the preview or recording stops.

When a video capture device is disconnected, it is not removed from the VideoDevices list, in order to avoid the complexity of having to manage the shifted indexes of the video capture devices whose indexes are above the index of the device currently removed (because VideoDevice selects the current video device in the VideoDevices list).

When TVideoGrabber is running, the rules are the following:

  1. when a device is turned on, the device is added at the bottom of the VideoDevices list. The OnDeviceArrivalOrRemoval event occurs. Its IsDeviceArrival parameter reports "true", and its DeviceIndex parameter reports the index of the video device added to the list.

  2. when a device is turned off, the device remains in the VideoDevices list. The OnDeviceArrivalOrRemoval event occurs. Its IsDeviceArrival parameter reports "false", and its DeviceIndex parameter reports the index of the video device turned off.

  3. if a device turned off (case 2. above) is turned on again, the VideoDevices list does not change. The OnDeviceArrivalOrRemoval event occurs. Its IsDeviceArrival parameter reports "true", and its DeviceIndex parameter reports the index the video device had when it was turned off.

It is possible to retrieve the current state of any video capture device (connected or not) by testing IsVideoDeviceConnected (DeviceIndex).

E.g. IsVideoDeviceConnected (3) will return "true" if the device having the index 3 in the VideoDevices list is active and "false" if the device has been turned off.

PID and VID identifiers of USB video capture devices
The PID and VID identifiers of the USB video capture devices are included in the VideoDevicesId list that has the same number of items as the VideoDevices list (the number of items returned by VideoDevicesCount )

It is possible to retrieve them as follows:

  • assign the VideoDevicesId list to a StringList (e.g. IdList)
  • read the IdList[VideoGrabber.VideoDevice] string value
  • if the device is a USB device, you will find the "pid..." and "vid..." in the string returned.

WDM vs VFW drivers. More information here.

PointGrey cameras
The PointGreyConfig function makes it possible to configure the Pointgrey cameras using the PointGrey FlyStream driver.