Click here to Skip to main content
15,396,537 members
Articles / Multimedia / DirectX
Posted 5 Jul 2004


138 bookmarked

DirectX Video Stream and frame capture

Rate me:
Please Sign up or sign in to vote.
4.58/5 (42 votes)
12 Jul 20042 min read
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

QuestionQuestions Pin
stultzg15-Jun-15 9:22
Memberstultzg15-Jun-15 9:22 
SuggestionTips and Tricks Pin
Mostafa Korashy7-Jan-15 3:23
professionalMostafa Korashy7-Jan-15 3:23 
Questioncompiler errors. Pin
jleslie4817-Dec-13 3:46
Memberjleslie4817-Dec-13 3:46 
Questiongood work Pin
Lakhan Aanjana3-Oct-13 21:31
MemberLakhan Aanjana3-Oct-13 21:31 
Questionchange the brightness of a running video according to a slider or a bar Pin
Member 1013160514-Jul-13 22:33
MemberMember 1013160514-Jul-13 22:33 
Questionhello Pin
youshy1-Apr-13 5:11
Memberyoushy1-Apr-13 5:11 
QuestionAudio Record CallBack Pin
Mihaescu Florin3-Oct-12 22:29
MemberMihaescu Florin3-Oct-12 22:29 
GeneralMy vote of 1 Pin
Bala-Code4-Jul-12 2:44
MemberBala-Code4-Jul-12 2:44 
GeneralMy vote of 5 Pin
adeeb masoud6-Mar-12 17:11
Memberadeeb masoud6-Mar-12 17:11 
Questionhow to take image by dirctx in c# Pin
morteza fakoor4-Dec-11 8:55
Membermorteza fakoor4-Dec-11 8:55 
GeneralMy vote of 5 Pin
sor@t5-Jul-11 1:43
Membersor@t5-Jul-11 1:43 
QuestionHow to execute the file Pin
prashantwamane1-Dec-10 18:38
Memberprashantwamane1-Dec-10 18:38 
GeneralMy vote of 4 Pin
aofeng322-Nov-10 19:03
Memberaofeng322-Nov-10 19:03 
Rantawesome!!! Pin
Member 36942812-Nov-10 9:50
MemberMember 36942812-Nov-10 9:50 
Generalhelp! Pin
deching10-Nov-10 5:18
Memberdeching10-Nov-10 5:18 
QuestionHow to get the list of all supported FrameSizes by a video device Pin
Dramirak28-Aug-10 13:46
MemberDramirak28-Aug-10 13:46 
GeneralMy captured image is a little dark than video Pin
dennis.zeng30-Jul-10 17:50
Memberdennis.zeng30-Jul-10 17:50 
GeneralCaptureFrame inside Thread Pin
anki12315-Apr-10 3:11
Memberanki12315-Apr-10 3:11 
Generalmedia.formatPtr always null..!! Pin
uwo22-Dec-09 20:12
Memberuwo22-Dec-09 20:12 
GeneralRe: media.formatPtr always null..!! Pin
zaman_7h15-Aug-11 1:43
Memberzaman_7h15-Aug-11 1:43 
Generalmulti webcam show Pin
mehrdad33320-Nov-09 10:00
Membermehrdad33320-Nov-09 10:00 
QuestionError HRESULT E_FAIL has been returned from a call to a COM component. Pin
Hussien.fahmy7-Nov-09 0:42
MemberHussien.fahmy7-Nov-09 0:42 
GeneralVery nice work! Pin
Lomis21-Jul-09 23:28
MemberLomis21-Jul-09 23:28 
Generali want text watermark over vedio Pin
Babita Shivade9-May-09 4:02
MemberBabita Shivade9-May-09 4:02 
Questionmaking snapshot without preview function Pin
katran.ek3-Mar-09 3:04
Memberkatran.ek3-Mar-09 3:04 

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.