Video capture devices

Prev

Next

 






































































































Video capture devices overview.

Description


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 ("Microsoft DV Camera and VCR - Sony DV VCR Camcorder DV")


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, this may be useful if the current settings shows 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 ("devicepnpusbvid046dpid0826mi02739103c9a0000265e8773d-8f56-11d0-a3b9-00a0c9223196globalHD 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 by 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 prevent the complexity of having to manage the shifted indexes of the video captures 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 in 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.

You can retrieve current the state of any video capture devices (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 anv VID identifiers of the USB video capture devices are included in the VideoDevicesId list that has the same number of items than the VideoDevices list (the number of items returned by VideoDevicesCount)

You can 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 USB you will find the "pid..." and "vid..." in the string returned.

WDM vs VFW drivers
More information here.



See Also
WDM drivers TOnDeviceArrivalOrRemoval AutoConnectRelatedPins CurrentFrameRate DeliveredFrames DroppedFrames FixFlickerOrBlackCapture IsDVDevice IsVideoControlAvailable IsVideoCrossbarAvailable IsVideoDeviceConnected IsWDMVideoDriver OnDeviceArrivalOrRemoval OnDeviceLost OnNoVideoDevices OnVideoDeviceSelected RefreshDevicesAndCompressorsLists ResetVideoDeviceSettings ShowDialog VideoDevice VideoDeviceIndex VideoDeviceIndexFromId VideoDeviceName VideoDevices VideoDevicesCount VideoDevicesId WebcamStillCaptureButton