Click here to Skip to main content
Click here to Skip to main content

Capture Live Video from various Video Devices.

, 20 May 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
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

Generallivevideo exit at RenderStream fuction PinmemberDoubleGhost26-Apr-11 5:58 
GeneralMy vote of 5 PinmemberAshish Tyagi 4021-Apr-11 8:45 
QuestionHow to set channel or channel frequency for tv-tuner card ? Pinmemberrjviz30-Jul-10 4:25 
GeneralCompile time error in LiveVideo_demo PinmemberNoushad Ali9-Mar-10 4:11 
I downloaded the LiveVideo_demo and tried to build the app. but i am getting comiple time errors.
fatal error C1083: Cannot open include file: 'dshow.h': No such file or directory
Then I downloaded Microsoft DirectX SDK (February 2010) and installed. but unfortunately this doesn't contain the header file. Then downloaded Microsoft Platform SDK (Windows® Server 2003 SP1 Platform SDK ISO Install) and installed which contain dshow.h.
I added the additional includes path C:\Program Files\Microsoft Platform SDK\Include in settings. Then I compiled and resolved the above error. But I got new errors as below:
Compiling resources...
c:\program files\microsoft platform sdk\include\strmif.h(27614) : error C2146: syntax error : missing ';' before identifier 'lpSurf'
c:\program files\microsoft platform sdk\include\strmif.h(27614) : error C2501: 'LPDIRECTDRAWSURFACE7' : missing storage-class or type specifiers
c:\program files\microsoft platform sdk\include\strmif.h(27614) : error C2501: 'lpSurf' : missing storage-class or type specifiers
c:\program files\microsoft platform sdk\include\strmif.h(27815) : error C2061: syntax error : identifier 'LPDIRECTDRAWSURFACE7'
Generating Code...
Error executing cl.exe.
Creating browse info file...
Could you please help me how to resolve this. It would be good if you let me know what are the environment setups i need to do to get compile this app. I am using VS2006.
Thanks for your help in advance.
GeneralRe: Compile time error in LiveVideo_demo PinmemberNoushad Ali9-Mar-10 23:14 
GeneralPictures squashed Pinmembermathewmefiu12-Jan-10 1:06 
GeneralRe: Pictures squashed Pinmembermathewmefiu12-Jan-10 1:27 
GeneralRe: Pictures squashed PinmemberAric Green23-Jan-10 4:57 
GeneralIR>Thermal Algorithm PinmemberJoel Monet29-Nov-09 0:34 
Generalerror C2143: syntax error : missing ';' before '*' [modified] Pinmemberdillian wong19-Nov-09 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 21 May 2004
Article Copyright 2004 by Dillip Kumar Kara
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid