Decklink devices
Products: Video Capture SDK .Net
Engines:
VideoCaptureCore
,VideoCaptureCoreX
DeckLink devices, developed by Blackmagic Design, are high-performance capture and playback cards used in video and television production.
They offer a range of features like high-resolution video support, multiple input and output connections, and compatibility with various software applications for video editing, visual effects, and broadcast design. DeckLink cards are renowned for their reliability and quality, making them a staple in professional video production environments.
Enumerate Decklink sources
The code samples below demonstrate how to enumerate Decklink devices and video sources using Video Capture SDK .Net.
Enumerate and add to combo box.
- VideoCaptureCore
- VideoCaptureCoreX
foreach (var device in (await VideoCapture1.Decklink_CaptureDevicesAsync()))
{
cbDecklinkCaptureDevice.Items.Add(device.Name);
}
Enumerate video sources.
var videoCaptureDevices = await DeviceEnumerator.Shared.DecklinkVideoSourcesAsync();
if (videoCaptureDevices.Length > 0)
{
foreach (var item in videoCaptureDevices)
{
cbVideoInput.Items.Add(item.Name);
}
cbVideoInput.SelectedIndex = 0;
}
Enumerate audio sources.
var audioCaptureDevices = await DeviceEnumerator.Shared.DecklinkAudioSourcesAsync();
if (audioCaptureDevices.Length > 0)
{
foreach (var item in audioCaptureDevices)
{
cbAudioInput.Items.Add(item.Name);
}
cbAudioInput.SelectedIndex = 0;
}
List video formats and frame rates
- VideoCaptureCore
- VideoCaptureCoreX
// Enumerate and filter by device name
var deviceItem = (await VideoCapture1.Decklink_CaptureDevicesAsync()).Find(device => device.Name == cbDecklinkCaptureDevice.Text);
if (deviceItem != null)
{
// Read video formats and add to combobox
foreach (var format in (await deviceItem.GetVideoFormatsAsync()))
{
cbDecklinkCaptureVideoFormat.Items.Add(format.Name);
}
// If format does not exist, add a message
if (cbDecklinkCaptureVideoFormat.Items.Count == 0)
{
cbDecklinkCaptureVideoFormat.Items.Add("No input connected");
}
}
If no formats are available, no input is connected to the device.
Get video source modes as a list. You can use it to populate a combo box.
var decklinkModes = Enum.GetValues(typeof(DecklinkMode));
foreach (var item in decklinkModes)
{
cbVideoMode.Items.Add(item.ToString());
}
You will need to set up the video mode on your device.
Set Decklink device as a source
- VideoCaptureCore
- VideoCaptureCoreX
VideoCapture1.Decklink_Source = new DecklinkSourceSettings
{
Name = cbDecklinkCaptureDevice.Text,
VideoFormat = cbDecklinkCaptureVideoFormat.Text
};
Use DecklinkSourcePreview
or DecklinkSourceCapture
mode to preview or capture video from the device.
Set video source.
// Create settings for the video source
DecklinkVideoSourceSettings videoSourceSettings = null;
// Device name from the combo box
var deviceName = cbVideoInput.Text;
// Mode from the combobox
var mode = cbVideoMode.Text;
if (!string.IsNullOrEmpty(deviceName) && !string.IsNullOrEmpty(mode))
{
// Find device
var device = (await DeviceEnumerator.Shared.DecklinkVideoSourcesAsync()).FirstOrDefault(x => x.Name == deviceName);
if (device != null)
{
// Create video source settings using device and mode
videoSourceSettings = new DecklinkVideoSourceSettings(device)
{
Mode = (DecklinkMode)Enum.Parse(typeof(DecklinkMode), mode, true)
};
}
}
// Set the video source to the VideoCaptureCoreX object
VideoCapture1.Video_Source = videoSourceSettings;
Set audio source.
// Create settings for the audio source
DecklinkAudioSourceSettings audioSourceSettings = null;
// Device name from the combobox
deviceName = cbAudioInput.Text;
if (!string.IsNullOrEmpty(deviceName))
{
// Find device
var device = (await DeviceEnumerator.Shared.DecklinkAudioSourcesAsync()).FirstOrDefault(x => x.Name == deviceName);
if (device != null)
{
// Create settings for the audio source using device
audioSourceSettings = new DecklinkAudioSourceSettings(device);
}
}
// Set the audio source to the VideoCaptureCoreX object
VideoCapture1.Audio_Source = audioSourceSettings;
Sample applications that use the Decklink source
- VideoCaptureCore
- VideoCaptureCoreX
Visit our GitHub page to get more code samples.