Blackmagic Decklink card information and configuration settings from command line or Windows PowerShell script.

Supports multiple cards in a system. Can be used when wanting to automate/script the capture or playout with software like ffmpeg.

Updated [9-Aug-2017] with more configuration options for analog audio/video settings.

Still a work in progress and my goal is to be able to script things like live overlay key graphics from a PowerShell script.

Download the DLL from!ApGpqMMpRLhijeR1-4SVgqdytAUhmg
(Remember to unblock the file after downloading it) and place in your PowerShell directory.

Example PowerShell script showing how to display the cards I/O capabilities and set some options.

#download the DLL from!ApGpqMMpRLhijeR1-4SVgqdytAUhmg
# remember to unblock the file by right clicking > Properties > Unblock

# some constants
$VideoConnections = @{1 = "SDI"; 2 = "HDMI"; 4 = "Optical SDI"; 8 = "Component"; 16 = "Composit"; 32 = "S-Video" }
$AudioConnections = @{1 = "Embedded" ; 2 = "AESEBU" ; 4 = "Analog"; 8 = "Analog XLR"; 16 = "Analog RCA"; 32 = "Microsophone"; 64 = "Headphones"}
$VideoIOSupport = @{1 = "Capture"; 2 = "Playback"} 

add-type -path 'C:\Users\imorrish\Documents\WindowsPowerShell\decklink.dll'
$Decklink = new-object VISE_DeckLink.DeckLink
$Devices = $Decklink.DeckLinkDevices()
write-host "Number of devices detected: $($Devices.Count)"
#see all the methods for a device
$Devices[0] | get-member
#Check the Decklink API documentation to confirm some of the values (Audio level is -12 to +12)

#display video and audio in/out ports of each card
foreach ($device in $Devices){
    write-host "$($device.DisplayName)" -ForegroundColor red -BackgroundColor white
    Write-host " IO Support:"
    $VideoIOSupport.Keys | where { $_ -band $device.VideoIOSupport } | foreach { $VideoIOSupport.Get_Item($_)}
    Write-host " Input Video Connections:"
    $VideoConnections.Keys | where { $_ -band $device.VideoInputConnections } | foreach { $VideoConnections.Get_Item($_)}
    Write-host " Input Audio Connections:"
    $AudioConnections.Keys | where { $_ -band $device.AudioInputConnections } | foreach { $AudioConnections.Get_Item($_)}
    Write-host " Output Video Connections:"
    $VideoConnections.Keys | where { $_ -band $device.VideoOutputConnections } | foreach { $VideoConnections.Get_Item($_)}
    Write-host " Output Audio Connections:"
    $AudioConnections.Keys | where { $_ -band $device.AudioOutputConnections } | foreach { $AudioConnections.Get_Item($_)}

Write-host ""
# uncomment the next line if you want to see all properties
# $Devices

# set audio and video connections
# in this case there are 2 decklinks installed and I want to configure the 2nd one
$devices[1].ConfigAudioInputConnection = 8 # XLR
$devices[1].ConfigVideoInputConnection = 16 # Composite
# uncomment this if you want this to be saved as default when power is cycled
# Note: this requires the script to be "Run As Administrator" or you will get an error


5 thoughts on “Decklink

  1. is there a way to use this script to set the following decklink properties through powershell:
    1) analog video input levels (ability to set and/or reset to default)
    2) analog video output levels (ability to set and/or reset to default)
    3) set black level
    4) set the input conversion (HD(1080) to SD, HD(720) to SD, SD to HD, or none )
    5) set output conversion

    1. Hi,
      Sorry I have not implemented all features of the API yet. I was just thinking about getting back to this project as I now have a Duo 2 and need to be able to set the options for sub devices. It is 2nd on my priority list at the moment but may still be 3 or 4 weeks before I get to it. Will drop you an email when I have looked at the items above.

  2. do you have any more documentation on this? my decklink quad 2 keeps resetting after reboot and i would love to have a script to reset it up upon reboot. I need to change split the connections so ill have 8 ins/outs and change the resolutions to 720p 59.94. thanks

    1. Hi,
      Sorry I have not implemented sub channel configuration yet. But I do have a Duo 2 so I need to get this done for the same reasons.I might be able to get this done over Christmas.
      I had implemented most of the features requested below but have a few issues with a few of the values not being accurate.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s