# Any dev considered about PTZ control in the future ?



## Lucdelaselle (May 24, 2019)

Hey !
I start to discover OBS, and i love it.

I'm a sound guy first, but i do quite a lot of live music video shooting, and i got tired of sync files into editing softs and spend hours on editing.
So i'm considering editing live with OBS, using PTZ cameras, and recording/streaming live.

I just tested one, and i had a hell of a day trying to find a soft to control preset positions of the camera, with some speed control during the switching of presets, like what is available in VMix (and i'd rather use OBS, for many reasons).

I was then wondering, if it was on the way somehow :)


----------



## dodgepong (May 24, 2019)

What kind of PTZ camera do you have? If you have one from PTZOptics, they have an OBS plugin that gives you a PTZ controller: https://obsproject.com/forum/resources/ptzoptics-camera-controller-for-obs.673/


----------



## Lucdelaselle (May 26, 2019)

dodgepong said:


> What kind of PTZ camera do you have? If you have one from PTZOptics, they have an OBS plugin that gives you a PTZ controller: https://obsproject.com/forum/resources/ptzoptics-camera-controller-for-obs.673/



No, i got models from a company called Flyan Electronics.
I tried of course that plugin with no chance.
But i tried the demo version of VMix, and the cameras work on the inbuild PTZ control module, with the Sony Visca protocol.
I guess PTZOptics have limited their plugin to their own cameras, which is understandable.
Thanks for the advice though !


----------



## dodgepong (May 27, 2019)

Does your PTZ camera not already come with control software? I admit I'm curious what advantage you would have from controlling it via OBS. Are you mostly interested in tying scene switches to camera positions?


----------



## Lucdelaselle (May 27, 2019)

dodgepong said:


> Does your PTZ camera not already come with control software? I admit I'm curious what advantage you would have from controlling it via OBS. Are you mostly interested in tying scene switches to camera positions?



I can access HTTP server of the camera via browser and control position, true, and i even programmed scripts on Firefox to access presets with just clicking those scripts.
But it's missing a speed control when the camera is switching to a new position, it just goes quick to that new position.
What would be great, as what we can find in the VMix functions, is a speed control on that moving positions, so that the camera could make slow panoramic from a position to another. I think the PTZOptics plugin has this function.
Actually, what would be great, would be that same plugin with open ports or with different protocol options, so that it could control any camera brand.
Thanks for your curiosity !


----------



## PTZOptics (Jun 16, 2019)

Lucdelaselle said:


> I can access HTTP server of the camera via browser and control position, true, and i even programmed scripts on Firefox to access presets with just clicking those scripts.
> But it's missing a speed control when the camera is switching to a new position, it just goes quick to that new position.
> What would be great, as what we can find in the VMix functions, is a speed control on that moving positions, so that the camera could make slow panoramic from a position to another. I think the PTZOptics plugin has this function.
> Actually, what would be great, would be that same plugin with open ports or with different protocol options, so that it could control any camera brand.
> Thanks for your curiosity !



We have made some more improvements to the app which include the ability to have variable PTZ camera speeds. We have also finally finished the Mac version of the plugin.


----------



## PTZOptics (Jun 16, 2019)

dodgepong said:


> Does your PTZ camera not already come with control software? I admit I'm curious what advantage you would have from controlling it via OBS. Are you mostly interested in tying scene switches to camera positions?



We have created an integration to add hotkeys support. So this will help tie together some of the advanced functionalities that users have been requesting.


----------



## Lucdelaselle (Jun 16, 2019)

PTZOptics said:


> We have made some more improvements to the app which include the ability to have variable PTZ camera speeds. We have also finally finished the Mac version of the plugin.


Well, that's great news !
Still, i just tried that version, and can't access my camera, which isn't a PTZOptics one, but a Flyan product : FLA-HD520ST.
It's supposed to use some Sony Visac over IP protocol.
I can have it controled by VMix, and a softwarecalled PTZJoy from Rocosoft.
Is your app and plugin dedicated to PTZOptics camera only ?


----------



## PTZOptics (Jun 18, 2019)

Lucdelaselle said:


> Well, that's great news !
> Still, i just tried that version, and can't access my camera, which isn't a PTZOptics one, but a Flyan product : FLA-HD520ST.
> It's supposed to use some Sony Visac over IP protocol.
> I can have it controled by VMix, and a softwarecalled PTZJoy from Rocosoft.
> Is your app and plugin dedicated to PTZOptics camera only ?


Yes, this plugin works for PTZOptics camera only


----------



## glikely (Oct 28, 2020)

I've started a project to work with Sony VISCA cameras. Very basic at the moment and lots to add, but help would be appreciated if you want to pitch in. Here is the github link:









						GitHub - glikely/obs-ptz: OBS Pan Tilt Zoom camera control plugin
					

OBS Pan Tilt Zoom camera control plugin. Contribute to glikely/obs-ptz development by creating an account on GitHub.




					github.com


----------



## Lawrence_SoCal (Oct 28, 2020)

glikely said:


> I've started a project to work with Sony VISCA cameras. Very basic at the moment and lots to add,


Best Wishes and I'll be keeping an eye out. Are you going to post about your plugin at https://obsproject.com/forum/resources/

In reply to @*dodgepong,* yes camera control based on scene is exactly what I'm looking for. In our case, HoW, and my OBS setup has a scene count now of ~25
I picked up a Panasonic AW-HN38 NDI 22x camera yesterday. For volunteers, the more I can automate the better so looking forward to better PTZ camera control from OBS


----------



## glikely (Oct 29, 2020)

Lawrence_SoCal said:


> Best Wishes and I'll be keeping an eye out. Are you going to post about your plugin at https://obsproject.com/forum/resources/



Thanks!

As soon as the plugin is in a useful state I will submit it as a resource. I'm getting close. I've just added multiple PTZ device instances, but need to add a way to select between them. I also need to make it cross-platform. At the moment I'm developing on Linux, but it should be buildable on Windows and OSX too.


----------



## teisen (Nov 3, 2020)

@glikely I am interested in contributing to your plugin. I am a java and js developer so bear with me on getting back up to speed on the syntax. I am looking to add generic PTZ support for NDI cameras. Looks like your architecture is set up in a way to support multiple protocols. What do you think? One of my use cases is that I can define a position per scene, so that when I select a new scene that contains a PTZ camera position it will first send request to reposition and then wait specified milliseconds before switching to the new camera. Toby


----------



## glikely (Nov 3, 2020)

@teisen: Great! I would appreciate the help.

I absolutely do intend to support multiple camera protocols. At the moment I'm using libvisca as the backend, but I want to refactor libvisca into some kind of "libptz" that abstracts the details behind a common API.

Triggering presets on selecting a scene is certainly doable.


----------



## dabldgd (Nov 13, 2020)

I have been working on SW to control Sony RS-232 VISCA cameras for most of the year ... and have recently been trying to integrate with the generally undocumented UDP interface that Livestream Studio provides for this. I am putting this effort on the shelf due to apparent errors in the interface.

I have a stand-alone windows program (in regular, good-old C, built with msys64 and Gtk3+) that controls pointing, recalls and sets presets, controls camera exposures. I have built a camera simulator for testing. My next effort will be incorporate camera color / white balance control. I choose to build / code from the bottom-up, rather than using one of pre-existing libraries.

The specific command sequences used for camera control are treated as "data" and could be adapted for other cameras (if the command sequences are documented). My camera control code is pretty independent of the Windows UI code.

I have experimented with OBS and am interested in participating in this project - especially if my current efforts are useful.

Dave


----------



## glikely (Nov 14, 2020)

Hi Dave,

Sounds interesting. I'm also using Sony VISCA cameras that will talk either RS-232 or UDP. I've only got RS232 working at this point, but UDP is on my to-do list.

I'm hoping it will be easy to add more protocols to the plugin. I've created a common base class for all PTZ devices which each protocol can inherit. Most of the plugin won't need to care about protocol-specific details.



dabldgd said:


> I have a stand-alone windows program (in regular, good-old C, built with msys64 and Gtk3+) that controls pointing, recalls and sets presets, controls camera exposures. I have built a camera simulator for testing. My next effort will be incorporate camera color / white balance control. I choose to build / code from the bottom-up, rather than using one of pre-existing libraries.



I'm particularly interested your camera simulator. I've started to contribute to libvisca (also plain old C), and it has been an excellent starting point, but it is lacking in at kind of test suite. Have you posted any of your choice publicly? If so, what license are you using?

Ultimately I want to refactor libvisca into a more generic libptz that can speak multiple protocols, but for right now I'm focusing on core functionality.


----------



## glikely (Nov 14, 2020)

dabldgd said:


> I have experimented with OBS and am interested in participating in this project - especially if my current efforts are useful.



I would very much appreciate the help! Take a look at the TODO file in the GitHub repo. I've tried to keep it up to date. My background is the Linux kernel, so writing C++ Qt code is all new for me! Just let me know what you plan to work on so we're not duplicating work. Patches can be sent as GitHub pull requests.


----------



## electronic.spacemonkey (Nov 15, 2020)

Hello!  Would this plugin work for getting simple zoom and pan functionality from e.g. a logitech C922 or similar?  I know it's digital, but even just being able to hotkey the zoom functionality would be great if it's possible.  I teach and deliver training online and t's not practical to open the camera properties / control window to use the slider control while delivering a session., as its far slower than a hotkey!

P.S. Sorry if this is a stupid question - I'm a relative newbie to OBS...  Thanks in advance for the help :-)


----------



## glikely (Nov 16, 2020)

electronic.spacemonkey said:


> Hello!  Would this plugin work for getting simple zoom and pan functionality from e.g. a logitech C922 or similar?  I know it's digital, but even just being able to hotkey the zoom functionality would be great if it's possible.  I teach and deliver training online and t's not practical to open the camera properties / control window to use the slider control while delivering a session., as its far slower than a hotkey!
> 
> P.S. Sorry if this is a stupid question - I'm a relative newbie to OBS...  Thanks in advance for the help :-)



Not a stupid question at all! Yes, I think it is entirely feasible to wire up digital zoom control on fixed webcams, or even create a 'virtual' PTZ that scales and pans any OBS source. I think it would involve creating a new PTZDevice object and wiring it up to the translation controls of a source.

I'll add it to the wishlist. I'm unlikely to get to it anytime soon, but if you want to give it a shot, I'd be happy to merge in the changes.


----------



## glikely (Nov 19, 2020)

Update: I've got scene tracking working with the plugin now. If the PTZ device name matches a scene name, then it can automatically select that PTZ device when the scene becomes the active program or preview scene. Basic gamepad support is also working.


----------



## electronic.spacemonkey (Jan 28, 2021)

glikely said:


> Not a stupid question at all! Yes, I think it is entirely feasible to wire up digital zoom control on fixed webcams, or even create a 'virtual' PTZ that scales and pans any OBS source. I think it would involve creating a new PTZDevice object and wiring it up to the translation controls of a source.
> 
> I'll add it to the wishlist. I'm unlikely to get to it anytime soon, but if you want to give it a shot, I'd be happy to merge in the changes.



@glikely  - only just saw your reply (I've not been on OBS Forums for a while!)  Thanks so much for adding this to the wishlist :) I'm not much of a coder these days... fairly certain my skills wouldn't be up to implementing this - and not sure anyone would want my code polluting the OBS codebase!!


----------



## glikely (May 10, 2021)

Another update: The plugin is functional in Windows now, and those adventurous enough to try building it can give it a try. Instructions are in the readme file on the GitHub page.









						GitHub - glikely/obs-ptz: OBS Pan Tilt Zoom camera control plugin
					

OBS Pan Tilt Zoom camera control plugin. Contribute to glikely/obs-ptz development by creating an account on GitHub.




					github.com


----------



## dgatwood (May 20, 2021)

glikely said:


> Hi Dave,
> 
> Sounds interesting. I'm also using Sony VISCA cameras that will talk either RS-232 or UDP. I've only got RS232 working at this point, but UDP is on my to-do list.



If you're still working on that, Marshall has a solid reference on the command set, including all the UDP details.

Marshall CV630-IP RS-232 Command Sethttp://www.marshall-usa.com › pdf › CV630-IP-R...

Or feel free to look at my minimalist VISCA implementation for VISCA-over-UDP for "inspiration" (and coding horror):



			https://github.com/dgatwood/ndi_camera_controlCZo
		


which works for at least the Marshall, NewTek, and (99% sure) PTZOptics.


----------



## glikely (May 22, 2021)

Thanks dgatwood. I'll take a look


----------



## glikely (Jun 5, 2021)

@dgatwood Thanks for the pointers. They helped. I've got VISCA over IP implemented now. It will be enabled in the next binary I release.


----------



## glikely (Jun 5, 2021)

I just released v0.2.0 which includes VISCA-over-IP support: https://github.com/glikely/obs-ptz/releases/tag/v0.2.0


----------



## dgatwood (Jun 7, 2021)

glikely said:


> @dgatwood Thanks for the pointers. They helped. I've got VISCA over IP implemented now. It will be enabled in the next binary I release.



No prob.  Glad that was helpful.  :-)


----------

