Decklink

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.

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 https://1drv.ms/u/s!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 https://1drv.ms/u/s!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)" 

#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
#$devices[1].WriteConfigurationToPreferences() 

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s