Click here to Skip to main content
11,409,922 members (50,631 online)
Click here to Skip to main content

DirectX Video Stream and frame capture

, 12 Jul 2004
Rate this:
Please Sign up or sign in to vote.
A library that can capture video stream and frame together


There is a tremendous job done by NET master and enhanced by Brian Low. However, I was needed a library that can continuously capture image/bitmap from the video source and record it at the same time. Then I saw the Net master's project and Brian low's project. Well, they have done a great job, but the feature was not included in the project. So I decided to add one. By the way, I saw another project that did the same function, but it was not continuously capturing the frame by triggering event, and the video capture is rather slow, it cannot produce a smooth stream. And the frame per second is rather slow too. However, it was a great effort.


Actually I was just combining the samples together. So, it could be best for you all to refer back to the samples.

Using the code

Just add a button for triggering the event and the GrapImg method. Then, add another handler of the event, which I add is the CaptureDone handler.

The CaptureDone will be fired once a frame was copied from the image buffer. After that, just display the bitmap into a picture box.

private void button1_Click(object sender, System.EventArgs e)
    capture.FrameEvent2 += new Capture.HeFrame(CaptureDone);

private void CaptureDone(System.Drawing.Bitmap e)

However, for it to work, you will have to know how to use the DirectX capture library at first. because you will have to setup the properties for a video capture to be started, and you will need to start previewing the video before the CaptureDone will be fired.

Points of Interest

Well, one thing is, it took me a lot of time reading through NET master's and Brian Low's code. Any comment, you are welcome..... thanks. Below are two links to the Brian Low's class library and NET Master's DirectShow.NET. (Thanks for the suggestion)




This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Malaysia Malaysia
Please visit my website for more web site information.

Comments and Discussions

SuggestionTips and Tricks PinprofessionalMostafa Korashy7-Jan-15 4:23 
Questioncompiler errors. Pinmemberjleslie4817-Dec-13 4:46 
Questiongood work PingroupLakhan Aanjana3-Oct-13 22:31 
Questionchange the brightness of a running video according to a slider or a bar PinmemberMember 1013160514-Jul-13 23:33 
Questionhello Pinmemberyoushy1-Apr-13 6:11 
QuestionAudio Record CallBack PinmemberMihaescu Florin3-Oct-12 23:29 
GeneralMy vote of 1 PinmemberMember 87853324-Jul-12 3:44 
GeneralMy vote of 5 Pinmemberadeeb masoud6-Mar-12 18:11 
Questionhow to take image by dirctx in c# Pinmembermorteza fakoor4-Dec-11 9:55 
GeneralMy vote of 5 Pinmembersor@t5-Jul-11 2:43 
QuestionHow to execute the file Pinmemberprashantwamane1-Dec-10 19:38 
GeneralMy vote of 4 Pinmemberaofeng322-Nov-10 20:03 
Rantawesome!!! PinmemberMember 36942812-Nov-10 10:50 
Generalhelp! Pinmemberdeching10-Nov-10 6:18 
QuestionHow to get the list of all supported FrameSizes by a video device PinmemberDramirak28-Aug-10 14:46 
GeneralMy captured image is a little dark than video Pinmemberdennis.zeng30-Jul-10 18:50 
GeneralCaptureFrame inside Thread Pinmemberanki12315-Apr-10 4:11 
Generalmedia.formatPtr always null..!! Pinmemberuwo22-Dec-09 21:12 
GeneralRe: media.formatPtr always null..!! Pinmemberzaman_7h15-Aug-11 2:43 
Generalmulti webcam show Pinmembermehrdad33320-Nov-09 11:00 
QuestionError HRESULT E_FAIL has been returned from a call to a COM component. PinmemberHussien.fahmy7-Nov-09 1:42 
GeneralVery nice work! PinmemberLomis22-Jul-09 0:28 
Generali want text watermark over vedio PinmemberBabita Shivade9-May-09 5:02 
Questionmaking snapshot without preview function Pinmemberkatran.ek3-Mar-09 4:04 
General^.^ Thanks........ PinmemberChoon kiat18-Feb-09 17:00 

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
Web01 | 2.8.150414.5 | Last Updated 13 Jul 2004
Article Copyright 2004 by hpAng
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid