Click here to Skip to main content
13,149,427 members (54,024 online)
Click here to Skip to main content
Add your own
alternative version


135 bookmarked
Posted 5 Jul 2004

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.

You may also be interested in...

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
groupLakhan 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
Member 87853324-Jul-12 2:44
memberMember 87853324-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^.^ Thanks........ Pin
Choon kiat18-Feb-09 16:00
memberChoon kiat18-Feb-09 16:00 
GeneralCapture several images with GrapImg Pin
6F2120-Jan-09 20:49
member6F2120-Jan-09 20:49 
GeneralRe: Capture several images with GrapImg Pin
kumi_aberer@hotmail.com10-Mar-09 12:39
memberkumi_aberer@hotmail.com10-Mar-09 12:39 
Questioncan not download the source code? Pin
bluewater020928-Nov-08 16:14
memberbluewater020928-Nov-08 16:14 
QuestionA dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pin
saravanan.rex@gmail.com21-Nov-08 0:12
membersaravanan.rex@gmail.com21-Nov-08 0:12 
AnswerRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pin
donperry12-Feb-09 6:49
memberdonperry12-Feb-09 6:49 
GeneralRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pin
kostiak26-Jul-09 9:30
memberkostiak26-Jul-09 9:30 
GeneralError HRESULT E_FAIL has been returned from a call to a COM component. Pin
Ankita Garg20-Nov-08 1:15
memberAnkita Garg20-Nov-08 1:15 
GeneralStart() causes crash Pin
Member 320461014-Oct-08 8:30
memberMember 320461014-Oct-08 8:30 
GeneralStill unable to grab an image [modified] Pin
ChiWaiLam17-Sep-08 0:19
memberChiWaiLam17-Sep-08 0:19 
QuestionVC++ version of DirectXCapture Pin
Wilson Kopman16-Sep-08 13:39
memberWilson Kopman16-Sep-08 13:39 
GeneralColor Control Pin
renoreballos4-Jan-08 4:07
memberrenoreballos4-Jan-08 4:07 
GeneralDetect webcam Pin
Eddiema26-Dec-07 8:31
memberEddiema26-Dec-07 8:31 
QuestionDirectShow as Web Applictaion Pin
menaka.ca19-Nov-07 13:33
membermenaka.ca19-Nov-07 13:33 
QuestionHelp, Code doesn't run (DShowNET could not be found) Pin
smitti12326-Oct-07 4:17
membersmitti12326-Oct-07 4:17 
Questioncan managed C++ use this DLL? Pin
rayher20-Oct-07 3:47
memberrayher20-Oct-07 3:47 
GeneralInterlacing in fast motion Pin
brs0264-Aug-07 5:56
memberbrs0264-Aug-07 5:56 
GeneralHelp Pin
NelsonPaz26-Jul-07 13:14
memberNelsonPaz26-Jul-07 13:14 
QuestionI face aproblem in changing the video source Pin
aishar18-Jun-07 11:04
memberaishar18-Jun-07 11:04 
AnswerRe: I face aproblem in changing the video source Pin
Raghu_Super24-Sep-07 23:20
memberRaghu_Super24-Sep-07 23:20 
QuestionCapture a frame without preview Pin
RodrigoZaratin12-Jun-07 10:28
memberRodrigoZaratin12-Jun-07 10:28 
QuestionCapture audio and video from firewire dvcam Pin
Carnivash12-Jun-07 6:19
memberCarnivash12-Jun-07 6:19 
QuestionHow do i get pixel co-ordinates (pos) on clicking the frame playing in the pictureBox? Pin
Dharani_Prasad12-Apr-07 21:44
memberDharani_Prasad12-Apr-07 21:44 
QuestionHow do i play a video in the picture box? [modified] Pin
Dharani_Prasad12-Apr-07 21:39
memberDharani_Prasad12-Apr-07 21:39 
QuestionIs that possible to grap image without working with windows.form? [modified] Pin
F.E.L.I.X.24-Mar-07 11:13
memberF.E.L.I.X.24-Mar-07 11: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 13 Jul 2004
Article Copyright 2004 by hpAng
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid