Click here to Skip to main content
15,880,796 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 747.9K   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

 
GeneralCompilation Error: ICaptureGraphBuilder2 Pin
Anonymous28-Nov-04 5:38
Anonymous28-Nov-04 5:38 
GeneralRe: Compilation Error: ICaptureGraphBuilder2 Pin
Vitaly Tomilov29-Nov-04 22:28
Vitaly Tomilov29-Nov-04 22:28 
GeneralRe: Compilation Error: ICaptureGraphBuilder2 Pin
JayDoggett2-Mar-05 6:57
JayDoggett2-Mar-05 6:57 
GeneralRe: Compilation Error: ICaptureGraphBuilder2 Pin
Vitaly Tomilov2-Mar-05 7:12
Vitaly Tomilov2-Mar-05 7:12 
GeneralRe: Compilation Error: ICaptureGraphBuilder2 Pin
Anonymous1-Dec-04 13:22
Anonymous1-Dec-04 13:22 
GeneralRe: Compilation Error: ICaptureGraphBuilder2 Pin
Vitaly Tomilov6-Dec-04 23:15
Vitaly Tomilov6-Dec-04 23:15 
General"Eyetoy" style program. Pin
chis7728-Nov-04 5:06
chis7728-Nov-04 5:06 
GeneralI can not build it Pin
panda_w@21cn.com23-Nov-04 17:32
panda_w@21cn.com23-Nov-04 17:32 
GeneralRe: I can not build it Pin
panda_w@21cn.com24-Nov-04 15:47
panda_w@21cn.com24-Nov-04 15:47 
GeneralRe: I can not build it Pin
Vitaly Tomilov29-Nov-04 22:32
Vitaly Tomilov29-Nov-04 22:32 
GeneralPlease Send wmstub.lib Pin
Anonymous23-Nov-04 17:08
Anonymous23-Nov-04 17:08 
GeneralRe: Please Send wmstub.lib Pin
Member 15602262-Dec-04 1:25
Member 15602262-Dec-04 1:25 
GeneralBusiness Pin
Dr. Pastor27-Oct-04 11:18
Dr. Pastor27-Oct-04 11:18 
GeneralRe: Business Pin
Dillip Kumar Kara27-Oct-04 15:35
Dillip Kumar Kara27-Oct-04 15:35 
GeneralTV Tuner problems Pin
Georgi Petrov24-Oct-04 21:34
Georgi Petrov24-Oct-04 21:34 
GeneralRe: TV Tuner problems Pin
Dillip Kumar Kara27-Oct-04 15:37
Dillip Kumar Kara27-Oct-04 15:37 
Generalerr : Couldn't render capture stream. The device may already be in use. Pin
RontchDev16-Oct-04 14:53
RontchDev16-Oct-04 14:53 
GeneralRe: err : Couldn't render capture stream. The device may already be in use. Pin
Georgi Petrov18-Oct-04 6:25
Georgi Petrov18-Oct-04 6:25 
QuestionTurbo Best program!!! 600x800? Pin
Georgi Petrov15-Oct-04 4:34
Georgi Petrov15-Oct-04 4:34 
GeneralCaptureDevice.h Pin
Georgi Petrov13-Oct-04 2:53
Georgi Petrov13-Oct-04 2:53 
GeneralSAVING the Capture Image Pin
RontchDev9-Oct-04 2:26
RontchDev9-Oct-04 2:26 
GeneralRe: SAVING the Capture Image Pin
Vitaly Tomilov20-Oct-04 0:27
Vitaly Tomilov20-Oct-04 0:27 
GeneralRe: SAVING the Capture Image Pin
Anonymous17-Apr-05 22:30
Anonymous17-Apr-05 22:30 
GeneralRe: SAVING the Capture Image Pin
Vitaly@accesscontrol.ie17-Apr-05 23:33
sussVitaly@accesscontrol.ie17-Apr-05 23:33 
GeneralCompilererrors Pin
schnupfen8-Oct-04 4:45
schnupfen8-Oct-04 4:45 

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.