PTZ Camera Control App

I was recently part of a team responsible for installing PTZ (pan, tilt, zoom) cameras at our local congregation. After looking long and hard for a quality and affordable solution, we ended up with two cameras from PTZOptics. One of the key features we needed in a PTZ camera was the IP stream and control. While the hardware for these cameras is great, the software left a lot to be desired.

The provided software was free and open source. That’s great, but it was a very old html and javascript app, all written with tables and inline css and javascript. In addition it was very buggy, some things as simple as typos meant entire features of the camera were rendered broken. So, I got started looking through the code and at first was just going to fix and clean up what they had provided. After spending some time with it I decided it would be worth it to completely start from scratch.

CameraControlThe base functionality of the camera is controlled through a series of urls passed over IP to a CGI script installed in the camera itself. This meant all I had to do was send a url with whatever parameters it called for to the camera’s IP address on the local network. I ended up doing this with jQuery and AJAX requests. The basic UI was built on top of Bootstrap overlaid with custom images and design for all the buttons and pieces of the interface. Rewriting the app also gave me a chance to implement some features the original didn’t have, like a kind of auto-pan function, and saving settings to HTMLs local storage for quick easy setup.

Once everything was in place I realized it could fairly easily be converted into an actual desktop app. Rather than using a web browser to access it, including all the clutter and overhead that comes with, I could have it run in it’s own window and keep the desktop much cleaner. I had never used Electron before but I had heard of it and knew that Github Inc. had built their Atom editor using it. Basically, it packages up web technologies (HTML, Javascript, and CSS) into native OSX, Windows, and Linux apps. After reading through some of the basic docs and going through the starter project I was pretty certain I could use it to build my web app into a desktop app.

A few terminal commands later I had a native Mac OSX version of my web app. This meant I could give it an icon, have it startup with the computer like I needed to, and keep it contained in it’s own small window. Probably my favorite part was designing the icon; I think it turned out pretty good. Once I had a basic app working I continued to tweak it until it felt solid. The last thing I did was to open source the project so anyone else in need of some better software for the PTZOptics cameras would have something more than the buggy old stuff to work with. If you’re interested in the code you can find it over at Github available under the GPL 3.0 license.

Update!

Added compiled, ready-to-use, release version of the app for both Mac OSX and Windows. You can get’em at GitHub here.

13 Comments

  1. This is amazing stuff! We need to talk! Were all impressed over here. If you have time please reach out to our lead engineer Matthew Davis. As you said we are more hardware guys and what you have done here looks clean and elegant!

    Reply

  2. Hi Jonathan,

    I just wanted to reach out to you and say amazing job on the GitHub project!

    I was really impressed.

    If you have a moment I would love to chat with you a little bit about your experience working with the camera and I always enjoy the chance to chat with a fellow techy.

    Hope to hear from you.

    -Matthew Davis (Product Manager for PTZOptics)

    Reply

  3. Hi Jonathan, can i get in touch with you please? We just installed the PTZoptics USB camera in our hall last week and I am still working on the best use of the camera and I would like to talk to you to see what you brothers do with the camera at your hall.

    thank you.

    Libor J

    Reply

    1. The Zip file shouldn’t be corrupt. It’s built automatically by github when you go to download it. Remember, when you unzip it, it’s just a directory with files and folders in it, not a packaged app.

      Reply

  4. Hi Jonathan,

    Have you tried embedding a copy of the live stream into the your app? I was thinking it would be handy for previewing the changes if you aren’t near a monitor. I may give this a try over the holidays.

    Reply

  5. I briefly tried it tonight and mostly it works OK, but it seems that whenever I pan or zoom, it keeps on going until the camera reaches the end of the range. Is there a way to stop this from happening? I want to click the button and have it zoom/move a small amount and then stop.

    Reply

  6. Hi Jonathan:

    Great app. question when I download the full installer app for OSX it does not have the icons as for the presets as shown above. Am I missing something. I”m looking at using this at my KH.

    thanks
    Robert..

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *