Click here to Skip to main content
15,867,686 members
Articles / Desktop Programming / MFC
Article

Capture Live Video from various Video Devices.

Rate me:
Please Sign up or sign in to vote.
4.72/5 (62 votes)
20 May 2004CPOL2 min read 745K   45.1K   206   201
LiveVideo is an application to capture live video from various video capture devices.

Sample Image - LiveVideo.jpg

Introduction

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);

Where 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.

Important:

Don’t forget to uninitialize the Video by using UnInitializeVideo() before destroying your application.

Requirements:

  • 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.

Conclusion

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
Hi Friends.,

I am DILLIP working as a Software Engineer in South Korea .

My Hobbies:

Listening to Music, Net Browsing , watching TV..

Comments and Discussions

 
GeneralRe: Compilererrors Pin
Anonymous1-Dec-04 13:19
Anonymous1-Dec-04 13:19 
Generalwmstub.lib Pin
Member 64430923-Sep-04 17:48
Member 64430923-Sep-04 17:48 
GeneralYour program is quite good! Pin
ntha827-Sep-04 23:18
ntha827-Sep-04 23:18 
GeneralWMStub.lib Pin
Ziv Cohen2-Sep-04 1:50
Ziv Cohen2-Sep-04 1:50 
GeneralRe: WMStub.lib Pin
jerry0davis3-Sep-04 4:15
jerry0davis3-Sep-04 4:15 
GeneralWMStub.lib Pin
Anonymous2-Sep-04 1:49
Anonymous2-Sep-04 1:49 
GeneralCompilererror C2146 and C1004 Pin
Andyman11-Aug-04 22:45
Andyman11-Aug-04 22:45 
GeneralRe: Compilererror C2146 and C1004 Pin
ericvk14-Sep-04 3:04
ericvk14-Sep-04 3:04 
GeneralLiveVidio - Cann't compile Pin
Shlomo29-Jul-04 23:39
Shlomo29-Jul-04 23:39 
GeneralRe: LiveVidio - Cann't compile Pin
typke18-Aug-04 21:02
typke18-Aug-04 21:02 
GeneralAudio Pin
Klaus Kurt6-Jul-04 20:33
Klaus Kurt6-Jul-04 20:33 
QuestionCan we access to captured image data to process it? Pin
Behzad Ebrahimi2-Jul-04 21:50
Behzad Ebrahimi2-Jul-04 21:50 
Generalwmstub.lib Pin
Anonymous20-Jun-04 6:38
Anonymous20-Jun-04 6:38 
GeneralRe: wmstub.lib Pin
Dillip Kumar Kara22-Jun-04 18:28
Dillip Kumar Kara22-Jun-04 18:28 
GeneralRe: wmstub.lib Pin
Anonymous22-Sep-04 23:26
Anonymous22-Sep-04 23:26 
GeneralRe: wmstub.lib Pin
johnny@john.com13-Nov-04 18:21
johnny@john.com13-Nov-04 18:21 
GeneralRe: wmstub.lib Pin
Anonymous23-Nov-04 17:05
Anonymous23-Nov-04 17:05 
Generalsave picture Pin
tibi8230-May-04 21:28
tibi8230-May-04 21:28 
GeneralRe: save picture Pin
Vitaly Tomilov20-Oct-04 0:28
Vitaly Tomilov20-Oct-04 0:28 
GeneralRe: save picture Pin
Anonymous17-Apr-05 22:31
Anonymous17-Apr-05 22:31 
GeneralRe: save picture Pin
Vitaly Tomilov17-Apr-05 23:40
Vitaly Tomilov17-Apr-05 23:40 
Generaldoes not work Pin
tibi8228-May-04 7:01
tibi8228-May-04 7:01 
GeneralRe: does not work Pin
Dillip Kumar Kara28-May-04 14:17
Dillip Kumar Kara28-May-04 14:17 
GeneralRe: does not work Pin
Georgi Petrov13-Oct-04 5:06
Georgi Petrov13-Oct-04 5:06 
Generalthis looks nice but ... Pin
Maximilien21-May-04 7:34
Maximilien21-May-04 7:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.