Related products: Video Capture SDK .Net

Select video and audio capture devices in 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);
    }
}

or get list of available audio capture devices,select device, fill combobox

foreach (var device in VideoCapture1.Audio_CaptureDevicesInfo)
{
    cbAudioInputDevice.Items.Add(device.Name);
}

VideoCapture1.Audio_CaptureDevice = cbAudioInputDevice.Text;

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

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

    foreach (string line in deviceItem.Lines) 
    { 
        cbAudioInputLine.Items.Add(line); 
    }
}

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;

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel