Click here to Skip to main content
Licence 
First Posted 5 Jul 2004
Views 379,850
Downloads 8,165
Bookmarked 119 times

DirectX Video Stream and frame capture

By | 12 Jul 2004 | Article
A library that can capture video stream and frame together

Introduction

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.

Background

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);
    capture.GrapImg();
}

private void CaptureDone(System.Drawing.Bitmap e)
{
    this.pictureBox.Image=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)

History

None.

License

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

hpAng

Web Developer

Malaysia Malaysia

Member

Please visit my website www.mbwebcreator.com for more web site information.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 Pinmemberadeeb masoud17:11 6 Mar '12  
Questionhow to take image by dirctx in c# Pinmembermorteza fakoor8:55 4 Dec '11  
GeneralMy vote of 5 Pinmembersor@t1:43 5 Jul '11  
QuestionHow to execute the file Pinmemberprashantwamane18:38 1 Dec '10  
GeneralMy vote of 4 Pinmemberaofeng319:03 22 Nov '10  
Rantawesome!!! PinmemberMember 3694289:50 12 Nov '10  
Generalhelp! Pinmemberdeching5:18 10 Nov '10  
QuestionHow to get the list of all supported FrameSizes by a video device PinmemberDramirak13:46 28 Aug '10  
GeneralMy captured image is a little dark than video Pinmemberdennis.zeng17:50 30 Jul '10  
GeneralCaptureFrame inside Thread Pinmemberanki1233:11 15 Apr '10  
Generalmedia.formatPtr always null..!! Pinmemberuwo20:12 22 Dec '09  
GeneralRe: media.formatPtr always null..!! Pinmemberzaman_7h1:43 15 Aug '11  
Generalmulti webcam show Pinmembermehrdad33310:00 20 Nov '09  
QuestionError HRESULT E_FAIL has been returned from a call to a COM component. PinmemberHussien.fahmy0:42 7 Nov '09  
GeneralVery nice work! PinmemberLomis23:28 21 Jul '09  
Generali want text watermark over vedio PinmemberBabita Shivade4:02 9 May '09  
hi friends ,,
 
in this code filename is displaying as watermark but where code has been written for this a??? and there is also a problem in media player it is not displaying it but in vlc player watermark is displaying what is the reason ???
Questionmaking snapshot without preview function Pinmemberkatran.ek3:04 3 Mar '09  
General^.^ Thanks........ PinmemberChoon kiat16:00 18 Feb '09  
GeneralCapture several images with GrapImg Pinmember6F2120:49 20 Jan '09  
GeneralRe: Capture several images with GrapImg Pinmemberkumi_aberer@hotmail.com12:39 10 Mar '09  
Questioncan not download the source code? Pinmemberbluewater020916:14 28 Nov '08  
QuestionA dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmembersaravanan.rex@gmail.com0:12 21 Nov '08  
AnswerRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmemberdonperry6:49 12 Feb '09  
GeneralRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmemberkostiak29:30 6 Jul '09  
GeneralError HRESULT E_FAIL has been returned from a call to a COM component. PinmemberAnkita Garg1:15 20 Nov '08  

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.

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