This is a step by step tutorial for writing a simple DirectShow video capture application in .NET by using VideoLab or VisionLab. The steps are exactly identical in C#, Visual Basic .NET, C++/CLI and J#.
Using the application created by following the tutorial, you will be able to capture from Webcam, Camcorder, Camera, TV Tuner, DVR, VCR, DVD Player, or any other video source.
WARNING: In order to run the application in this example you must have DirectX 9.0 or higher installed on your system!
There is no code writing necessary to complete this application.
There is no need to know C#, Visual Basic, J# or C++ in order to create this application.
The tutorial covers the following steps, which should take less than two minutes:
1. Add a DSCapture Component to Your Application's Form:
2. Add a DSImageDisplay Control to Your Application's Form:
3. Add a DSVideoLogger Component to Your Application's Form:
4. Set the DSImageDisplay Control's Properties:
4.1 Arrange you form to look similar to this:
4.2. Set the DSImageDisplay Control’s Anchor property to “Top, Bottom, Left, Right”:
5. Select video capture device for the DSCapture Component:
5.1. Click on the button on the dsCapture1 component, and then click “Select Video Device ...”:
5.2. In the dialog select a video capture device:
5.3. Optionally select audio capture device. If you do not select the device the component will use the default device for your system.
6. Connect the DSCapture.OutputPin to DSImageDisplay.InputPin and DSVideoLogger.InputPin:
6.1. In the dsCapture1 Properties select OutputPin and click on the button:
6.2. In the connection editor check the InputPin of the dsImageDisplay1 and the InputPin of the dsVideoLogger1, then click OK:
7. Connect the DSCapture.AudioOutputPin to DSVideoLogger.AudioInputPin:
6.1. In the dsCapture1 Properties select AudioOutputPin and click on the button:
7.2. In the connection editor check the AudioInputPin of the dsVideoLogger1 and click OK:
8. Specify file to record in the DSVideoLogger Component:
8.1. Select the dsVideoLogger1 component:
8.2. In the dsVideoLogger1 Properties select the FileName property and enter the path and the name of the file where you want to record the captured video:
9.1 Press (F5) to run the application. You should see the captured video: