Elgato Stream Deck and Windows PowerShell

Thanks to a GitHub project, I was easily able to interface this cool keypad with Windows PowerShell.

It is as easy as this…

add-type -path ‘WindowsPowerShell\StreamDeckSharp.dll’

$deckInterface = [StreamDeckSharp.StreamDeck]::FromHID()

$POSH = [StreamDeckSharp.StreamDeckKeyBitmap]::FromFile(“.\Pictures\PowerShell72x72.png”)

$deckInterface.SetKeyBitmap(0, $POSH.CloneBitmapData())

$KeyEvent = Register-ObjectEvent -InputObject $deckInterface -EventName KeyPressed -SourceIdentifier buttonPress -Action {write-host $eventArgs.key)}

You can download the StreamDeckSharp dll’s from here https://1drv.ms/u/s!ApGpqMMpRLhikIdCTPjBasmUmcKOtw (remember to unblock them).

You can see a video of how I have used this to control a Blackmagic ATEM switcher.

Advertisements

Document Blackmagic VideoHub with PowerShell and Excel

You can use telnet to connect to a VideoHub and output the mapping but I wanted something that looked more like the way audio software like x32 or Dante shows a matrix.

So I have written a PowerShell script that outputs the current configuration as an Excel file

Download the script from https://gist.github.com/imorrish/b03fc2e5fbd3fc64de1d010ac79ad0b5

If you are not interested in how the code works …

Here is an exe version that should create the same Excel file of your video hub configuration.
Exe defaults to assuming the local PC is a server for a studio hub. Otherwise you can add an ip address on the command line to connect to a smart hub.
You only need .Net 4.6.1 runtime and Excel 2010 or better, I think (keen for someone to test for me)
https://1drv.ms/u/s!ApGpqMMpRLhikIY6oZRIXcnbIInsLQ
Remember to unblock the file after downloading.

I will add lock information as well as Video Monitor outputs for hubs that support that.

FFMPEG WDM Capture for Decklink Cards.

It is preferable to use the WDM Decklink driver, rather than the dshow support, with ffmpeg (or in fact any Windows software).This requires using a version of ffmpeg that has the Blackmagic WDM drivers included (see my downloads page for a possible source).

To use WDM Decklink driver, use a command like this:

ffmpeg -f decklink -i “DeckLink SDI 4K@14”

Use the number in the left column below after the @ symbol for defining the input source format.

Supported formats for ‘DeckLink HD Extreme 3D+’:
1       720×486 at 30000/1001 fps (interlaced, lower field first)
2       720×486 at 24000/1001 fps
3       720×576 at 25000/1000 fps (interlaced, upper field first)
4       1920×1080 at 24000/1001 fps
5       1920×1080 at 24000/1000 fps
6       1920×1080 at 25000/1000 fps
7       1920×1080 at 30000/1001 fps
8       1920×1080 at 30000/1000 fps
9       1920×1080 at 25000/1000 fps (interlaced, upper field first)
10      1920×1080 at 30000/1001 fps (interlaced, upper field first)
11      1920×1080 at 30000/1000 fps (interlaced, upper field first)
12      1920×1080 at 50000/1000 fps
13      1920×1080 at 60000/1001 fps
14      1920×1080 at 60000/1000 fps
15      1280×720 at 50000/1000 fps
16      1280×720 at 60000/1001 fps
17      1280×720 at 60000/1000 fps

 

Supported formats for ‘DeckLink SDI 4K’:

1 720×486 at 30000/1001 fps (interlaced, lower field first)
2 720×576 at 25000/1000 fps (interlaced, upper field first)
3 1920×1080 at 24000/1001 fps
4 1920×1080 at 24000/1000 fps
5 1920×1080 at 25000/1000 fps
6 1920×1080 at 30000/1001 fps
7 1920×1080 at 30000/1000 fps
8 1920×1080 at 25000/1000 fps (interlaced, upper field first)
9 1920×1080 at 30000/1001 fps (interlaced, upper field first)
10 1920×1080 at 30000/1000 fps (interlaced, upper field first)
11 1920×1080 at 50000/1000 fps
12 1920×1080 at 60000/1001 fps
13 1920×1080 at 60000/1000 fps
14 1280×720 at 50000/1000 fps
15 1280×720 at 60000/1001 fps
16 1280×720 at 60000/1000 fps
17 2048×1080 at 24000/1001 fps
18 2048×1080 at 24000/1000 fps
19 2048×1080 at 25000/1000 fps
20 3840×2160 at 24000/1001 fps
21 3840×2160 at 24000/1000 fps
22 3840×2160 at 25000/1000 fps
23 3840×2160 at 30000/1001 fps
24 3840×2160 at 30000/1000 fps
25 4096×2160 at 24000/1001 fps
26 4096×2160 at 24000/1000 fps
27 4096×2160 at 25000/1000 fps

Decklink Duo2/Quad 2

Card name will look something like ‘DeckLink Duo (2)’:

1 720×486 at 30000/1001 fps (interlaced, lower field first)
2 720×576 at 25000/1000 fps (interlaced, upper field first)
3 1920×1080 at 24000/1001 fps
4 1920×1080 at 24000/1000 fps
5 1920×1080 at 25000/1000 fps
6 1920×1080 at 30000/1001 fps
7 1920×1080 at 30000/1000 fps
8 1920×1080 at 25000/1000 fps (interlaced, upper field first)
9 1920×1080 at 30000/1001 fps (interlaced, upper field first)
10 1920×1080 at 30000/1000 fps (interlaced, upper field first)
11 1920×1080 at 50000/1000 fps
12 1920×1080 at 60000/1001 fps
13 1920×1080 at 60000/1000 fps
14 1280×720 at 50000/1000 fps
15 1280×720 at 60000/1001 fps
16 1280×720 at 60000/1000 fps

PowerShell Automation of FFMPEG

Want to create thumbnails from video files or convert from .ts to .mp4? FFMPEG can do it but the command line can be a bit tricky to figure out. There is a nice .Net library for automating ffmpeg that can be used in PowerShell. See NrecoSite

Example PowerShell:

# Download https://www.nrecosite.com/video_converter_net.aspx
# copy ffmpeg.exe to C:\Windows\SysWOW64\WindowsPowerShell\v1.0\
# Documentation - https://www.nrecosite.com/doc/NReco.VideoConverter/
$thumbnail = "D:\Capture\Conference_20170722_090251.png"
$video = "D:\Capture\Conference_20170722_090251.ts"

add-type -path 'C:\Users\imorrish\Documents\WindowsPowerShell\NReco.VideoConverter.dll'
$ffMpeg = new-object NReco.VideoConverter.FFMpegConverter
#Create thumnail
$ffMpeg.GetVideoThumbnail($video, $thumbnail,1653); #seconds from start
#Convert to MP4
$ffMpeg.ConvertMedia($video, "d:\capture\Conference_20170722_090251.mp4", [NReco.VideoConverter.Format]::mp4)

Sony BVS T-Bar reused

I picked up an old Sony BVS-3200 broadcast vision mixer from ebay (my first experience of the Global Shipping program and it actually works).

I’m still undecided whether I will be able to use the panel through the existing serial interface (need to get a frame to decode the messages), rip out the microprocessor and put in an Arduino (requires reverse engineering all the logic) or gut it for the parts to build my own panel.

Just testing the T-Bar as it is non-destructive to remove it for testing. Rather than using a potentiometer, Sony used a rotary encoder that outputs pulses (must be a technical name for this which I’ll find on Google eventually).

It actually outputs 2 signals so you can detect the direction by which line goes high first.

I get 536 counts from full movement of the T-Bar.

PowerShell and demo video showing this controlling the Blackmagic Design ATEM fader coming soon. In the mean time I’m also converting an old EchoLab MVS panel but that uses very simple circuit by the look of it so I’ll be replacing its Z80 processor with an Arduino.

Video:

https://youtu.be/dZNZ4jW0nuw

Frustrated with Windows default audio device changing?

You can include PowerShell commands to change the default device (for playback and recording) using PowerShell

Using this GitHub project https://github.com/jtheller/AudioDeviceCmdlets/tree/ce0bd480e96e934621c5ca6f846a65830c1a74d3

I found this useful when using a DVI Extender that would change the default audio to itself even though it required the main sound card to provide the audio into it.

Just install using the script below

#region Install code, just run once
$url='https://github.com/frgnca/AudioDeviceCmdlets/releases/download/v3.0/AudioDeviceCmdlets.dll'
$location = ($profile | split-path)+ "\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
(New-Object System.Net.WebClient).DownloadFile($url, $location)
#endregion

#run this or add it to your profile so the module is always imported
Import-Module AudioDeviceCmdlets

#List current audio devices
Get-AudioDevice -List | select Index,Default,Type,Name| ft

Output:

AudioDevices

ATEM SuperSource Box configuration using PowerShell script

I finally sorted the code for enumerating the collection of super source boxes in the 2 M/E and tested it this weekend.

Download the latest version here…

add-type -path 'C:\Users\imorrish\Source\Workspaces\VISE_ATEMLib\SwitcherLib\bin\Debug\SwitcherLib.dll'

add-type -path 'documents\windowspowershell\SwitcherLib.dll'
$Global:atem = New-Object SwitcherLib.Switcher("192.168.10.240")
$atem.Connect()
$Global:ME = $atem.GetMEs()
$SuperSources=$atem.GetSuperSource()
$SuperSources[0].InputFill=2001
$SSBoxes=$Atem.GetSuperSourceBox()
#Display current box values
$SSBoxes | ft
#Assign each box to object
$Box1=$SSBoxes[0]
$Box2=$SSBoxes[1]
$Box3=$SSBoxes[2]
$Box4=$SSBoxes[3]
#set options for Box1
$box1.PositionX = -4
$box1.PositionY = 6
$box1.Size = .25
$Box1.InputSource=1
$Box1.Enable = 1
#Put SuperSource on-air
$ME[0].Preview=6000
$ME[0].Cut()

Output

PS C:\Users\imorrish> $SSBoxes | ft
Enabled InputSource PositionX PositionY Size Cropped CropTop CropBottom CropLeft CropRight
——- ———– ——— ——— —- ——- ——- ———- ——– ———
1       1           -8        4.5       0.25 0       0       0          0        0
1       2           8         4.5       0.5  0       0       0          0        0
1       3           -8        -4.5      0.5  0       0       0          0        0
1       4           8         -4.5      0.5  0       0       0          0        0