Select video and audio capture devices in Video Capture SDK .Net

Related products
Video Capture SDK .Net
You can download sample project from GitHub.

Select video source

1. Get list of available video capture devices, fill combobox

foreach (var device in VideoCapture1.Video_CaptureDevicesInfo)
{
    cbVideoInputDevice.Items.Add(device.Name);                
}

2. Select device

VideoCapture1.Video_CaptureDevice = cbVideoInputDevice.Text;

3. Get list of available video formats and frame rates, fill combobox

var deviceItem = VideoCapture1.Video_CaptureDevicesInfo.First(device => device.Name == cbVideoInputDevice.Text);
if (deviceItem == null)
{
    return;
}

cbVideoInputFormat.Items.Clear();
foreach (string format in deviceItem.VideoFormats)
{
    cbVideoInputFormat.Items.Add(format);
}

cbFramerate.Items.Clear(); 
foreach (string frameRate in deviceItem.VideoFrameRates) 
{ 
    cbVideoFrameRate.Items.Add(frameRate); 
}

4. Select video format

VideoCapture1.Video_CaptureDevice_Format = cbVideoInputFormat.Text;

or automatically choose best video format.

VideoCapture1.Video_CaptureDevice_Format_UseBest = true;

5. Select frame rate

VideoCapture1.Video_CaptureDevice_FrameRate = Convert.ToDouble(cbVideoFrameRate.Text);

6. Select needed video input (configure crossbar) if needed

Select audio source

1. Use video capture device as audio source, enumerate formats, fill combobox

VideoCapture1.Video_CaptureDevice_IsAudioSource = true;

cbAudioInputFormat.Items.Clear();
cbAudioInputLine.Items.Clear();

var deviceItem = VideoCapture1.Video_CaptureDevicesInfo.First(device => device.Name == cbVideoInputDevice.Text);
if (deviceItem != null)
{
    foreach (string format in deviceItem.AudioFormats)
    {
        cbAudioInputFormat.Items.Add(format);
    }
}

2. Select format

VideoCapture1.Audio_CaptureDevice_Format = cbAudioInputFormat.Text;
or automatically choose best audio format
VideoCapture1.Audio_CaptureDevice_Format_UseBest = true;

3. Select input (line)

VideoCapture1.Audio_CaptureDevice_Line = cbAudioInputLine.Text;
Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
VisioForge © 2006 - 2021