API focus for SD49225T-HN

Mattias

Young grasshopper
Joined
Nov 1, 2015
Messages
35
Reaction score
8
I have a SD49225T-HN but I have some issues with external commands. I'm sending http commands from Blue Iris and I can change preset and change profile with out any problem.
I change preset with (-->login and ip + /cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0 )
I change profile with (-->login and ip + /cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0 )

But I cant get the focus or set the focus...

When I run these commands the only thing I get is "Error". Why doesent this work. Can anyone with a SD49225T-HN test and see if it works for them.

http://<ip>/cgi-bin/devVideoInput.cgi?action=getFocusStatus
http://<ip>/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.02&zoom=0

My software version for the unit is "2.422.0000.0.R.4.2510, Build Date: 2016-09-21"
 

Damir

n3wb
Joined
Oct 19, 2017
Messages
1
Reaction score
0
Location
Astana
I have a SD49225T-HN but I have some issues with external commands. I'm sending http commands from Blue Iris and I can change preset and change profile with out any problem.
I change preset with (-->login and ip + /cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0 )
I change profile with (-->login and ip + /cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0 )

But I cant get the focus or set the focus...

When I run these commands the only thing I get is "Error". Why doesent this work. Can anyone with a SD49225T-HN test and see if it works for them.

http://<ip>/cgi-bin/devVideoInput.cgi?action=getFocusStatus
http://<ip>/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.02&zoom=0

My software version for the unit is "2.422.0000.0.R.4.2510, Build Date: 2016-09-21"
I have the same problem, have you solved it?
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
Doesn't work.

This causes it to start focussing further away:

http://192.168.1.108/cgi-bin/ptz.cgi?action=start&channel=0&code=FocusFar&arg1=0&arg2=1.0&arg3=0

This tells it to stop focusing further:

http://192.168.1.108/cgi-bin/ptz.cgi?action=stop&channel=0&code=FocusFar&arg1=0&arg2=1.0&arg3=0

So you'll want to tell it to start, then tell it to stop once it is right, or it will keep going to the max.

When you go to far... FocusNear can replace FocusFar, and you can also change arg2=1.0 to different values to modify the speed with which the focus changes.

I haven't yet found any way to get the current focus value like what works with the other IPC cams, or a way to set a specific focus value.
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
I checked via Wireshark, while making changes in the web interface, and it is just sending start/stop like you see above to adjust focus. So each time you click + or - on the web interface, it sends a start followed by a stop shortly after.

In wireshark, that looks like this, which you can translate these same values into the arguments of the URLs I posted above.

upload_2017-11-13_22-49-35.png

Nothing that goes over the wire from the web interface looks useful for setting focus to a static value.
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
Documentation suggests this cam doesn't have an absolute focus setting. And reverse engineering based on Wireshark transmissions appear to confirm that further (I dug thru all the http post captures while trying various functions looking for any undocumented focus items).

For my need, I'm not trying to set focus in any kind of a hurry. So I'm going to set it to FocusFar all the way out to max, then I will experiment to find how long to FocusNear to get it into focus.

Basically it should be possible to approximate an absolute focus setting by letting it go to the max/min focus (a known foundation), then backing it off for a set amount of time. I'll be doing this in LUA, for use thru my Vera so I can set the focus manually for day/night.
 

j4co

Pulling my weight
Joined
Jan 17, 2016
Messages
502
Reaction score
175
Location
The Netherlands
Thank you all for sorting this out. Might not need it, but it is clear how it works.
 

imog

n3wb
Joined
Dec 5, 2016
Messages
21
Reaction score
8
Alright boys, I got the shit. My other approach didn't work using focusfar/focusnear starts/stops, it kept leaving the focus fuzzy after a couple switches between day/night. Hopefully this helps someone else.

To switch modes I'm doing it externally thru a script from my Vera home automation, but any method you want to use to send the API calls would work fine.

First, I turn on night mode/IR on (VideoInMode[0].Config[0]=1), set focus to automatic (VideoInFocus[0][1].Mode=2), and shutter to 1/1 (&VideoInExposure[0][1].Value1=1000&VideoInExposure[0][1].Value2=1000) so that the scene is very well lit/clearly visible - this gets the camera in night mode, with IR on, and autofocus works great since the scene is well lit with long shutter.

[0].Config[0]=1&VideoInFocus[0][1].Mode=2&VideoInExposure[0][1].Value1=1000&VideoInExposure[0][1].Value2=1000

So that gets my focus reset to account for the IR focus shift going from daylight to night, however my shutter is way too long to capture plates now. So I have the script sleep for a few seconds ensuring it has time to apply the prior settings and focus, then I just need to set focus to manual (VideoInFocus[0][1].Mode=4) so it doesn't try to auto-adjust again once the scene goes black, and I set shutter to 1/1000 (&VideoInExposure[0][1].Value1=1&VideoInExposure[0][1].Value2=1)which is perfect for clear, crisp plates:

[0].Config[0]=1&VideoInFocus[0][1].Mode=4&VideoInExposure[0][1].Value1=1&VideoInExposure[0][1].Value2=1

My daytime switch just turns on day mode and sets focus and shutter to automatic:

[0].Config[0]=0&VideoInFocus[0][0].Mode=2&VideoInExposure[0][0].Mode=0

So to recap, I'm using these settings with the SD49225T-HN to capture plates at 150' day and night at something like a 40 degree angle. During the day, everything is set to default except zoom near max. During the night:
picture is set default
exposure is set manual, shutter 1/1000, 2D/3D NR set to 26
Backlight HLC set to 71
WB auto
Day/Night - ICR black and white
Zoom focus set to manual
IRLight far set 100

Night plates:

upload_2017-11-20_23-34-14.png

Day plates:

upload_2017-11-20_23-41-17.png
 
Top