Click here to Skip to main content
15,881,866 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

 
Generalerror C2143: syntax error : missing ';' before '*' [modified] Pin
dillian wong18-Nov-09 23:15
dillian wong18-Nov-09 23:15 
GeneralCapture image from video stream Pin
kokabgujjar15-Oct-09 17:27
kokabgujjar15-Oct-09 17:27 
GeneralRe: Capture image from video stream Pin
jiaozi1093-Dec-09 2:21
jiaozi1093-Dec-09 2:21 
QuestionFirewire (IEEE1394) Pin
loyal ginger6-Oct-09 6:26
loyal ginger6-Oct-09 6:26 
GeneralI need code for video capturing in mpeg format in c#.net Pin
thebest12342-Aug-09 3:13
thebest12342-Aug-09 3:13 
GeneralRe: I need code for video capturing in mpeg format in c#.net Pin
jiaozi1093-Dec-09 2:22
jiaozi1093-Dec-09 2:22 
GeneralRe: I need code for video capturing in mpeg format in c#.net Pin
nid4may18-Jun-10 20:16
nid4may18-Jun-10 20:16 
GeneralFLIP and ROTATION livevideo FILTER Pin
giuegiu6-Jul-09 21:08
giuegiu6-Jul-09 21:08 
GeneralRun time error Pin
kokabgujjar22-Jun-09 20:31
kokabgujjar22-Jun-09 20:31 
Code is compiling successfully but when I try to run it the run time debug error occur. error message in dialog box is " Debug information for 'LiveVideo.exe' can not be found or does not match. Binary was not built with debug information". Exe file did not load.
Please help me to run this application.
QuestionHow to video Capture Application using C++ Pin
tns_ranjith19-May-09 22:48
tns_ranjith19-May-09 22:48 
GeneralFlickerless problem Pin
QuyLV17-Feb-09 20:33
QuyLV17-Feb-09 20:33 
Questionhow to convert it into C# Pin
mice351-Feb-09 22:55
mice351-Feb-09 22:55 
Questionhow to convert it into C# ? / need help!!! Pin
mice3527-Jan-09 11:54
mice3527-Jan-09 11:54 
Questionthe video quality showed by LiveVideo is worse than that showed by the Demo, which is provided together with the capture card Pin
chen.zd26-Sep-08 16:38
chen.zd26-Sep-08 16:38 
Generalvideo capture Pin
Phoody6-Apr-08 22:09
Phoody6-Apr-08 22:09 
GeneralRe: video capture Pin
kiquenet.com20-May-08 22:05
professionalkiquenet.com20-May-08 22:05 
GeneralRe: video capture Pin
chasoknight22-Jul-08 23:08
chasoknight22-Jul-08 23:08 
GeneralRe: video capture Pin
Aric Wang23-Jan-10 3:59
Aric Wang23-Jan-10 3:59 
GeneralI want code and windown form of C# for application of listening music Pin
milkpig864-Apr-08 20:12
milkpig864-Apr-08 20:12 
GeneralRe: I want code and windown form of C# for application of listening music Pin
kiquenet.com20-May-08 22:04
professionalkiquenet.com20-May-08 22:04 
GeneralI wants to get a snap from C# Application, of a person sitting in front of a WebCam. Pin
Member 33318424-Dec-07 23:28
Member 33318424-Dec-07 23:28 
GeneralI wants to get a snap from C# Application, of a person sitting in front of a WebCam. Pin
Member 33318424-Dec-07 23:26
Member 33318424-Dec-07 23:26 
QuestionHelp!! Pin
swlan7-Aug-07 16:52
swlan7-Aug-07 16:52 
GeneralWebcam for engineering project Pin
ang_ks9-Jul-07 20:20
ang_ks9-Jul-07 20:20 
GeneralNeed help Pin
yaminisridaran11-Jul-07 23:09
yaminisridaran11-Jul-07 23:09 

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.