Click here to Skip to main content
15,887,027 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 750.3K   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: save a picture Pin
shayirli12-Jun-05 1:31
shayirli12-Jun-05 1:31 
GeneralVideo GRabber Access Violation Problem Pin
badal_akr12-Apr-05 18:59
badal_akr12-Apr-05 18:59 
GeneralRe: Video GRabber Access Violation Problem Pin
Vitaly Tomilov9-May-05 0:47
Vitaly Tomilov9-May-05 0:47 
GeneralVideo GRabber Access Violation Problem Pin
badal_akr12-Apr-05 18:56
badal_akr12-Apr-05 18:56 
GeneralResolution Pin
Georgi Petrov2-Mar-05 9:51
Georgi Petrov2-Mar-05 9:51 
GeneralRe: Resolution Pin
Vitaly Tomilov9-May-05 0:50
Vitaly Tomilov9-May-05 0:50 
GeneralHelp to capture and save images and video Pin
ipenalosa1-Mar-05 6:05
ipenalosa1-Mar-05 6:05 
GeneralRe: Help to capture and save images and video Pin
Georgi Petrov2-Mar-05 9:52
Georgi Petrov2-Mar-05 9:52 
GeneralRe: Help to capture and save images and video Pin
Georgi Petrov29-Mar-05 21:16
Georgi Petrov29-Mar-05 21:16 
GeneralRe: Help to capture and save images and video Pin
Anonymous17-Apr-05 22:37
Anonymous17-Apr-05 22:37 
GeneralRe: Help to capture and save images and video Pin
mmartind17-Apr-05 22:45
mmartind17-Apr-05 22:45 
GeneralWhy the extra libs in demo and resolution Pin
Lonnie16-Jan-05 17:04
Lonnie16-Jan-05 17:04 
GeneralRe: Why the extra libs in demo and resolution Pin
Vitaly Tomilov12-Feb-05 2:26
Vitaly Tomilov12-Feb-05 2:26 
GeneralCapture from multiple inputs on same device Pin
HughJampton14-Jan-05 10:02
HughJampton14-Jan-05 10:02 
GeneralRe: Capture from multiple inputs on same device Pin
Vitaly Tomilov12-Feb-05 2:40
Vitaly Tomilov12-Feb-05 2:40 
Generalwere it is capturedevice.h Pin
ipenalosa12-Jan-05 0:20
ipenalosa12-Jan-05 0:20 
GeneralRe: were it is capturedevice.h Pin
HughJampton14-Jan-05 10:00
HughJampton14-Jan-05 10:00 
GeneralCannot compile Pin
ICEric2-Jan-05 22:33
ICEric2-Jan-05 22:33 
GeneralRe: Cannot compile Pin
Vitaly Tomilov12-Feb-05 2:44
Vitaly Tomilov12-Feb-05 2:44 
Questiondoes it support SONY DCR-HC30E? Pin
Wenming Hu2-Jan-05 3:23
Wenming Hu2-Jan-05 3:23 
GeneralError in FindCaptureDeviceMoniker Pin
Shlomo28-Nov-04 21:17
Shlomo28-Nov-04 21:17 
GeneralRe: Error in FindCaptureDeviceMoniker Pin
Vitaly Tomilov6-Dec-04 23:20
Vitaly Tomilov6-Dec-04 23:20 
GeneralRe: Error in FindCaptureDeviceMoniker Pin
Vishnu Monn Baskaran10-Jan-05 17:15
Vishnu Monn Baskaran10-Jan-05 17:15 
GeneralRe: Error in FindCaptureDeviceMoniker Pin
Vitaly Tomilov10-Jan-05 23:33
Vitaly Tomilov10-Jan-05 23:33 
GeneralInterlace Text On Video Pin
Yaoying28-Nov-04 15:56
Yaoying28-Nov-04 15:56 

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.