CasparCG automation with Powerhell and X-keys

Here is a project which used JustMacros to automate CasparCG to play a loop video for rear projection in a scene of a Christmas production.

The challenge was that we (Tom) wanted to fade the video in but also adjust the video contrast and color due to the rear projection and impact of the house lights.

It looked better than this in the live performance…

This was the script assigned to the JustMacros X-keys button

CONST_CLIP_NAME = "COGS(WGTN)_3(10MINLOOP)";
if EnviroRead( "rearslide" ) ==  "on" then
CasparSendRaw(1,’MIXER 1-10 OPACITY 0 25 easeinsine’);
CasparSendRaw(1,’MIXER 1-9 OPACITY 0 25 easeinsine’);
XKeysSetButtonBlueLEDState( 1,12,"False" );
EnviroWrite( "rearslide" ,  "off");
else
EnviroWrite( "rearslide" ,  "on");
CasparLoadToLayerBG( 1, 1, 10, CONST_CLIP_NAME, "True", "False");
CasparSendRaw(1,’MIXER 1-9 BLEND Multiply’);
CasparSendRaw(1,’MIXER 1-10 LEVELS 0 1 1 0 0.75 1 Linear’);
XKeysSetButtonBlueLEDState( 1,12,"TRUE" );
CasparPlayLayer( 1, 1, 10 );
CasparSendRaw(1,’MIXER 1-10 OPACITY 0.80 25 easeinsine’);
CasparSendRaw(1,’MIXER 1-9 OPACITY 1 25 easeinsine’);
VSLog("rearslide on");
end;

I can now do the same thing using PowerShell

$ClipName = "COGS(WGTN)_3(10MINLOOP)"
if($rearslide -eq "on"){
$casparcg.sendCommand("play 1-1 ARISE_HeyO")
$casparcg.sendCommand("MIXER 1-9 OPACITY 0 25 easeinsine")
$xkeys.SendData(2,1,0)
$rearslide = "off"
}
else{
$rearslide = "on"
$LoadRearSlide = New-LoadbgCommand -autostarting False -channel 1 -layer 10 -media
$ClipName -looping True
$LoadRearSlide.execute([Ref]$Global:casparcg)
$casparcg.sendCommand("MIXER 1-9 BLEND Multiply")
$casparcg.sendCommand("MIXER 1-10 LEVELS 0 1 1 0 0.75 1 Linear")
$xkeys.SendData(2,1,1)
$PlayRearSlide = New-CgPlayCommand -channel 1 -layer 10
$playRearSlide.execute([Ref]$Global:casparcg)
$casparcg.sendCommand("MIXER 1-10 OPACITY 0.80 25 easeinsine")
$casparcg.sendCommand("MIXER 1-9 OPACITY 1 25 easeinsine")
Write-Host "rearslide on"
}

 

Advertisements

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