PTZ Camera Control App

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.


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

22 Replies to “PTZ Camera Control App”

  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!

  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)

  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

  4. Hi Jonathan
    The Zip file for the PTZ Control appears to be corrupted. Have downloaded it on different PC’s and all the same.

    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.

  5. 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.

  6. 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.

  7. 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.


  8. I’ve just installed the DMG version on OS/X 10.10 (I can’t upgrade further cause I’ll break QLab free), and it’s very spiffy looking, but it won’t actually drive the camera. I’ve set the IP, and I know it’s correct cause I can get to the web UI of it there… but I don’t see a place to put a username and password; can I hack those into the IP field in URL format?

    Do you have plans to do any more function extension on the program at this time? I see you’ve GPLd it, but I didn’t want to shoot at the same targets you already are…

    Multi-camera would be really spiffy, though I expect that allowing moves to complete in background while the user changes camera selection would be fun…

  9. Nice to see a Kingdom Hall app, thank you brother. We just put a 12x SDI in at our hall and I very much look forward to using this software tomorrow, looks perfect.

  10. Hi Johnathan. Nice work on this! I’ve hacked the app a bit to make presets a bit friendlier for my church volunteers. First, the preset buttons can now have user-defined labels on them. Secondly, I got rid of the modal for setting the presets, and accomplish setting them with a CTRL-click on the interface instead. I also fixed a couple of cosmetic bugs related to clear_active_preset(). If you’d like, I’d be happy to share what I’ve done.

        1. Good Afternooon Jonathan, I need exactly the same Kingdom Hall interface. Can I receive your HTML Controller incl. all necessary files. Thank a lot. Greating from Switzerland.

          1. The link in the post, Github Repo, has all the code. You can download all the files if you go to that page, click the green “Code” button and choose “Download ZIP”.

  11. Hello Jonathan – what a brilliant app!
    I was wondering if you consider modifying this or releasing a version that allows remote control of a PTZ camera connected to a LifeSize Express 220 video conference unit?
    The connection to the LifeSize unit is made over SSH, with full U D L R Z-in Z-out and preset saving of camera positions using commands sent over SSH.

Leave a Reply

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