IpCamera: New IP Camera Binding

Tags: #<Tag:0x00007f5ca6420978> #<Tag:0x00007f5ca64208b0> #<Tag:0x00007f5ca64207e8>

Hi Matt
Thanks for the reply.
Not good when I have 4 adaptors running on my nas :weary:
Glad it’s on your high priority though, any idea on timeframe?
Cheers

I should have time over Christmas break, not sure how it will be handled as I was trying an automated way to select the network with out doing any pings. It may have to be looking in the logs for a list of cards and then entering a number as a config for people that find the auto method to not work. Can you post why there are four cards and how they are setup? It may help to consider your use case when doing this.

Could you add it as a free text box in the thing config much like the stream url override and wait for an adaptor to come up matching this, ie ‘server network address’?

I’m running openhab on a qnap NAS (ts-451), it has 4 adaptors each of which has a local address assigned as follows:
1: 192.168.6.0/24 - normal lan
2: 192.168.20.0/24 - smart home lan (openhab here)
3: 192.168.4.0/24 - cctv
4: 192.168.0.0 - vpn gateway (using qvpn on NAS for certain traffic)

The other trouble is if I was to add a docker image or a vm this creates a virtual adaptor too, which is what the binding chose (10.0.5.0/24), I believe as this was first to have an address as it didn’t have to query dhcp as it’s virtual.

hi all, i’m trying to use the binding with my ipcamera Shenzhen. i think a bluecam remark.
the camera reply to this command that i found in an other forum.
Identifier: BLUECOM.GMT

Default ip_address: 192.168.1.250

Default user interface credentials: admin/

Default command credentials: admin/admin


nmap -sN -r -n -p-1-65535

(null scan (TCP flag header is 0) , do not randomize, no DNS resolution, all ports)

-O - enable OS detection

nmap port open results:

6554 - tcp (video streams)
8080 - http-proxy
9527 - tcp (command)

On power up the camera first tries to find 192.168.1.1 and then tries to contact:

116.62.7.175 - Beijing Kuancong
13.58.115.239 - amazon.com - USA
35.177.224.169 - amazon.com - Europe

OCX download www.cam158.com


High and low resolution video streams

ip_address:6554/stream-0
ip_address:6554/stream-1
ip-address:6554

Command port (use login user and password – configuration and control items)

ip_address:9527/index.htm
ip_address:9527/index1.html
ip_address:9527/jpeg.html
ip_address:9527/snapshot.htm
ip_address:9527/status.htm – Device status
ip_address:9527/ip.htm – Basic Network Settings - Obtain IP from DHCP Server (uncheck for manual), http port: 9527
ip_address:9527/wireless.htm – Wireless LAN - Using Wireless Lan (check) - SSID, Authentication
ip_address:9527/ddns.htm – DDNS Service activation, parameters
ip_address:9527/Onvif.htm – ONVIF Stream settings ‘open’
ip_address:9527/RTSP.htm – RTSP Stream ‘open’ - port 10554 (must be wrong, should be 6554)
ip_address:9527/ptz.htm – PTZ - not available
ip_address:9527/multidev.htm – Multi-Device Settings (accessible from Internet)
ip_address:9527/user.htm – Administrator, Operator, Visitor
ip_address:9527/alias.htm – Alias Settings - IPCAM
ip_address:9527/datetime.htm – Timezone, NTP Server
ip_address:9527/recordpath.htm – Local record path - file length, time, reserved space, cover
ip_address:9527/recordsch.htm – Record schedule SD card format, capacity, recording options, time schedule
ip_address:9527/voice.htm – Voice setting (Mute, English, Chinese)
ip_address:9527/alarm.htm – Motion detect, audio detect, mail notification, upload image, arming time schedule
ip_address:9527/mail.htm – Mail service settings
ip_address:9527/ftp.htm – FTP service settings
ip_address:9527/log.htm
ip_address:9527/ipc_reboot_dev.cgi?next_url=reboot.htm
ip_address:9527/ipc_reset.cgi?next_url=rebootme.htm
ip_address:9527/upgrade.htm – Upgrade Device Firmware, Embedded Web UI (Browse)

ip_address:9527/get_ipc_status.cgi
ip_address:9527/ipc_control_video.cgi?loginuse=admin&loginpas=admin&param=xxxx&value=yyyy
param=18&value=1
param=17&value=1
param=14&value=0 PIR off
param=14&value=1 PIR on
ip_address:9527/ipc_control_ptz.cgi
ip_address:9527/get_ipc_status.cgi
ip_address:9527/get_ipc_params.cgi
ip_address:9527/get_ipc_encode_params.cgi
ip_address:9527/get_ipc_factory_param.cgi
ip_address:9527/get_ipc_record.cgi
ip_address:9527/videostream.cgi?loginuse=admin&loginpas=admin -
ip_address:9527/snapshot.cgi?loginuse=admin&loginpas=admin - get jpeg image (704x576)


Get a jpeg image (for motion detection)

curl “http://192.168.1.250:9527/snapshot.cgi?loginuse=admin&loginpas=admin” -o test.jpeg


get_status.cgi? -> admin/ - reset
login.cgi
get_camera_params.cgi

public.cgi
get_ipc_loginmessage.cgi
jquery/jquery.min.js
public.js

This is my configuration

and this is the openhab’s log… the camera is online but not images, not moving etc…

2019-11-08 10:27:42.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.733 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.739 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.751 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:42.802 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.726 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.729 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.739 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:47.791 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

==> /var/log/openhab2/events.log <==

2019-11-08 10:27:52.648 [vent.ItemStateChangedEvent] - Azimuth changed from 153.9958881237165 ° to 154.24468189742086 °

2019-11-08 10:27:52.661 [vent.ItemStateChangedEvent] - Elevation changed from 23.964394694529478 ° to 24.04038843790722 °

2019-11-08 10:27:52.670 [vent.ItemStateChangedEvent] - Diffuse_Radiation changed from 105.94218879750758 W/m² to 106.08175261299178 W/m²

2019-11-08 10:27:52.678 [vent.ItemStateChangedEvent] - Total_Radiation changed from 267.8630844990612 W/m² to 269.08593069868414 W/m²

==> /var/log/openhab2/openhab.log <==

2019-11-08 10:27:52.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.715 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.719 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.729 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:52.781 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

What i’m wrong? Someone could help me?

HIgher Resolution on SnapShot Images

I’ve been running this binding for a few years now; works fantastic! I have the HIKVision system connected to it and I’d like to get better resolution on the SnapShot image item.

My 8 cameras are setup in PaperUI tied through a NVR.

Is this possible? If so, how?

Best, Jay

Hi. I upgraded to the newest version of the binding and created two things that connect to Hikvision cameras. The resolution of the camera picture is 4K, downloaded picture sizes are around 250k each, update interval 4s. The problem is that after a few hours all java heap is consumed and OH stops working. Also, the ongoing load is above 115% of 4-core RPI (while without the IP camera things it is 15%). Something apparently is consuming memory and CPU time. How can I help to diagnose that?

@ppieczul
You need to turn off the image channel from updating, I find it halves the CPU load and also stops a memory leak. This is covered in the readme for the binding and as it literally turns off 1 line of code that sends the snapshot to the Openhab Image item I am certain this is in the Openhab framework and not the binding. The Image item was never designed to take large pictures changing often.

@jwiseman
Ask HIK support, it will be a change in the cameras settings.

Hi,
anyone knows if this binding supports the motion detection of Foscam fi9902p? It should right? As I see it, it’s the new model of the fi9900P.
Thanks and best regards
Daniel

If the camera has the Foscam HD api implemented then it should work. The older non HD cameras have not been implemented into the binding unless we get a volunteer to do the work. DISCLAIMER: Since I don’t work for foscam you need to do your own research. See the first post of this thread that explains what is implemented for each brand as you may want to purchase a different camera based on what features you need.

Hi, i´m looking for a good cam for my front door. I have seen some cams on aliexpress. dahua ipc-hdw4433c-a has 4MP, 2,8mm lens and an angle of view of 81°.

Another cam, KingCam cam with 4MP has 2,8mm lens too, but angle of view is 120°.
(disadvantage, it doesn´t provide mjpeg stream, only h264/h265. So not easy to use in openhab…)

Can somebody tell me, why the difference in angle of view is so big - even with the same lens?

Anybody knows the dahua cam? Is the angle of view really only 81° with the 2,8mm lens?

If you want the ability to trigger a door latch to remote open the door or to use the cameras alarm terminals for doorbell operations then you will need the right dahua model. So much more automation is possible if U stick to cams with an API that this binding supports.

A fish eye lens may explain the view difference or it may be a typo as the specs in AliExpress often are wrong.

Hello Matt could you check my post please

I can’t get my camera working correctly.

Regards,
Salexes

Hello,

clould you please share yout settings. I have the same cameras and i can not get them works

2019-11-16 17:11:09.374 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera Dispose() called.

2019-11-16 17:11:09.382 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera restarting.

2019-11-16 17:11:09.419 [me.event.ThingUpdatedEvent] - Thing 'ipcamera:ONVIF:93595891' has been updated.

2019-11-16 17:11:10.425 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

2019-11-16 17:11:10.428 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Since an NPE occured when asking the camera about PTZ, the PTZ controls will not work. If the camera does not come online, give the camera the wrong ONVIF port number so it can bypass using ONVIF and still come online.

2019-11-16 17:11:10.430 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

2019-11-16 17:15:50.983 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:93595891' changed from OFFLINE (CONFIGURATION_ERROR): Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL. to UNINITIALIZED

2019-11-16 17:15:51.015 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera Dispose() called.

2019-11-16 17:15:51.017 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera restarting.

2019-11-16 17:15:51.032 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:93595891' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)

2019-11-16 17:15:51.841 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:93595891' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2019-11-16 17:15:52.869 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

2019-11-16 17:15:52.873 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:93595891' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

2019-11-16 17:18:06.874 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera Dispose() called.

2019-11-16 17:18:06.877 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - ipCamera restarting.

2019-11-16 17:18:06.902 [me.event.ThingUpdatedEvent] - Thing 'ipcamera:ONVIF:93595891' has been updated.

2019-11-16 17:18:07.901 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

Thanks a lot!

Hello

I have found a rtsp link and it works good in vlc player.
How can i add to oh? I added it in bindings setup, but nothing happend…

HI Michael @thisisIO,

I had to change/modify the source code of this binding and recompile it for me to work with my Reolinks. A simple reconfiguration was not possible. However I am no longer using this binding, I developed an own solution based on OpenCV.

Best regards
Daniel

1 Like

HI Matt,

i have made a Thing

Thing ipcamera:ONVIF:001 "Camera Entrance" @ "Cameras" [
    IPADDRESS="192.168.XX.XX",
    PASSWORD="123456",
    USERNAME="admin",
    POLL_CAMERA_MS=2000,
    SERVER_PORT=55551,
    ONVIF_PORT=8911,
    GIF_PREROLL=0,
    GIF_POSTROLL=3,
    IP_WHITELIST="DISABLE",
    IMAGE_UPDATE_EVENTS=1,
    UPDATE_IMAGE=false,
    SNAPSHOT_URL_OVERRIDE="http://192.168.XX.XX/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=NF432fjsaw5r&user=admin&password=123456",
    FFMPEG_OUTPUT="/tmpfs/camera1/",
    FFMPEG_INPUT="rtsp://admin:123456@192.168.XX.XX:554/h264Preview_01_main"
]

and installed FFMPEG.

Now i get gifs here /tmpfs/camera1/ipcamera.gif when i push the button to create a gif.
But i have no mjpeg.

I get only m3u8 with following contents inside:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:3.852000,
ipcamera0.ts
#EXTINF:1.926000,
ipcamera1.ts
#EXTINF:1.927000,
ipcamera2.ts
#EXTINF:1.926000,
ipcamera3.ts
#EXTINF:1.926000,
ipcamera4.ts

rtsp://admin:123456@192.168.XX.XX:554/h264Preview_01_main - this stream works in VLC Player.

I have intalled HLS Plugin in Chrom
https://chrome.google.com/webstore/detail/native-hls-playback/emnphkkblegpebimobpbekeedfgemhof?hl=ru

And put in sitemap

     Text label="Android Stream" icon="camera"{
    Video url="http://192.168.178.36:55551/ipcamera.mjpeg" encoding="mjpeg"
    }

    Text label="iOS Stream" icon="camera"{
        Webview url="http://192.168.178.36:55551/ipcamera.m3u8" height=15
    }

When i call http://192.168.XX.XX:55551/ipcamera.m3u8 i still have not video((( http://prntscr.com/py7u8z

Maybe it have to be trigged to start the stream or please tell me, why can it be?

Thanks!

The binding can only create a animated GIF and HLS streams from a rtsp source. There is another method to use ffmpeg in a different thread on this forum on how to create mjpeg if your camera does not have a normal http url for the stream. Most likely it will chew CPU so I am not keen to add the feature when you can offload it to a server running motion or any of the other packages. The readme has more info on this please take the time to read it.

to setup mjpeg with the binding you need to setup this config STREAM_URL_OVERRIDE.

Quote from readme file…

STREAM_URL_OVERRIDE
A HTTP URL for MJPEG format streams only, RTSP not supported.

edit:

If you can not get HLS working check…

  1. The camera is producing h264 and NOT mjpeg to the url you have given the binding via FFMPEG_INPUT.
  2. Call the url and within 30 seconds call it a second time as the first call will start the stream and if you do not have enough buffered it may stop/runout. Calling it a second time should tell you this.
  3. Use TRACE or DEBUG log output to show the ffmpeg output and this will tell you if your machine hits 1x speed for realtime. Slower setup will either take time to reach 1x or will never reach it.

Thanks Matt,

  1. Here is the infos about stream It seems to be h264 http://prntscr.com/pyex8z
  2. You mean call in browser this link two tiomes at the same time http://192.168.178.36:55551/ipcamera.m3u8 - if so then nothing happens http://prntscr.com/pyez9r (((
  3. I have shut down snapshots in thing
    IMAGE_UPDATE_EVENTS=0,
    UPDATE_IMAGE=false,

to make log more reaadable. But now the log of ipcamera is empty (with TRACE on), also if i call this link in chrome http://192.168.178.36:55551/ipcamera.m3u8

Matt, by the way - if i get Gifs (that are made from RTSP) this means that RTSP works. But why i can not see it?

@matt1, can you help me with this problem ? I can provide more log if you want.