Sony SNC-RZ30N ptz? remote host path?

Post here to ask any questions about hardware suitability, configuration in ZoneMinder, or experiences. If you just want to know if something works with ZoneMinder or not, please check the Hardware Compatibility sections in the forum, and the Wiki first. Also search this topic as well.
Post Reply
bjohnston
Posts: 4
Joined: Sat Jan 06, 2007 10:21 pm
Location: Canada

Sony SNC-RZ30N ptz? remote host path?

Post by bjohnston »

Has anyone had success setting up a Sony SNC-RZ30N camera with Zoneminder? Everything looks straightforward until I try to set up a monitor for it, I have been unable to look up or guess what the proper remote host path is for zoneminder to pick up the image stream?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

What do you get in a browser when you right click on top of the streaming image and select properties?
bjohnston
Posts: 4
Joined: Sat Jan 06, 2007 10:21 pm
Location: Canada

right click

Post by bjohnston »

well, interestingly enough, i had no luck doing that before, but i see now that if I right-click when it is using java applet and/or active-x to render in the browser, right-clicking does nothing. but after reading your comment I went back and also tried 'server push' option and right-clicking gave this under properties:

http://192.30.161.13/image?speed=0
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

If this camera uses activex, then it will not work with ZM unless you can grab a still jpeg. This of course it not the prefered mode but Linux does not support activex.
Check the manual and see if there is a way to get mjpeg, if not then the only way would be to capture still jpeg images.
bjohnston
Posts: 4
Joined: Sat Jan 06, 2007 10:21 pm
Location: Canada

sony

Post by bjohnston »

well, it's funny. it's the only camera i have that offers to open in a java applet viewer, an active-x applet viewer, and a server push applet viewer.

the active x viewer is only available as an option if using Internet Explorer, but when using Firefox it still offers java or server push

after your initial comment i tried this in the remote host path:
/image?speed=4

and it appears to work & give me 4 fps. i had to turn on the camera's built-in memory function though to get it to work this way, so it seems i am grabbing still jpgs from the camera. not sure. no luck getting the ptz functions to work though, unfortunate as this is the fastest ptz i've ever used.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

if you can get hold of or have the protocol for thic cam it can be added to zm, but zm needs to know what to tell the cam to do.
I assume then from your post that you have zm now grabbing images?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
bjohnston
Posts: 4
Joined: Sat Jan 06, 2007 10:21 pm
Location: Canada

control api for the snc-rz30n

Post by bjohnston »

Hi, yes. I have the snc-rz30n working using the remote path that I mentioned above. Seems to be no lag whatsoever and I can specify whatever frame rate I want by adding it as a parameter in the remote path.

As far as the control script, can you have a look at this link, I think this is the one needed? Question, can I add this into my system myself (I know nothing about programming) or do I wait for it to be added in at a future release of the zoneminder software?

http://www.zdo.com/articles/SonySNC.php
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

its of no use to me bbut one of the other lads might bbe able to use it. There was abbit on here a bit ago about creating your own ptz file but dont knopw where it is

good luck
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for the link. I will take a look and add it in, though I can't test it without access to a cmaera. I am half way through rewriting the PTZ control stuff so it should be easier to add in future anyway.
Phil
goreo95033
Posts: 3
Joined: Mon Apr 30, 2007 4:52 pm

CGI reference manual

Post by goreo95033 »

I've just started working with the SNC-RZ30N and ZM also. The manual mentions a CGI reference guide and to "consult your authorized Sondy dealer."

Currenly Google lists one here.

Hope it helps.

--Greg
User avatar
AmmarossDanan
Posts: 19
Joined: Tue Jul 03, 2007 10:05 pm
Location: Salt Lake, UT, US

Control Script

Post by AmmarossDanan »

I have a network-attached SNC-RZ30n that I've been dying to get a control script for, but sadly, only a serial-attached script was provided by ZM. So, using it as a bit of a reference, and also the PDF manual provided by goreo95033, I whipped up a functioning control script.

Code: Select all

#!/usr/bin/php
<?php
/*
 * Contributed by: Ammaross Danan
 * If this breaks your camera, it is not my fault.
 * Use at your own risk.
 * Some functions (such as sleep and wake) were ommitted.
 * The queryParameter function is supplied if you would like to fetch
 *   current settings from the camera. (not tested)
 * Manual: http://www.cs.unc.edu/Research/stc/FAQs/Cameras_Lenses/Sony/New%20SNC-RZ30N_CGI%20Manual%202.00EN.pdf
 */

$_ARG; // holds our command line arguments

// Decodes our command line arguments
function arguments($argv) {
    $_ARG = array();
    foreach ($argv as $arg) {
      if (ereg('--([^=]+)=(.*)',$arg,$reg)) {
        $_ARG[$reg[1]] = $reg[2];
      } elseif(ereg('-([a-zA-Z0-9])',$arg,$reg)) {
            $_ARG[$reg[1]] = 'true';
        }
   
    }
  return $_ARG;
}

function def(&$arg,$default) {
	if ( !isset($arg) )
		return $default;
	else
		return $arg;
}

// queries the camera for current stat of param
function queryParameter($param) {
global $_ARG;
	$fp = @get_file_contents("http://$_ARG[address]/command/visca-inquiry.cgi?visca=$visca", "r");
	if ( $fp == FALSE )
		; // error occured
	else
	{
		// Data is stored in post area at end of results. Problem is, it
		// doesn't follow standard \r\n\r\n to seperate it, but only a single
		// \r\n, so can't strstr for it... It does provide a content-length
		// parameter, so we use that value and step back from the end of
		// a stringified version of the file...
		$pos = strpos( $fp, "Content-Length: " );
		$pos2 = strpos( $fp, "\r\n", $pos );
		$content_length = intval(substr( $fp, $pos + strlen("Content-Length: "), $pos2-$pos ));
		$status = substr( $fp, $content_length*-1 );
		return $status;
	}
	return "";
}

// Issues the command to the camera
function doCmd($visca) {
global $_ARG;
	$fp = @fopen("http://$_ARG[address]/command/visca-gen.cgi?visca=$visca", "r");
	if ( $fp == 0 )
		; // error occured
	else
		fclose($fp); // we're fine
}

$_ARG = arguments($_SERVER['argv']); // $_SERVER for backwards compatibility
/* // Uncomment for DEBUG if you wish
$logfile = fopen( "/var/log/zmcontrol.log", "a" );
fprintf($logfile, "ARGV: %s\n", serialize($_SERVER['argv']) );
fclose($logfile);
*/

$visca = "";
switch( def($_ARG['command'],"") )
{
	case "move_stop":
		$visca = sprintf( "81010601%02X%02X0303FF", 0, 0 ); break;
	case "move_con_up":
		$visca = sprintf( "81010601%02X%02X0302FF", 0, def($_ARG['tiltspeed'],3) ); break;
	case "move_con_down":
		$visca = sprintf( "81010601%02X%02X0301FF", 0, def($_ARG['tiltspeed'],3) ); break;
	case "move_con_left":
		$visca = sprintf( "81010601%02X%02X0203FF", def($_ARG['panspeed'],3), 0 ); break;
	case "move_con_right":
		$visca = sprintf( "81010601%02X%02X0103FF", def($_ARG['panspeed'],3), 0 ); break;
	case "move_con_upleft":
		$visca = sprintf( "81010601%02X%02X0202FF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3) ); break;
	case "move_con_upright":
		$visca = sprintf( "81010601%02X%02X0102FF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3) ); break;
	case "move_con_downleft":
		$visca = sprintf( "81010601%02X%02X0201FF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3) ); break;
	case "move_con_downright":
		$visca = sprintf( "81010601%02X%02X0101FF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3) ); break;

	case "move_rel_up":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", 0, def($_ARG['tiltspeed'],3), 0, def($_ARG['tiltstep'],0x03CC) ); break;
	case "move_rel_down":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", 0, def($_ARG['tiltspeed'],3), 0, def($_ARG['tiltstep'],0xFCC4) ); break;
	case "move_rel_left":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), 0, def($_ARG['panstep'],0xF670), 0 ); break;
	case "move_rel_right":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), 0, def($_ARG['panstep'],0x0990), 0 ); break;
	case "move_rel_upleft":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3), def($_ARG['panstep'],0xF670), def($_ARG['tiltstep'],0x03CC) ); break;
	case "move_rel_upright":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3), def($_ARG['panstep'],0x0990), def($_ARG['tiltstep'],0x03CC) ); break;
	case "move_rel_downleft":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3), def($_ARG['panstep'],0xF670), def($_ARG['tiltstep'],0xFCC4) ); break;
	case "move_rel_downright":
		$visca = sprintf( "81010603%02X%02X%08X%08XFF", def($_ARG['panspeed'],3), def($_ARG['tiltspeed'],3), def($_ARG['panstep'],0x0990), def($_ARG['tiltstep'],0xFCC4) ); break;

	case "zoom_rel_tele":
	case "zoom_con_tele":
		$visca = sprintf( "810104072%1XFF", def($_ARG['speed'],4) ); break;
	case "zoom_rel_wide":
	case "zoom_con_wide":
		$visca = sprintf( "810104073%1XFF", def($_ARG['speed'],4) ); break;
	case "zoom_stop":
		$visca = "8101040700FF"; break;

	case "focus_con_near":
		$visca = "8101040803FF"; break;
	case "focus_con_far":
		$visca = "8101040802FF"; break;
	case "focus_stop":
		$visca = "8101040800FF"; break;
	case "focus_auto":
		$visca = "8101043802FF"; break;
	case "focus_man":
		$visca = "8101043803FF"; break;

	case "preset_goto":
		$visca = sprintf( "8101043F02%02XFF", def($_ARG['preset'],0) ); break;
	case "preset_clear":
		$visca = sprintf( "8101043F00%02XFF", def($_ARG['preset'],0) ); break;
	case "preset_set":
		$visca = sprintf( "8101043F01%02XFF", def($_ARG['preset'],0) ); break;
	case "preset_home":
		$visca = "81010604FF"; break;

	default:
		echo "Command not supported: " . def($_ARG['command'],"") . "\n";
		return;
}

doCmd( $visca );

// Any commands that require a timeout...
switch( def($_ARG['command'],"") )
{
	case "zoom_con_tele":
	case "zoom_con_wide":
		usleep(1000000*$_ARG['autostop']);
		doCmd( "8101040700FF" );
		break; // zoom stop
	case "move_con_up":
	case "move_con_down":
	case "move_con_left":
	case "move_con_right":
	case "move_con_upleft":
	case "move_con_upright":
	case "move_con_downleft":
	case "move_con_downright":
		usleep(1000000*$_ARG['autostop']);
		doCmd( sprintf("81010601%02X%02X0303FF",0,0) );
		break;
	case "focus_con_near":
	case "focus_con_far":
		usleep(1000000*$_ARG['autostop']);
		doCmd( "8101040800FF" );
		break;
}

?>
As it states, it is a use-at-own-risk script, but it works for my camera. As a suggestion, it would be nice to add a [near] and [far] button on the zooming feature that will zoom all the way in/out (con-zooming) and then just use the current arrows for step(rel)-zooming. This script uses the timeout to do step pan/tilt/zoom to overcome the continuous mode default.

Adding the script:
Copy the script to /usr/local/bin/zmcontrol-visca.php
Be sure to: chmod a+x /usr/local/bin/zmcontrol-visca.php

Make sure controllable cameras is enabled in the config.
Open your camera monitor page, then click on the control tab.
Enable 'Controllable' on the camera.
Click "Edit" next to Control Type.
Add New Control

Main Tab:
  • Name: Sony VISCA
    Type: Remote
    Command: zmcontrol-visca.php
Move Tab:
  • Can Move: checked
    Can Move Diagonally: checked
    Can Move Relative: checked
    Can Move Continuous: checked
Pan Tab:
  • Can Pan: checked
    Min Pan Range: 2448
    Max Pan Range: 63088
    Min Pan Step: 100
    Max Pan Step: 10000
    Has Pan Speed: checked
    Min Pan Speed: 0
    Max Pan Speed: 24
Tilt Tab:
  • Can Tilt: checked
    Min Tilt Range: 972
    Max Tilt Range: 64708
    Min Tilt Step: 100
    Max Tilt Step: 5000
    Has Tilt Speed: checked
    Min Tilt Speed: 0
    Max Tilt Speed: 20
Zoom Tab:
  • Can Zoom: checked
    Can Zoom Continuous: checked
    Min Zoom Range: 0
    Max Zoom Range: 30464
    Min Zoom Step: 10
    Max Zoom Step: 4000
    Has Zoom Speed: checked
    Min Zoom Speed: 0
    Max Zoom Speed: 7
Focus Tab:
  • Can Focus: checked
    Can Auto Focus: checked
    Can Focus Continuous: checked
    Min Focus Range: 0
    Max Focus Range: 15
Presets Tab:
  • Has Presets: checked
    Num Presets: 16
    Has Home Preset: checked
    Can Set Presets: checked
Save the control settings.

Back on the control tab of your camera monitor page:
  • Controllable: checked
    Control Type: Sony VISCA
    Control Address: <user>:<passwd>@<ipaddress>
    Auto Stop Timeout: 0.25
The <user>:<passwd>@ only needs to be used if you have set up security users and an admin user/password, since normal users don't have CGI access to move the camera around...

Once you save your camera, you can now use the ZM controls to spy on those people in the parking lot... :D

PS. ZM, this might be something to review and include in next version. I know you're rewriting the control code a bit, but this works in the meantime. :)

Let me know if I missed anything. :wink:
Ammaross Danan
squartochi
Posts: 3
Joined: Fri Sep 12, 2008 11:35 pm

SNC-RZ30n control script

Post by squartochi »

I have an SNC-RZ30N. I am trying to get the control going. I did what was stated above. Just wondering if the new version of zone minder crippled this script?
Thanks,
User avatar
ammaross
Posts: 61
Joined: Mon Mar 12, 2007 8:34 pm
Location: Utah, USA

Yes

Post by ammaross »

Yes, the new version crippled this script. It is written for 1.22.x. If I was better at the new scripting system (and perl for that matter), I could write an updated one. However, I'll leave that to someone with more know-how than I. All the control information can be gleaned from my script though.
depe
Posts: 4
Joined: Thu Jan 18, 2007 6:38 pm

Post by depe »

I found this perl project, may be could be usefull ?

http://search.cpan.org/~cmorris/SNC-Manipulator-0.30/
I thnk is written in perl.

Best Regards.

Demian
brandon314159
Posts: 1
Joined: Tue Apr 04, 2017 7:22 am

Re: Sony SNC-RZ30N ptz? remote host path?

Post by brandon314159 »

Curious if anyone revisited this?

I'm bringing one of these cameras online as a cheap PTZ and wondered about the control software. I'm about to tackle it but was curious if anyone had already cut a path.

Cheers!
Post Reply