Video Switcher Scripts

by Jamie Zawinski

Our video infrastructure has gone through some changes over the decades.

These days, we have a bunch of HD SDI cameras routed into a Blackmagic Design Smart Videohub 20x20 video switcher. The SDI output from that switcher goes into a Roland VC-1DL frame sync, to smooth out the glitches that occur every time the switcher switches. (Without that, downstream HDMI devices freak out every time the input changes, since the source cameras do not have external sync.) Then that SDI output goes into a Blackmagic UltraStudio MiniRecorder which converts SDI to Thunderbolt. That goes into a Mac Mini, and we run OBS to encode the video and upload it to our video server.

Prior to 2018, we had been using the command-line version of Flash Media Live Encoder instead of OBS, which did basically the same thing, but worse.

Prior to 2014, we were doing analog NTSC SD video instead of HD, like animals. In the old days we were using Sony Handycam camcorders for cameras, a Knox RS16x16 video switcher, Dazzle Hollywood HW1X2 DV Bridge (long discontinued) to convert the baseband video to Firewire, and then again into FMLE. (Or, prior to 2009, into RealVideo.)

We also used to have a bunch of salvaged televisions around the club showing the various cameras. The way that worked was, fifteen outputs from the video switcher went into a set of NetMedia MM73 Triple Play RF encoders that put each of those signals onto a different UHF channel on what was effectively a private cable TV network inside the building. That ended in 2005 or so.

There's some software: This is a shell script that talks to a Knox RS16x16 video switcher over the serial port (or network, via a Lantronix UDS-10 serial-to-ethernet adapter). Command line options control what gets switched where. It also has provisions for looping and for randomly switching certain ranges of inputs to certain ranges of outputs. For a while, we tried to use a Matrix Switch Corporation MSC-HD815 video SDI switcher. That didn't work out. But this script controls it. This is the script that controls a Blackmagic Design Smart Videohub 20x20 video switcher. This is the one we're currently using.
switcher.cgi This is a CGI script that controls the switcher remotely: it lets you edit the switcher.conf file graphically. The various daemonized "switcher-cmd" scripts notice when the config file has changed and update what they're doing to the switcher hardware.

Here's an example of what it looks like when it is running (no, you can't use this page to control our cameras!) The rows represent inputs (cameras) and the columns represent outputs (TV channels, and the webcam.) A checked box means that the switcher may connect that input to that output. So, each time delay seconds pass, the switcher looks at the set of allowed inputs for each output and picks one at random.

Back in the analog days, we also had a couple of Panasonic WV-NS324 servo-mounted video cameras. This model of camera was cool in that it had a "real" video output, but also has an ethernet interface and a built-in web server, so you could directly control it over the net.

But, it was very much not cool in that every now and then it would get confused and all of its preset camera positions would shift by around 30 degrees, so it would suddenly be pointing at completely different parts of the room than you wanted until you manually re-enter all the presets. Maybe there was a belt or gear slipping inside it or something; I couldn't figure out what the cause is. This problem started only a few weeks after I bought the camera, and the response from both Panasonic and the store I bought it from was, basically, "sucks to be you."

Since we've switched to HD, we don't use these any more, but there's some code: This script that reads the same config file that switcher-cmd does, and based on the commands in that file, tells the camera to point at one of its preset positions. In this way, I have a single config file that controls both the switcher and the robo-camera (and that file is written by the switcher.cgi web page.)
pancam.cgi The WV-NS324 has a built-in web server, with controls that let you manually zoom the camera, save positions as presets, etc. Those web pages have some problems, however. They're overly complicated (many commands are spread out across multiple pages), but most importantly, the "joystick" control on the web pages (by which you actually move the camera) doesn't work in Mozilla or Safari (it was coded for MSIE and Netscape 4.x only.)

So, I wrote my own UI for camera control, that works by posting to the underlying "control" URLs on the camera, bypassing the on-camera user interface. Works pretty good.