Click here to Skip to main content
15,887,485 members
Articles / Multimedia / DirectX
Article

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 655.7K   27.2K   138   115
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.

C#
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


Written By
Web Developer
Malaysia Malaysia
Please visit my website www.mbwebcreator.com for more web site information.

Comments and Discussions

 
GeneralBitmaps from video Pin
ixyildirim21-Nov-04 23:13
ixyildirim21-Nov-04 23:13 
GeneralRe: Bitmaps from video Pin
pr_00124-Nov-04 8:14
pr_00124-Nov-04 8:14 
GeneralPreview box lose mousemove event Pin
ciukred1-Oct-04 5:27
ciukred1-Oct-04 5:27 
Generaldispose of capture class Pin
ciukred21-Sep-04 4:48
ciukred21-Sep-04 4:48 
GeneralRe: dispose of capture class Pin
hpAng22-Sep-04 5:35
hpAng22-Sep-04 5:35 
GeneralRe: dispose of capture class Pin
ciukred22-Sep-04 23:06
ciukred22-Sep-04 23:06 
GeneralRe: dispose of capture class Pin
Ark8-Jan-05 2:08
Ark8-Jan-05 2:08 
GeneralRe: dispose of capture class Pin
Anonymous8-Jan-05 14:23
Anonymous8-Jan-05 14:23 
GeneralRe: dispose of capture class Pin
hpAng9-Jan-05 15:47
hpAng9-Jan-05 15:47 
GeneralGrap Image... Pin
Coolgen20-Sep-04 9:40
Coolgen20-Sep-04 9:40 
GeneralRe: Grap Image... Pin
hpAng22-Sep-04 5:37
hpAng22-Sep-04 5:37 
GeneralRe: Grap Image... Pin
qinyin18-May-05 21:26
qinyin18-May-05 21:26 
GeneralRe: Grap Image... Pin
ptsmy3-Nov-05 9:15
ptsmy3-Nov-05 9:15 
GeneralGrap Image... Pin
Coolgen20-Sep-04 9:39
Coolgen20-Sep-04 9:39 
QuestionLinks? Pin
Brian Olej13-Jul-04 7:21
Brian Olej13-Jul-04 7:21 

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.