Click here to Skip to main content
15,883,766 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.6K   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

 
GeneralGrabbing Bitmaps from the Live Video Pin
_bk_14-Nov-05 21:07
_bk_14-Nov-05 21:07 
GeneralRe: Grabbing Bitmaps from the Live Video Pin
whitesail6-Dec-05 13:10
whitesail6-Dec-05 13:10 
GeneralRe: Grabbing Bitmaps from the Live Video Pin
_bk_7-Dec-05 4:41
_bk_7-Dec-05 4:41 
GeneralRe: Grabbing Bitmaps from the Live Video Pin
whitesail7-Dec-05 6:11
whitesail7-Dec-05 6:11 
QuestionMessage Error ....??? Pin
upadrino2-Nov-05 11:17
upadrino2-Nov-05 11:17 
AnswerRe: Message Error ....??? Pin
animat3-Jan-06 3:13
animat3-Jan-06 3:13 
GeneralMemory Leakage in connect the filter Pin
sunj1-Nov-05 18:26
sunj1-Nov-05 18:26 
GeneralVideo Resolution Pin
keykey197227-Oct-05 9:20
keykey197227-Oct-05 9:20 
GeneralVideo Compression Pin
henryhlc849-Oct-05 7:45
henryhlc849-Oct-05 7:45 
Generaldshow.h Pin
Member 213340129-Sep-05 8:40
Member 213340129-Sep-05 8:40 
GeneralRe: dshow.h Pin
Dillip Kumar Kara30-Sep-05 10:01
Dillip Kumar Kara30-Sep-05 10:01 
GeneralRe: dshow.h Pin
dillian wong19-Nov-09 17:36
dillian wong19-Nov-09 17:36 
QuestionHow to create an object? Pin
avogadro626-Sep-05 6:16
avogadro626-Sep-05 6:16 
Generalplease , i have an error in dshow.h Pin
dynamica12330-Aug-05 3:21
dynamica12330-Aug-05 3:21 
GeneralRe: please , i have an error in dshow.h Pin
dillian wong19-Nov-09 17:38
dillian wong19-Nov-09 17:38 
GeneralISampleGrabber Pin
Brooks Y.14-Aug-05 6:21
Brooks Y.14-Aug-05 6:21 
GeneralRe: ISampleGrabber Pin
Brooks Y.15-Aug-05 1:48
Brooks Y.15-Aug-05 1:48 
GeneralSave video to WMV file Pin
cla795-Aug-05 22:42
cla795-Aug-05 22:42 
GeneralRe: Save video to WMV file Pin
khkh11-Aug-05 2:15
khkh11-Aug-05 2:15 
Generalplease , i need dshow.h Pin
dynamica12330-Jul-05 1:32
dynamica12330-Jul-05 1:32 
GeneralRe: please , i need dshow.h Pin
Anonymous3-Aug-05 23:28
Anonymous3-Aug-05 23:28 
GeneralVideo size Pin
khkh21-Jul-05 0:27
khkh21-Jul-05 0:27 
GeneralCan't find all "file.h" in MVS Pin
cyril82617-Jun-05 2:22
cyril82617-Jun-05 2:22 
GeneralCan't find dshow.h Pin
elvis89002-Jun-05 15:09
elvis89002-Jun-05 15:09 
GeneralRe: Can't find dshow.h Pin
Christian Graus2-Jun-05 16:27
protectorChristian Graus2-Jun-05 16:27 

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.