This is an attempt to create an application which captures Live video from a Video capture device and USB attached WebCam all together in the same application. While developing my project, I needed to capture the video from various video devices including TV. Though, I found some source for capturing Video, it was not so efficient. So, that prompted me to develop my own independent application. Initially, “LiveVideo” detects the availability of the Video Capture card and whether WebCam is attached or not. Otherwise, it shows the message. Most of the API functions are used from DirectX SDK.
Steps to Use
- Create a Dialog based application.
- Insert a Picture control of size 320x240 pixel.
- In the properties of the Picture control, set
TYPE as ‘Rectangle’ and
COLOR as ‘Black’.
- Add the files “CaptureVideo.cpp” and “CaptureDevice.h” to your project.
- Add “CaptureVide.h” into your implementation header file.
- Create an Object of the class “
CCaptureVideo” using Class wizard.
- Link the libraries strmbasd.lib, wmvcore.lib, wmstub.lib in your project settings.
Now, using the object, invoke
InitializeVideo(HWND hWnd) function to initialize the video.
HRESULT hr = capVideo.InitializeVideo(hWnd);
hWnd is the window handle of the picture control.
StartSVideo() - To start capturing from SVideo.
StartCompositeVideo() - To start capturing from Composite Video.
StartTVTuner() - To start capturing from TVTuner.
StartWebcam() - To start capturing from WebCam.
Don’t forget to uninitialize the Video by using
UnInitializeVideo() before destroying your application.
- Video Capture card. I’ve tested with “WinFast TV2000 XP WDM Video Capture” card. Hope it will work with all video capture cards.
- USB Cam.
- You need to install DirectX, which is available freely from Microsoft. You can download DirectX 9.0 from Microsoft.
- For development, install DirectX 9.0 SDK. You can download DirectX 9.0 SDK from Microsoft.
I hope this article is of some use to you. I would add Configuration settings of the Video features and Video quality in my next version. Feel free to use these classes as you like. Any comments or improvements would be appreciated.