Click here to Skip to main content
15,881,882 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 748.2K   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: Can't find dshow.h Pin
User 223702-Jun-05 19:08
User 223702-Jun-05 19:08 
GeneralRe: Can't find dshow.h Pin
elvis89003-Jun-05 12:24
elvis89003-Jun-05 12:24 
GeneralRe: Can't find dshow.h Pin
Ștefan-Mihai MOGA17-Mar-06 3:05
professionalȘtefan-Mihai MOGA17-Mar-06 3:05 
GeneralQuestion Pin
Rene Pally31-May-05 5:59
Rene Pally31-May-05 5:59 
GeneralCallback function Pin
mattglennen24-May-05 5:17
mattglennen24-May-05 5:17 
GeneralError when compiling Pin
Mustang6818-May-05 13:32
Mustang6818-May-05 13:32 
GeneralRe: Error when compiling Pin
JeanMoul11-Jun-05 2:08
JeanMoul11-Jun-05 2:08 
GeneralRe: Error when compiling Pin
shayirli15-Jun-05 1:57
shayirli15-Jun-05 1:57 
GeneralRe: Error when compiling Pin
upadrino2-Nov-05 10:53
upadrino2-Nov-05 10:53 
GeneralRe: Error when compiling Pin
dillian wong19-Nov-09 17:44
dillian wong19-Nov-09 17:44 
GeneralRe: Error when compiling Pin
avogadro626-Sep-05 3:35
avogadro626-Sep-05 3:35 
GeneralRe: Error when compiling Pin
Anonymous5-Oct-05 9:00
Anonymous5-Oct-05 9:00 
GeneralRe: Error when compiling Pin
avogadro626-Oct-05 2:47
avogadro626-Oct-05 2:47 
QuestionStreaming to disk? Pin
Obliterator9-May-05 9:49
Obliterator9-May-05 9:49 
AnswerRe: Streaming to disk? Pin
Vitaly Tomilov9-May-05 12:34
Vitaly Tomilov9-May-05 12:34 
QuestionHow to send the live video data Pin
Shatyamm Kumar19-Apr-05 2:41
Shatyamm Kumar19-Apr-05 2:41 
AnswerRe: How to send the live video data Pin
Joshilay19-Apr-05 6:07
Joshilay19-Apr-05 6:07 
GeneralRe: How to send the live video data Pin
Shatyamm Kumar19-Apr-05 17:40
Shatyamm Kumar19-Apr-05 17:40 
GeneralRe: How to send the live video data Pin
yaminisridaran11-Jul-07 1:36
yaminisridaran11-Jul-07 1:36 
GeneralRe: How to send the live video data Pin
Vitaly Tomilov9-May-05 0:41
Vitaly Tomilov9-May-05 0:41 
AnswerRe: How to send the live video data Pin
Vitaly Tomilov9-May-05 12:38
Vitaly Tomilov9-May-05 12:38 
GeneralRe: How to send the live video data Pin
knighter_a31-May-05 10:09
knighter_a31-May-05 10:09 
Generalsave a picture Pin
Anonymous17-Apr-05 22:35
Anonymous17-Apr-05 22:35 
GeneralRe: save a picture Pin
mmartind17-Apr-05 22:44
mmartind17-Apr-05 22:44 
GeneralRe: save a picture Pin
Vitaly Tomilov9-May-05 0:44
Vitaly Tomilov9-May-05 0:44 

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.