Viscomsoft .Net Video Capture SDK

C# Developer Getting Started



1. Launch Visual Studio 2010 or another version of Visual Studio. Select Visual C#, Select Windows Form Application.

 


 

2. In the Solution Explorer, right-click References, and then click Add Reference.


3. Select Browse tab,  Navigate to the extracted Video Capture .Net SDK for REDIST folder, open it, and then double-click Viscomsoft.VideoCapture.dll




4. In the Solution Explorer, right-click on your project, and then click Add - Existing Item ....




5. In Add Existing Item dialog, Select All Files (*.*) in combo box. Navigate to the extracted Video Capture .Net SDK for REDIST folder, open it, and then double-click Viscomsoft.VideoCapture.Foundation.dll


6. You will see Viscomsoft.VideoCapture.dll and Viscomsoft.VideoCapture.Foundation.dll in Solution Explorer.




7. Select Viscomsoft.VideoCapture.Foundation.dll , In the Properties window, Change the Copy to Output Directory property to Copy if newer.



8. At the top of the Form1.cs file, add the following to the using directives
already in the class:

using Viscomsoft.VideoCapture;


9.  The following code bit presents the video capture sdk initialization:
 

public partial class Form1 : Form
{

public VideoCapture _capture = new VideoCapture();
public Devices _devices = new Devices();

private void Form1_Load(object sender, EventArgs e)
{
 

_capture.Initialize();
_devices.Refresh();

}
 

10.  double click Form1.cs in the Solution Explorer and Drag the PictureBox to form.

11.  After devices.Refresh(); add the following code use PictureBox for preview window, set the Preview Mode, selected first video device and audio device and use first video resolution. If the Start() return 1 , it mean successful for preview video.
 

_capture.Window = pictureBox1.Handle;

_capture.Mode = VideoCapture.CaptureMode.Preview;

_capture.VideoDevice = _devices.VideoDevices[0];

_capture.VideoDevice.SelectedResolution = _capture.VideoDevice.VideoResolutions[0];

_capture.AudioDevice = _devices.AudioDevices[0];

int result = _capture.Start();

12.  double click Form1.cs in the Solution Explorer and Drag the two button to form . For button1, In the Properties window, change the Text to "Capture to MP4"
For button2, In the Properties window, change the Text to "Stop"

13.  In button1 click event, add the following code, set the Capture Mode, selected first video device and audio device and use first audio bitrate and video resolution. If the Start() return 1 , it mean successful for capture to  video. make sure temp folder is existing. 


_capture.Stop();

_capture.Window = pictureBox1.Handle;

_capture.Mode = VideoCapture.CaptureMode.Capture;

_capture.Encoder.OutputType = OutputType.MP4;

_capture.Encoder.H264Profile = H264Profile.Base;

_capture.OutputFile = "c:\\temp\\test1.mp4";

AudioDevice audiodevice=_capture.AudioDevice = _devices.AudioDevices[0];

_capture.AudioDevice = audiodevice;

List<int> bitrates = _capture.Encoder.getSupportedAudioBitrates(audiodevice.AudioSamplingRates[0].SampleRate, audiodevice.AudioSamplingRates[0].Channels);

_capture.Encoder.AudioBitrate = bitrates[0];

_capture.VideoDevice = _devices.VideoDevices[0];

_capture.Encoder.VideoBitrate = 1000000;

_capture.VideoDevice.SelectedResolution = _capture.VideoDevice.VideoResolutions[0];

int result= _capture.Start();

14.  In button2 click event, add the following code.
 

_capture.Stop();

15.  Press F5 to Run the project, click Capture to MP4 video, then click Stop button to stop the capturing.