Scheduling KiPro recording using Apple iCal

The pressure towards automation in our industry is a constant which beats at a more rapid pace every day. It is now a part of every broadcast facility on the planet. Whenever there is more to do with less people, scheduling of recorded content can be advantageous. Small market stations often times cannot afford complex automation systems. Larger market facility has some form of scheduling available, adding additional channels to expensive embedded systems can be cost prohibitive for special events or temporary ingest expansion.

AJA’s KiPro professional video recorder is an ideal tool for handling manual capture and playback. However, AJA has provided an API to allow other products to control the KiPro, so enabling automation is capable out of the box. Whether it is capturing multi-cam ISO feeds for special events or simply adding additional expansion, it can easily record video feeds directly to Apple ProRes to be immediately copied to central storage or edited directly from the record drive.

Apple’s iCal calendar software is a cost effective way to accomplish this task as it comes with very basic script tools and is included free of charge with every version of MacOS X dating all the way back to the beginning. The user interface is simple and can be understood by untrained operators.

Apple’s iCal software has the capability to run Applescripts using its “alarm” function. This workflow involves saving very simple one line Applescripts (two scripts per KiPro, one for stop, one for record) as well as one primary host script that interacts with the KiPro via the *nix CLI application cURL. This is just one example of control automation using the KiPro.

Below is a basic overview of the process in action.

Lets break down how to write our primary shell script.

#!/bin/sh

#grab the IP or DNS name of our KiPro as the first CLI argument
mykipro=$1

#grab the transport command as the first CLI argument
transport=$2

#define what to set our transport command to if "start" is selected
if [ $transport = "start" ]; then
	trigger=3
fi

#define what to set our transport command to if "stop" is selected
if [ $transport = "stop" ]; then
	trigger=4
fi

#set the value of our transport command for our cURL command
valuestring="newValue=$trigger"

#set the KiPro function to be transport control
paramstring="paramName=eParamID_TransportCommand"

#run cURL
# -s makes for silent output
# -d allows us to use HTTP POST commands to send individual fields

/usr/bin/curl -s -d $paramstring -d $valuestring http://$mykipro/options

We can save this script anywhere on our system, I’d recommend /usr/local/bin, /Library/Scripts, /usr/local/scripts. I have called this script kipro_trigger. We need to make sure it is executable.

shell> chmod +x /path/to/script/kipro_trigger

We can save this script anywhere on our system, I’d recommend /usr/local/bin, /Library/Scripts, /usr/local/scripts. I have called this script kipro_trigger. We need to make sure it is executable.

shell> /path/to/script/kipro_trigger ip.of.my.kipro start

and

shell> /path/to/script/kipro_trigger ip.of.my.kipro stop

If all is working, we should be starting/stopping our KiPro records each time we run this tool.

Now we need to set up our Applescripts so iCal can be used to trigger our KiPro. We are going to create two one-line Applescripts per KiPro we want to use. Since iCal has no way to include variables in its alarm options, we need to hardcode one script for record and one script for stop for each KiPro we want to use. For this example, my IP address is 192.168.3.168 and my script is /usr/local/scripts/kipro_trigger

Start script:

do shell script "/usr/local/scripts/kipro_trigger 192.168.3.168 start"

Stop script:

do shell script "/usr/local/scripts/kipro_trigger 192.168.3.168 stop"

Save as many script pairs as necessary into /Library/Scripts/Applescript.

Name them based on your KiPro naming. If the system at 192.168.3.168 is called “News”, name your scripts “News Start” and “News Stop”. In this example, my system is simply called “KiPro”, but we can save as many script pairs as we have KiPros.

The last step is setting up iCal to call these scripts for your scheduled timeframe. We need to make a new event in our calendar for the name of the recording we want to do. Set our from/to time to the event time and then add two alarms to the event. First alarm should “Run Script” for our Start event and should be set “on date” to the same time as the start date. Second alarm should “Run Script” for our Stop event and be set to “on date” for the end time.

The first script we ran could be used with any scheduling toolkit as well, including Apple’s launchd or linux cron. Since the software to run this scheduler is fairly light weight, just about any Macintosh system running OS X with a network connection will work, enabling re-use of aging systems and providing budget efficiencies while adding functionality to the plant.

Currently the scripts do not return any information regarding clip naming, so you will have to look at create dates/modified dates on the files and line them up to your scheduled records.

Categories AJA

4 thoughts on “Scheduling KiPro recording using Apple iCal

  1. Thank you so much for detailing this project! Would it be possible to write a similar script for use with different AJA products? LHi?

  2. Trevor, I actually wrote a very basic application that used VTRXchange in the past to do remote triggering of record and stop. Probably wouldn’t be difficult to adapt to work with iCal as well.

    That said, there are some far more feature rich and robust capture applications from the guys at Softron.tv (MovieRecorder) and ToolsOnAir (Just:In) to name a few.

    Given the changes coming soon as well with Control Room from AJA, I’m not sure how portable my old scripts would be, but it still makes for a decent article. I may write it up for quick/dirty scheduling without the added feature sets those other softwares provide.

  3. Hi- I saw this post and am interested in scheduling our ki pro to start recording at certain times; however, I’m not very experienced in dealing with applescripts and was wondering if you could help in showing what parts of the script I need to modify to work with my computer. Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.