# IpCamera: New IP Camera Binding

**URL:** <https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771>\
**Category:** Bindings\
**Tags:** camera, onvif, ip-cam1\
**Created:** [March 30, 2018, 12:13am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771 "2018-03-30T00:13:27Z")\
**Posts on this page:** 20\
**Page:** 125

<div class="post-metadata">

**Author:** ![alexkarageorgis](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@alexkarageorgis](https://community.openhab.org/u/alexkarageorgis)\
**Post date:** [October 21, 2021, 10:06pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2496 "2021-10-21T22:06:59Z")

</div>

@matt1

sorry if I am being tiresome 🙂

do you mean this part?

Some older versions of these NVRs require setting a different snapshot URL (`snapshotUrl`), as well as `ffmpegInput`. The older ones use the same URLs just with ‘ISAPI’ removed.

```auto
Thing ipcamera:hikvision:West "West Camera"
[
    ipAddress="192.168.0.XX",
    username="username",
    password="password",
    onvifPort=8000, //normally 80 check what it needs
    port=80,
    nvrChannel=4,
    serverPort=54324,
    ffmpegOutput="/var/lib/openhab/ipcamera/West/",
    ffmpegInput="rtsp://192.168.0.XX:554/ISAPI/Streaming/channels/401"
]

```

if yes then you are saying that i need to set up a Thing for each camera in the NVR right? So the “unit” isnt the NVR but rather the camera on the NVR?

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 21, 2021, 10:34pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2497 "2021-10-21T22:34:57Z")

</div>

Correct you setup a thing for each camera using the same Ip for each one. I agree a bridge thing for an nvr makes sense but that is not in the binding. Also some hikvision nvr’s allow each camera to be spoken to directly via different ports for each camera. So there are two ways it can be done depending on what your nvr supports and how it is setup. I don’t own one so I can not guide you in that area.

---

<div class="post-metadata">

**Author:** ![alexkarageorgis](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@alexkarageorgis](https://community.openhab.org/u/alexkarageorgis)\
**Post date:** [October 21, 2021, 10:52pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2498 "2021-10-21T22:52:14Z")

</div>

@matt1 ok soooo

given my NVR doesnt do Mjpeg, (\*h264). & it doesnt do port fw  
I need ffmpeg installed, a thing for each camera and I should be able to use the camera oh3 - habpanel json to view cameras on request.

The on request minimizes the impact on processor usage even when hls is always on.

If this is correct I think i got it.  
Last question (promise) the binding doesnt actually store stuff right? dont need recording so it wont do naything like that

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 21, 2021, 11:03pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2499 "2021-10-21T23:03:38Z")

</div>

I have no idea what your nvr offers so it makes it hard to really comment. Does it have RTSP for each camera in h264 format? Does it have snapshot ability?

Hls does not use cpu. It can leave some files behind on your disk as that is how hls works. Other than this it does not store on the disk anything unless you record.

---

<div class="post-metadata">

**Author:** ![alexkarageorgis](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@alexkarageorgis](https://community.openhab.org/u/alexkarageorgis)\
**Post date:** [October 22, 2021, 12:14am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2500 "2021-10-22T00:14:32Z")

</div>

it only offers two types of encoding. H264 and H265. so yes I would guess the rtsp is in this encoding and per camera - correct. (i.e. i can access via the isapi link)

thanks! I will work on this plan now to set things up - appreciate your time a lot!

---

<div class="post-metadata">

**Author:** ![jrussell05](https://community.openhab.org/user_avatar/community.openhab.org/jrussell05/32/36541_2.png) [@jrussell05](https://community.openhab.org/u/jrussell05)\
**Post date:** [October 22, 2021, 12:27pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2501 "2021-10-22T12:27:05Z")

</div>

I’m currently running snapshots:

```yaml
runtimeInfo:
  version: 3.2.0
  buildString: "Build #2529"
locale: en-US
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.13
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.52+13-CA
  osName: Linux
  osVersion: 5.4.0-89-generic

```

The INFO line repeats every second or so.

I’m happy to switch back to milestones if needed. Will have to figure that out, but I’m sure it can be done.

---

<div class="post-metadata">

**Author:** ![Joost\_Westra](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Joost\_Westra](https://community.openhab.org/u/Joost_Westra)\
**Post date:** [October 23, 2021, 12:26pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2502 "2021-10-23T12:26:22Z")

</div>

I successfully added a Reolink camera.  
But having problems adding my doorbell with only a rtsp stream and no username and password.

 ![Screenshot 2021-10-23 at 13.47.26](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/a/5a97ac72d2510a989e1115b48e59fb42d14f1cb9.png)  
Enabled tracing and this what I get with no username and password:

```auto
2021-10-23 14:05:35.305 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg
2021-10-23 14:05:35.306 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now: ********-******** r ********t******** s ********p******** _ ********t******** r ********a******** n ********s******** p ********o******** r ********t********  ********t******** c ********p********  ********-******** h ********i******** d ********e******** _ ********b******** a ********n******** n ********e******** r **************** - ********l******** o ********g******** l ********e******** v ********e******** l **************** w ********a******** r ********n******** i ********n******** g **************** - ********i********  ********r******** t ********s******** p ********:******** / ********/******** 1 ********9******** 2 ********.******** 1 ********6******** 8 ********.******** 0 ********.******** 2 ********5******** 1 ********:******** 5 ********5******** 4 ********/******** o ********n******** v ********i******** f ********1********  ********-******** q ********:******** v **************** 5 **************** - ********r********  ********2********  ********-******** v ********f********  ********s******** c ********a******** l ********e******** = ********6******** 4 ********0******** : ********-******** 2 **************** - ********u******** p ********d******** a ********t******** e **************** 1 **************** h ********t******** t ********p******** : ********/******** / ********1******** 2 ********7********. ********0********. ********0********. ********1******** : ********9******** 0 ********2******** 0 ********/******** i ********p******** c ********a******** m ********e******** r ********a********. ********j******** p ********g********

```

Somehow the FFMPEG parameters are completely garbled. Not sure if this caused by the binding or some other problem in OpenHab

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 23, 2021, 12:31pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2503 "2021-10-23T12:31:43Z")

</div>

I fixed a bug that does that when there is no user/ password. It is fixed it the jar you can download in this thread.

> [@IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer](https://community.openhab.org/t/ipcamera-binding-breaking-changes-and-new-features-in-3-2-milestone-3-and-newer/126735/2):
>
> Hi matt1, I just updated to the 3.2 milestone 3 release (from milestone 2). Whereas the transition to the new settings for my onvif camera was fairly smooth, I’m having trouble with my Instar camera using the API (seemingly unrelated to the changes described above). I now get several error messages in my logs: [WARN] [mera.internal.handler.IpCameraHandler] - Camera is reporting your username and/or password is wrong. ... [WARN] [mera.internal.handler.IpCameraHandler] - !!!! Camera possibly …

---

<div class="post-metadata">

**Author:** ![jrussell05](https://community.openhab.org/user_avatar/community.openhab.org/jrussell05/32/36541_2.png) [@jrussell05](https://community.openhab.org/u/jrussell05)\
**Post date:** [October 24, 2021, 2:43pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2504 "2021-10-24T14:43:59Z")

</div>

Regarding the error that occurs as a result of trying to “Scan” for cameras, I have multiple network interfaces connected to my OpenHAB machine. I run OpenHAB on a VM and I have an interface for “normal” LAN traffic and I have an additional interface dedicated to a “Camera” LAN.

Could this be causing the errors? It does mention something about “…@Sharable…”

Also, I just installed the latest snapshot of your IpCamera binding dated Oct 24, 2021.

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 24, 2021, 11:29pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2505 "2021-10-24T23:29:14Z")

</div>

> [@jrussell05](#):
>
> The INFO line repeats every second or so.

There is a problem then and my first guess is that you have not turned on the CGI/API in the cameras setup. Hikvision cameras come with the API disabled and no ONVIF user/pass setup so both of these are needed to be done. See the documentations steps on how to setup Hikvision.

There is an update in the latestest snapshot, can you update to it and retest? The sharable thing is new to me and if it is still occuring, then I will have to look into to see if it can be reproduced here… You dont need to scan and find cameras, manually adding them is more than fine and wont be causing the info log problem.

---

<div class="post-metadata">

**Author:** ![mjcumming](https://community.openhab.org/user_avatar/community.openhab.org/mjcumming/32/73372_2.png) [@mjcumming](https://community.openhab.org/u/mjcumming)\
**Post date:** [October 25, 2021, 12:13am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2506 "2021-10-25T00:13:32Z")

</div>

@matt1 thank you for this incredible binding. I have just started working on it. I can confirm it works with the Wainsview line of cameras using ONVIF.

I have done some reading on motion and object detection and must admit I am confused about where to begin. The Wainsview cameras do not seem to have very good detection (or it detects everything that moves).

I would like to be able to detect people, faces if possible, car and license plates if possible. Does the binding do that or do I need a third party application and something like google coral?

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 25, 2021, 4:24am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2507 "2021-10-25T04:24:41Z")

</div>

I don’t know much on object detection yet, but it would be an idea to weigh up the cost of a camera that has it built in. The CPU load to process multiple cameras means that you are best looking at coral or a GPU to offload the processing otherwise your looking at 1 FPS rates at detecting the objects which is OK for sensing objects to use in rules, but if your also wanting to see realtime boxes around the objects you may want a higher rate which the coral is good for. Then there is the issue of network traffic, your best to run multiple cameras and a 3rd party app on a separate switch to keep this traffic away from your openHAB server. For a low number of cameras that is less important to do.

If you want to get started, then there are these ways which I have not tried.

- [snowzach/doods: DOODS - Dedicated Open Object Detection Service (github.com)](https://github.com/snowzach/doods) Which gives you a REST api to connect back to openhab with.

- [Shinobi Official Documentation - Object Detection](https://shinobi.video/docs/object) This also has a REST api to send things back to openHAB.

---

<div class="post-metadata">

**Author:** ![Joost\_Westra](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Joost\_Westra](https://community.openhab.org/u/Joost_Westra)\
**Post date:** [October 25, 2021, 9:54am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2508 "2021-10-25T09:54:21Z")

</div>

Updating to this version and forcing the transport to UDP worked to successfully generate images from the rtsp stream. Thanks for making this binding.  
Should the selection of transport al be part of the UI options? (I personally don’t have a big problem with adding the argument manually (-rtsp\_transport udp))

---

<div class="post-metadata">

**Author:** ![alexkarageorgis](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@alexkarageorgis](https://community.openhab.org/u/alexkarageorgis)\
**Post date:** [October 25, 2021, 6:53pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2509 "2021-10-25T18:53:03Z")

</div>

@matt1 hi Matt,

have you come across a case when adding cameras that it causes issues with other bindings?  
I have this case where i have added something like 20 cameras via the RTSP protocol (Hikvision didnt work). they appear on the clickcamera widget. but after finishing and runnign a reboot, the zwave binding has gone offline (and it wont come back online)

almost as if i used up too many system resources - does this make sense?  
would it be the habpanel json or the number of rtsp cameras you think that causes it?

(i should add that if i reflash the sd card to prior to adding cameras it is back to normal)  
If I remove the ipcamera binding - reboot - it is back to normal. then if I add the binding everything is ok (i guess until next reboot)

Alex

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 25, 2021, 7:15pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2510 "2021-10-25T19:15:32Z")

</div>

> [@alexkarageorgis](#):
>
> the zwave binding has gone offline (and it wont come back online)

Yes there is a whole thread on this. Milestone 3 fixes this for most people but the latest jar and milestone 4 (due out in 1-2 weeks) should have it resolved.

@alexkarageorgis  
This post should have all the info in it that you need.

[IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer - Add-ons / Bindings - openHAB Community](https://community.openhab.org/t/ipcamera-binding-breaking-changes-and-new-features-in-3-2-milestone-3-and-newer/126735)

---

<div class="post-metadata">

**Author:** ![msexton187](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@msexton187](https://community.openhab.org/u/msexton187)\
**Post date:** [October 25, 2021, 9:34pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2511 "2021-10-25T21:34:19Z")

</div>

@jimtng, I made rules for my Dahua and Hikvision cameras to change the switch times based on the Astro binding. Let me know if you’d like to see how I did it.

---

<div class="post-metadata">

**Author:** ![jimtng](https://community.openhab.org/user_avatar/community.openhab.org/jimtng/32/98543_2.png) [@jimtng](https://community.openhab.org/u/jimtng)\
**Post date:** [October 25, 2021, 10:02pm UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2512 "2021-10-25T22:02:31Z")

</div>

> [@msexton187](#):
>
> I made rules for my Dahua and Hikvision cameras to change the switch times based on the Astro binding. Let me know if you’d like to see how I did it.

I’d love to see your code. I just use Sun elevation (also from astro). I’d like to also do it based on light level, e.g. when it’s very overcast / raining during the day, switch it to night profile too. I haven’t figured out how to determine the light level. I’d like to do it based on the camera / camera feed itself, and not have to use extra external lux sensors.

Here’s my current code, written in [JRuby OpenHAB Rules System](https://community.openhab.org/t/jruby-openhab-rules-system/110598)

```ruby
require 'openhab'
require 'net/http'
require 'net/http/digest_auth'

SUN_ELEVATION_THRESHOLD = 5 # Threshold for switching camera profile to day/night

def http_digest_get(url, user:, pass:)
  digest_auth = Net::HTTP::DigestAuth.new

  uri = URI(url)
  uri.user = CGI.escape(user)
  uri.password = CGI.escape(pass)

  h = Net::HTTP.new uri.host, uri.port

  req = Net::HTTP::Get.new uri.request_uri

  res = h.request req
  # res is a 401 response with a WWW-Authenticate header
  auth = digest_auth.auth_header uri, res['www-authenticate'], 'GET'

  # create a new request with the Authorization header
  req = Net::HTTP::Get.new uri.request_uri
  req.add_field 'Authorization', auth

  # re-issue request with Authorization
  h.request req
end

def dahua_set_profile(ip, profile, user, pass)
  profile = { day: '0', night: '1' }[profile]
  http_digest_get("http://#{ip}/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=#{profile}",
                  user: user, pass: pass)
end

rule 'Dahua: Profile switch to day' do
  changed Sun_Elevation
  on_start
  run do |event|
    if Sun_Elevation > SUN_ELEVATION_THRESHOLD && (event.nil? || event.was <= SUN_ELEVATION_THRESHOLD)
      profile = :day
    elsif Sun_Elevation < SUN_ELEVATION_THRESHOLD && (event.nil? || event.was >= SUN_ELEVATION_THRESHOLD)
      profile = :night
    else
      next
    end
    logger.info("DAHUA PROFILE switched to: #{profile}")
    dahua_set_profile(CAMERA_IP['Street'], profile, CAM_USER, CAM_PASS)
  end
end

```

---

<div class="post-metadata">

**Author:** ![mjcumming](https://community.openhab.org/user_avatar/community.openhab.org/mjcumming/32/73372_2.png) [@mjcumming](https://community.openhab.org/u/mjcumming)\
**Post date:** [October 26, 2021, 1:23am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2513 "2021-10-26T01:23:35Z")

</div>

Thanks Matt,

I am going to have a look at [Frigate](https://github.com/blakeblackshear/frigate)

---

<div class="post-metadata">

**Author:** ![alexkarageorgis](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@alexkarageorgis](https://community.openhab.org/u/alexkarageorgis)\
**Post date:** [October 26, 2021, 6:43am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2514 "2021-10-26T06:43:27Z")

</div>

hi matt1, I am on milestone3 actually already.  
For now I am ok after the unistall/re-install of the binding. Reading up on the link TY and waiting on m4.

the only thing which is strange (besides +10C temp on the RPI) is that the HLS stream isn’t consistent on my Amazon Firehd tables/Habpanel. It is better on my mobile phone (samsung note10).

so I have this

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/6/2/623cd29984bfc6b8e9c8bba01344d4cc3e703edf.jpeg)

but some streams work better/appear and some just stay blank like below. (same setup ofcourse and all from the same NVR)

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/a/5af0b762448109f396f361252f779dbd770eeb88.jpeg)

Is there some way to make the HLS stream faster to load?  
Snapshots work ok every 5 seconds (question 2 - do snapshots keep getting “taken” even when the clickable widget isnt the active window?)

---

<div class="post-metadata">

**Author:** ![matt1](https://community.openhab.org/user_avatar/community.openhab.org/matt1/32/19930_2.png) [@matt1](https://community.openhab.org/u/matt1)\
**Post date:** [October 26, 2021, 8:36am UTC](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771/2515 "2021-10-26T08:36:36Z")

</div>

> [@alexkarageorgis](#):
>
> Is there some way to make the HLS stream faster to load?

This is covered in the documentation here  
[IP Camera - Bindings | openHAB](https://www.openhab.org/addons/bindings/ipcamera/#hls-http-live-streaming)

With 20 cameras yes I am not surprised that M3 is still an issue, I have not tested that many before but you do not need to wait for M4 as I have uploaded the jar if you wish to try it out.

> [@alexkarageorgis](#):
>
> do snapshots keep getting “taken” even when the clickable widget isnt the active window?)

That is difficult to answer as it depends on the browser and the widget. You can easily check yourself by using DEBUG log output. Sometimes it is needed to press refresh on a browser after you leave the page to stop some streams.

Your streams not starting whilst others do, are any of them hikvision with digest? if so see here..

[IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer - Add-ons / Bindings - openHAB Community](https://community.openhab.org/t/ipcamera-binding-breaking-changes-and-new-features-in-3-2-milestone-3-and-newer/126735/28)

[Previous page](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771.md?page=124)

[Next page](https://community.openhab.org/t/ipcamera-new-ip-camera-binding/42771.md?page=126)
