Click here to Skip to main content
15,394,655 members
Articles / Desktop Programming / MFC
Posted 20 May 2004


207 bookmarked

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
LiveVideo is an application to capture live video from various video capture devices.

Sample Image - LiveVideo.jpg


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.


Don’t forget to uninitialize the Video by using UnInitializeVideo() before destroying your application.


  • 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.


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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dillip Kumar Kara
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

QuestionMemory issue Pin
Member 1331895317-Aug-17 1:48
MemberMember 1331895317-Aug-17 1:48 
QuestionDownload MFC Multiple Library to make it work with VS2013 Pin
sharp_k25-Aug-15 19:30
Membersharp_k25-Aug-15 19:30 
QuestionA new experiment ! Pin
Member 1102098119-Aug-14 1:06
MemberMember 1102098119-Aug-14 1:06 
SuggestionI would like to recommend my new Camera_Net Library Pin
free5lot29-Dec-13 21:20
Memberfree5lot29-Dec-13 21:20 
QuestionLive video display from camera in c# .net Pin
Member 900485711-Jul-12 18:39
MemberMember 900485711-Jul-12 18:39 
Questionwatermarking video Pin
lototfi11-Jun-12 14:15
Memberlototfi11-Jun-12 14:15 
QuestionThanks Pin
SreerajManayath5-Feb-12 18:44
MemberSreerajManayath5-Feb-12 18:44 
Questionmultiple cameras? Pin
jleslie483-Nov-11 8:29
Memberjleslie483-Nov-11 8:29 
AnswerRe: multiple cameras? Pin
free5lot29-Dec-13 21:21
Memberfree5lot29-Dec-13 21:21 
Questionimage capture Pin
Gabriel Punes13-Jul-11 22:59
MemberGabriel Punes13-Jul-11 22:59 
GeneralMy vote of 3 Pin
Mahdi Nejadsahebi30-Apr-11 22:09
MemberMahdi Nejadsahebi30-Apr-11 22:09 
Generallivevideo exit at RenderStream fuction Pin
DoubleGhost26-Apr-11 4:58
MemberDoubleGhost26-Apr-11 4:58 
GeneralMy vote of 5 Pin
Ashish Tyagi 4021-Apr-11 7:45
MemberAshish Tyagi 4021-Apr-11 7:45 
QuestionHow to set channel or channel frequency for tv-tuner card ? Pin
rjviz30-Jul-10 3:25
Memberrjviz30-Jul-10 3:25 
GeneralCompile time error in LiveVideo_demo Pin
Noushad Ali9-Mar-10 3:11
MemberNoushad Ali9-Mar-10 3:11 
GeneralRe: Compile time error in LiveVideo_demo Pin
Noushad Ali9-Mar-10 22:14
MemberNoushad Ali9-Mar-10 22:14 
GeneralPictures squashed Pin
mateusz.matyaszek12-Jan-10 0:06
Membermateusz.matyaszek12-Jan-10 0:06 
GeneralRe: Pictures squashed Pin
mateusz.matyaszek12-Jan-10 0:27
Membermateusz.matyaszek12-Jan-10 0:27 
GeneralRe: Pictures squashed Pin
Aric Wang23-Jan-10 3:57
MemberAric Wang23-Jan-10 3:57 
GeneralIR>Thermal Algorithm Pin
Joel Monet28-Nov-09 23:34
MemberJoel Monet28-Nov-09 23:34 
Generalerror C2143: syntax error : missing ';' before '*' [modified] Pin
dillian wong18-Nov-09 23:15
Memberdillian wong18-Nov-09 23:15 
GeneralCapture image from video stream Pin
kokabgujjar15-Oct-09 17:27
Memberkokabgujjar15-Oct-09 17:27 
GeneralRe: Capture image from video stream Pin
jiaozi1093-Dec-09 2:21
Memberjiaozi1093-Dec-09 2:21 
QuestionFirewire (IEEE1394) Pin
loyal ginger6-Oct-09 6:26
Memberloyal ginger6-Oct-09 6:26 
GeneralI need code for video capturing in mpeg format in Pin
thebest12342-Aug-09 3:13
Memberthebest12342-Aug-09 3:13 

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.