Skip to content

Instantly share code, notes, and snippets.

@imorrish
Created January 3, 2017 07:04
Show Gist options
  • Select an option

  • Save imorrish/e8e807c588c215b94267f3c4f28203b6 to your computer and use it in GitHub Desktop.

Select an option

Save imorrish/e8e807c588c215b94267f3c4f28203b6 to your computer and use it in GitHub Desktop.
Upload all files in a directory to Blackmagic ATEM Media Stills
Function Copy-ATEMUploadImages{
#<#
#.Synopsis
# Find all images matching ATEM resolution in a folder and upload to media pool
#.Description
# Uses SwitcherLib and mediaupload.exe to find all PNG images (can be changed to another format) in the specified folder
# and upload them to the media pool from a starting slot number (or from 1 if not specified)
#
# Requires ATEMLib.dll and MediaUpload.exe in the \documents\WindowsPowerShell directory
# Download them from https://1drv.ms/f/s!ApGpqMMpRLhiiv4zoZRIXcnbIInsLQ
#.Parameter Folder
# The full path to the image folder
#.Parameter StartingSlot - default is 1
# Slot number to start from
#.Parameter numSlots
# max slot count of your atem (20, 32 or 40) - default is 20
#.Parameter ATEMip
# Atem IP address - default 192.168.10.240
#.Example
# Copy-ATEMUploadImages -Folder "C:\Users\imorrish\Pictures\"
# Copy-ATEMUploadImages -ATEMip "192.168.1.8" -Folder "C:\Users\imorrish\Pictures\720p" -StartingSlot 1
#
##>
[CmdletBinding(
DefaultParameterSetName=”Folder”,
SupportsShouldProcess=$True,
ConfirmImpact=’High’
)]
param
(
#Folder containing images
[String]$Folder,
#Starting slot # (Default is 1)
[Int]$StartingSlot = 1,
#Maximum number to upload (Do not exceed ATEM limit, default is 20 for TVS)
[Int]$numSlots = 20,
#AtemIP (Default is 192.168.10.240"
[string]$ATEMip = "192.168.10.240"
)
# -Filter for one file type, for multiple use -Include @("*.png", "*.jpg","*.tga","*.gif","*.bmp")
# Note: TGA not currently supported but working on it
$imageFiles = Get-ChildItem -File -Filter *.png -Path $Folder
$slotID = $StartingSlot
foreach($imageFile in $imageFiles){
#Prompt the user to do one at a time or all
If ($PSCmdlet.ShouldProcess($imageFile, $slotID)) {
Copy-ATEMUploadImage -File (Join-Path $Folder $imageFile) -Slot $slotID -ATEMip $ATEMip
$slotID++
if($slotID -eq $numSlots){Return} #we have reached the max
}
}
}
Function Copy-ATEMUploadImage
{
param
(
[String]$File,
[Int]$Slot,
[string]$ATEMip
)
# Just use command line utility as dll may conflict with JustMacros
Write-Output "Uploading image $($File)"
$exe = ".\documents\WindowsPowerShell\mediaupload.exe"
$args = "$($ATEMip) $($Slot) $($File)"
$proc = Start-Process $exe -ArgumentList $args -wait
}
#Copy-ATEMUploadImages -Folder "C:\Users\imorrish\Pictures\720p\BA-ISE" -StartingSlot 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment