EasyPTZ v1.1 (February 21, 2023)
I needed a simple controller for Dahua cameras on Windows and couldn't find anyting that wasn't over-built for my purposes or just plain slow so I built this. Posting in case it's useful to anyone else. It's designed to be an easy to use camera viewer as opposed to a full featured DVR or NVR. So far I've only tested with the Dahua SD49225T-HN but it *should* work with any Dahua camera.
Features
- Super simple interface, just PTZ (pan, tilt and zoom) and presets.
- The numbered buttons open presets by default but can be configured to open tours, patterns, scans or other cameras.
- Full joystick support! Use any cheap gaming joystick to pan (left stick) and zoom (right stick up/down) and focus (right stick left/right). And the buttons do the same thing as the GUI buttons do (joystick button2 is the same as GUI button 2 etc). With the 25x zoom from my camera it makes me feel like I'm using a flight simulator game and flying around.
- Click or touch the screen to pan the video
- Low latency, the camera delay should only be about half a second even when viewing over the internet, and very low CPU load.
- Supports unlimited cameras, press shift and the number keys to switch between them (or use the Cameras menu up top).
- Customizable interface: can launch in any state (regular, maximized or fullscreen) or any monitor.
- Gets the list of presets from your camera and lists them by name, which is a lot easier to remember than preset numbers.
- Currently only supports PTZ on Dahua cameras, but would be easy enough to expand it so it controls other camera brands too. If anyone has a Hikvision camera I can test with (remotely works), let me know.
- Can view any camera with a fixed URL. Can even view any Nest Cam using these instructions (and search for "camera4" in the config file docs for a sample Nest Cam).
Keyboard Controls
- Arrow keys move the camera around
- - and + keys zoom the camera (no need to press shift for the + key, the = key works too)
- [ and ] keys focus the camera
- The spacebar returns you to where you were before clicking a preset button.
- Number keys trigger the preset buttons, shift number keys switch between cameras. For example press shift 2 to open camera 2 as defined in the config file. Control plus number fires buttons 11-20 (for example control-5 fires button 15), alt plus number fires buttons 21-30, control-alt-number fires buttonns 31-40.
- F or F11 or ENTER toggles fullscreen. Note that there's two fullscreen modes, one with onscreen buttons and one that's just video, keep pressing the key to cycle through them.
- G takes a screenshot, H takes a screenshot and opens it.
- R goes to a random preset.
- Control left/right arrows goes through the preset history. In other words press control-left arrow to return to a preset you were looking at earlier. Handy for returning to a previous preset, especially when doing a tour of random presets.
- Control-shift up/down arrows changes sound volume.
- Control up/down arrows navigates through the list of cameras if you have more than one.
- Press "P" to show/hidie the Presets Window, or right-click the Video window.
- If the Presets Window is visible (Presets -> Presets Window, or press P), you can type numbers directly and then click Enter and it'll go to that preset. Or type 3 numbers (for example "003" goes to preset 3). Note while you type the number appears at the bottom of the Presets Window.
Mouse/Touchscreen Controls
- Click or touch the screen to pan, distance from center controls the speed.
- Click or touch the top left and right corners to zoom, bottom left and right corners to focus.
- Mouse wheel zooms.
- Right click the video to show/hide the Presets Window
Joystick Controls!
- By default the left joystick controls pan, the right joystick controls zoom (up/down) and focus (left/right), but you can reassign any joystick axis in the config file.
- The joystick buttons do whatever the GUI buttons do. For example joystick button 1 does whatever GUI button 1 does. By default that goes to camera preset 1 but you can make it launch any preset, tour, pattern, scan or open another camera.
- Note that you can look at the bottom of the log window (File -> Show Log Window) to see what joystick button you're pressing. Handy for configuring that button.
- If you'd like, you can tune the joystick a bit in the config file by setting "joystick_max_pan_speed" and "joystick_deadzone"
Config File Notes
Here's the docs for editing the config file. For now you make all the configurations there. Just click File -> Settings and edit the values that are already present. Once the features settle down I'll build a GUI for this.
Known Issues and Troubleshooting
- With Windows 10, some installations will move all the files to the cache directory, and it won't save the config file. The fix for now is to run the program as administrator (right-click EasyPTZ.exe and choose Properties then check "run as administrator").
- If the camera opens but stays frozen try increasing the prebuffer_ms in the config file. Start with 500. A higher value will have more latency but will be more stable.
- Sometimes things get messy when trying to close the program when in full fullscreen mode. Workaround for now is to exit fullscreen mode before closing.
- Please let me know any others.
To Do
- Make a GUI for the configs.
- Add PTZ support for other cameras, maybe via ONVIF?
Updates
- v1.1 (Februrary 21, 2023): Changed the install location to c:\EasyPTZ to make editing the config file easier.
- v0.92 (November 29, 2019): A big reduction in latency (delay) when viewing a camera outside the immediate network. Also added support for Nest Cams! It's a little jerky, but works. Search for "camera4" in the config file notes for a sample camera (and enjoy the view of the beach!)
- v0.91 (November 4, 2019): Added the ability to switch cameras during tours of presets. So it's now possible for example to show camera1's preset 1 for 5 seconds, then go to camera2's preset 1 for 5 seconds, etc. See the notes on editing the config file for more details (search for "customtour").
- v0.904 (October 23, 2019): Fixed the keyboard shortcut for focus. Now the [ and ] keys work for focusing.
- v0.903 (March 13, 2019): It now remembers the last camera opened and opens that on startup. And for now I disabled right-clicking to open the Presets window, since on a Surface I kept opening the presets menu accidentally. Feedback invited.
- v0.901 (March 2, 2019): Added basic camera iris control, the ability to remap joystick buttons without mapping the onscreen button, added "Tour of Random Presets" to the top of the Presets pulldown (chooses a random preset every 8 seconds), and ability to change keyboard pannning speed.
- v0.8996 (February 23, 2019): Added a Presets Window popup for easier presets access.
- v0.8995 (February 21, 2019): Greatly improved joystick support, and all joystick axis are now assignable. Large lists of presets get divided into submenus under the Presets menu.
- v0.8993 (February 20, 2019): Added some volume controls.
- v0.8992 (February 19, 2019): Added the ability to use "basic" authentication for the cameras (as opposed to just digest auth).
- v0.896 (February 15, 2019): Will print an error message to the log widnow (File -> Show Log Window) when loading a preset if there's an error. More debugging to come.
- v0.894 (February 15, 2019): Preset names are now retrieved from the camera! Can override the names in config file. Can now start in any state on any monitor. Added commandline args to control laucnh state. Fixed customtours. Control-left/right arrows navigates preset history. Fixed unicode support.
- v0.893 (February 14, 2019): Fixed the buttons, added the Presets menu, Camera menu now shows camera name if set in config file, added random preset button (R), added ability to specify the snapshots folder.
- v0.891 (February 13, 2019): Faster startup time, additional fullscreen modes, added the ability to have up to 30 cameras, and a bunch of under the hood improvements
- v0.872 (October 30, 2018): Made some improvements to focusing (pressing [ or ] keys or joytsick). Before it would run autofocus sometimes afterwards, losing any focus changes. Also some more mouse controls (corners control zoom and focus). And added the ability to have custom image overlays on each camera, will document shortly, let me know if you need deets sooner.
- v0.87 (October 29, 2018): Fixed issue with video window not detecting mouse clicks in some versions of Windows, and fixed issue where arrow keys sometimes stop responding. Yee haw.
- v0.83 (October 24, 2018): Added gesture support! Click or touch the video to pan.
- v0.8 (October 22, 2018): Added screenshot ability, lots of fixes.
- v0.7 (October 17, 2018): Repacked with current version of VLC included.
- v0.6 (October 12, 2018): Some love given to the GUI, and packing the VLC library with the installer. Experimental.
- v0.5 (October 11, 2018): joystick support! And it sucks considerably less. Still swatting bugs but getting there.
- v0.2 (October 9, 2018): much less latency, an installer, and lots o fixes.
- v0.1 (October 8, 2018): first version released