API to tell if Night Vision / IR is active?

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
Post Reply
jantman
Posts: 33
Joined: Thu May 03, 2018 12:36 pm

API to tell if Night Vision / IR is active?

Post by jantman »

Hello,

I can't find anything in the API documentation, but does anyone know if there's an API method/call that returns information about whether the camera is currently in Night Vision mode?

Since - either by design or bug - automatic profile management doesn't exist (as described in https://amcrest.com/forum/viewtopic.php?f=18&t=3399 and https://amcrest.com/forum/viewtopic.php?f=18&t=6532), I'm thinking of trying to implement it myself. The idea is that on a Linux machine of mine I'd have a scheduled job that runs every minute or two and polls my cameras to check if they're in Night Vision mode or not. If the answer is different from the last poll (i.e. NV to regular mode switch or vice-versa), it would make the API call to switch the camera from Day to Night Profile (or the other way around).

I could do this by pulling a snapshot from the camera every time and checking to see if it's black & white or color, but it would be much easier and less compute effort to just ask the camera, if possible.

Any assistance would be greatly appreciated.

Thanks,
Jason
Principal Engineer, Tooling & Automation. Formerly, Wireless & Network Systems Engineer (among many other things).
Doing all sorts of crazy things to anything with an IP address.
http://www.jasonantman.com / http://github.com/jantman
jack7continued
Posts: 15
Joined: Tue May 21, 2019 10:56 am

Re: API to tell if Night Vision / IR is active?

Post by jack7continued »

See if the following link helps. It should probably work with Amcrest but I haven't tried it. Please post a reply about it.
https://github.com/bp2008/DahuaSunriseSunset
jantman
Posts: 33
Joined: Thu May 03, 2018 12:36 pm

Re: API to tell if Night Vision / IR is active?

Post by jantman »

jack7continued wrote:See if the following link helps. It should probably work with Amcrest but I haven't tried it. Please post a reply about it.
https://github.com/bp2008/DahuaSunriseSunset
I appreciate the link, but (1) I don't have any computers that run Windows, and (2) I specifically don't want to use sunrise and sunset calculations, I want the camera's light detection to trigger it.

It turns out that I've figured out how to get profiles to switch on their own... see my reply at https://amcrest.com/forum/viewtopic.php ... 994#p24994
Principal Engineer, Tooling & Automation. Formerly, Wireless & Network Systems Engineer (among many other things).
Doing all sorts of crazy things to anything with an IP address.
http://www.jasonantman.com / http://github.com/jantman
tylertroy
Posts: 1
Joined: Thu Apr 02, 2020 7:30 pm

Re: API to tell if Night Vision / IR is active?

Post by tylertroy »

I never found a way to do this directly with the API - in fact I'm certain it's not possible - but using some command line tools night-vision state can be determined by inspecting the snapshot. I use imagemagick (identify) to get the image meta data and parse the output with grep and cut. The command will return "TrueColor" or "Grayscale". Not necessarily elegant but it works. I have tested this with the IP4M-1051W.

Code: Select all


curl -fsg \
-u user:password \
--digest http://[amcrest-camera-ip]/cgi-bin/snapshot.cgi? \
| identify -verbose - \
| grep Type \
| cut -d' ' -f4
Post Reply