IpCamera: New IP Camera Binding

Hey @matt1,

I remember having to install some extra JAR’s around the 2.5.x version.

Is the 3.2m4 just one JAR or is there some other support JARs I need to install also?

Best, Jay

It still needs the extra Netty library, but now different openHAB versions use different Netty lib versions it is far easier to just install the telstick binding which will take care of the Netty libs so the single jar works. You can download the jars from the mvn/maven website, or install them with the console using the info from this post making sure you only use a single version of Netty on your system. The mqtt binding also uses different parts of the Netty libs.

That link will be the fixed version and should work on all 3.x versions of the core.

IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer - Add-ons / Bindings - openHAB Community

Try using the autofps.mjpeg stream as it updates every 8 seconds when there is no movement, then will change to every second when motion is detected. Tablets will handle it fine and there are widgets for OH3 that can make setting it up easy.

Another way would be to use snapshots.mjpeg and set the pollTime to 3 seconds and the stream will be a picture change every 3 seconds.

Yet another way is to use an Image item or oh-image card that gets fed the ipcamera.jpg url and set to update every 3 seconds.

All three of these ways will stop the image data going through the event bus and result in less load.

1 Like

Hey @matt1,

Thank you for all the detail to follow. I’m struggling to get TellStick to work. I’ve tried using the GUI to install it and dropping in the JAR. Here’s the state of it which it shows its missing a Netty object.

Also, I do have MQTT and zWave bindings both 3.1 versions installed if this is causing the issue.

344 │ Installed │  80 │ 3.2.0                 │ org.openhab.binding.tellstick


2021-11-09 08:23:46.618 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.tellstick-3.2.0.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tellstick [344]
  Unresolved requirement: Import-Package: io.netty.channel.kqueue; version="[4.1.0,5.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]

Here’s the Netty’s I have on my 3.1 system.

243 │ Active │  80 │ 4.1.63.Final          │ io.netty.buffer
244 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec
245 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec-http
246 │ Active │  80 │ 4.1.63.Final          │ io.netty.common
247 │ Active │  80 │ 4.1.63.Final          │ io.netty.handler
248 │ Active │  80 │ 4.1.63.Final          │ io.netty.resolver
249 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport
275 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec-socks
276 │ Active │  80 │ 4.1.63.Final          │ io.netty.handler-proxy
277 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport-native-epoll
278 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport-native-unix-co

Maybe as a simplier option, can you zip up the Netty stuff and put it up on your server like you have in the past with the older versions?

Best, Jay

Hi @matt1,

I have upgraded OH from 3.1 to 3.2m4 and now I have more Netty objects and the install of TellStick worked.

openhab> list -s | grep netty
258 │ Active │  80 │ 4.1.68.Final          │ io.netty.buffer
259 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec
260 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec-http
261 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec-socks
262 │ Active │  80 │ 4.1.68.Final          │ io.netty.common
263 │ Active │  80 │ 4.1.68.Final          │ io.netty.handler
264 │ Active │  80 │ 4.1.68.Final          │ io.netty.handler-proxy
265 │ Active │  80 │ 4.1.68.Final          │ io.netty.resolver
266 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport
267 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-epoll
268 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-unix-common
331 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-kqueue

I uninstalled the IPCam 3.2m4 and re-dropped it in and got this in the event log.

2021-11-09 14:07:45.710 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:60179e611f' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.896 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:10f6258d1a' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.919 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:1e24e8460d' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.946 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:91b4b89a9d' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.978 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:0cf1f88e47' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.998 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:46e5506d6a' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.005 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:60179e611f:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.021 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:87cb66e306' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.053 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:0b51a19946' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.077 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:2df5aa8a86' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.081 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:10f6258d1a:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.162 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:1e24e8460d:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.287 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:46e5506d6a:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.329 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:91b4b89a9d:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.335 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:0cf1f88e47:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.352 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:87cb66e306:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.361 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:0b51a19946:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.381 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:2df5aa8a86:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []

Does this look right?

Best, Jay

Then just use the merged binding as it has the fix in it. Remove all extra jars and just install it as per normal.

Done.

  • Stopped IPCam 3.2m4 addon, uninstalled it then deleted it
  • Uninstalled TellStick from the GUI
  • Installed IPCam 3.2m4 from the GUI
  • Stopped OH
  • Cleared /Cache & /Tmp
  • Rebooted

Same issue, Things are online but no item channels are working with it.

This is pretty much a clean install on a new Pi4. I don’t even have rules running yet, just trying to get the Things and Items to work as first step.

What can I provide you to figure this out? Debugs, remote connection to my system, etc.?

Thanks again!

Best, Jay

Debug or trace log output would be the first step. The ipcamera binding documentation has at the very first section titled ‘how to get help’ which gives the command to enable the log output, then please start a new thread and feel free to mention my name in it or post a link to it from here.

Hikvision cameras have an illegal login lock that once tripped will mean you have to reboot the camera, worth doing in case that is the cause but the logs should be picking that up when you enable debug/trace.

Also you should try and open the stream by just typing the URL into any web browser, the binding should log that it got the request and then the following info may yield a clue as to what is wrong.

Hi @matt1,

I found out the issues with my HikVision NVR model DS-7208HUI-K2 configuration with migrating the binding versions from 2.5 to 3.x.

Here’s a summary of them.

v2.5 has two channels that are NOT named the same on v3.x

  • updateImageNow is now pollImage
  • videourl is now mjpegUrl (at least I think it is)

v2.5 does NOT need the updateImageNow turned ON to update the IMAGE channel but v3.x pullImage channel does.

v2.5 has a “Poll Time” value which is defaulted to 1000. The v2.5 binding has an option called “Update the JPG and Image when: Always update JPG” which is 1. v3.x has an option called “Update Image Channel When” which is defaulted to None but if you put it to follow pullImage which is option 1 to mirror v2.5 setting, this isn’t the same thing. You must have v3.x pullImage switch ON for this to work.

I did get these to work: [EDITED]

http://openhab:8080/ipcamera/cameraUID/ipcamera.jpg
http://openhab:8080/ipcamera/cameraUID/ipcamera.mjpeg
http://openhab:8080/ipcamera/cameraUID/snapshots.mjpeg

These did NOT get these working but I didn’t spend much time trying to debug why: [EDITED]

http://openhab:8080/ipcamera/cameraUID/ipcamera.m3u8
http://openhab:8080/ipcamera/cameraUID/autofps.mjpeg

I’m interested in how to push the ipcamera.jpg url into a native IMAGE item in the item file. Is it simply this format or something else?

Image HIKFrontDoorImage { http://openhab:8080/ipcamera/cameraUID/ipcamera.jpg }

Best, Jay

Those URL’s are wrong as they are missing the uniqueID of the camera. Since you are using 3.2m4 you can find the next gen documentation here
IP Camera - Bindings | openHAB

Replied to your other post on this.

I tested the image channel last night and it is working when the channel is turned on, as per the documentation. Yes this was changed at some point. I am also working towards making the binding be fully on demand and not poll at all so it would be best to change to a method that keeps the pollTime at 1000 ms as this is where I do all my testing.

My fault, this interface doesn’t like brackets around a variable, it striped the uniqueID out of the URL. I removed the brackets from the post.

Best, Jay

Hello there. Anyone in a mood to give a help? I am needed :smiley:

Trying to get any sitemap view of my DCS 932L (DLINK) cam in openhab. Openhab 3.1 running, ffmpeg installed and ONVIF Things is connected.

There is a http://192.168.8.100/image/jpeg.cgi snapshot url 100% functional.

I tried to follow already many times the IP Camera binding documentation (Console…Trace…Logs I got all done).

PD: I am trying both ONVIF and HTTP IP things in case the problem was the ONVIF.
I get no luck in any of then and no stream no image is generated.

Log:

2021-11-14 12:19:49.441 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.8.100:80/image/jpeg.cgi

2021-11-14 12:19:54.955 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime

2021-11-14 12:19:54.971 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.8.100:80/image/jpeg.cgi

2021-11-14 12:19:55.045 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:

The request is forbidden.





I wanted to report the successful use of my ip camera with openHAB. But I can’t find where this request was expressed and therefore the details on how to do it. Anyone knows?

Hi,

Is there an option to override base URL of the ipcamera URLs?
I run Openhab in Docker with several network interfaces and have 3 distinct IP-s. In addition I access openhab with nginx reverse proxy through HTTPS.

So my ipcamera HSL URL looks like this:

http://192.168.1.8:8081/ipcamera/doorbell/ipcamera.m3u8

Chrome throws an error that http is not served inside a https page (Or something like that) so the stream does not start. If I open openhab with http only the stream is able to start.
What I need is to exchange base URL from the wrong IP and http url to https://fqdn

https://oh3.example.net/ipcamera/doorbell/ipcamera.m3u8

If I specify the above url manually in a video player card on the Web UI the stream is started correctly even though https. But I need to skip selecting the created HLSURL item. IT would be more convenient to use the item and not to override the given URL.

Thank you.
Zsolt.

You can create your own String item and put any URL you want into it by using a rule that triggers when the system is started.

Hi @matt1,

I’m having trouble getting this one to work.

In the documentation it refers to (serverPort=54324) but the GUI doesn’t have any place to set this value. I’m assuming because of the new URL handling this with version 3.2m4 of the binding?

How can I test the ffmpeg setup with the parameters in the GUI? Asking for command line syntax.

Here’s the settings for HIKVision NVR I have setup:



Best, Jay

Correct. You can see the updated version of the documentation if you click on the LATEST button in the top left corner of the website. Or this link takes you there…

IP Camera - Bindings | openHAB

Not sure I under5stand the question. If you enable DEBUG log level you will get the command that is trying to be run, plus you will get any errors that ffmpeg is throwing.

BTW you do not need to include the user:pass@ in any urls, the binding will take care of that automatically so the password is only in 1 place if you ever want to change it.

1 Like

I got ipcamera.m3u8 URL to work now.

I was using the IP of the NVR vs. OH for testing the ipcamera.m3u8 URL (my fault copying/pasting URL’s in the camera configs) and then using them for testing. I ended up using the “VLC media player app” for testing with the OH ipcamera.m3u8 URL.

http://OH_IP:8080/ipcamera/cameraUID/ipcamera.m3u8 ← correct
http://NVR_IP:8080/ipcamera/cameraUID/ipcamera.m3u8 ← incorrect

Thanks again for telling me about removing the user/pass out of the URL’s in the camera configs.

Best, Jay

@matt1 Thanks for one of the best bindings for Openhab! It works perfectly for me, except for one thing, the ffmpeg audio alerts stop working after a (temporary) connection issue or when I for example manually restart the camera (to test).
The only way to get it working again is to move the audioThreshold slider one up, that seems to restart the process when looking at the trace logs. I can of course make a rule which increases and decreases the threshold every minute (to restart the stream) but is there a chance you could make it retryable?

These are the last logs when rebooting the camera (Foscam):

2021-11-27 10:34:33.704 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - size=N/A time=00:19:06.74 bitrate=N/A speed=0.999x    
2021-11-27 10:34:34.319 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - size=N/A time=00:19:07.36 bitrate=N/A speed=0.999x    
2021-11-27 10:34:34.845 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - size=N/A time=00:19:07.88 bitrate=N/A speed=0.999x    
2021-11-27 10:34:35.383 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - size=N/A time=00:19:08.42 bitrate=N/A speed=0.999x    
2021-11-27 10:34:35.949 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - size=N/A time=00:19:08.98 bitrate=N/A speed=0.999x  

Would expect a connection issue message or something but it seems to just hang…

Btw, I know that Foscam has built-in audio alerts but I’m not satisfied with the (streaming) performance so looking for another cam (Reolink). Unfortunately, most of them don’t have built-in audio alerts so need the ffmpeg variant. I’m assuming this (ffmpeg alerts) works the same for all cams, it’s not a specific Foscam issue, so I will have this issue when buying the Reolink.

Logs after setting the threshold +1:

2021-11-27 10:44:49.875 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Stopping ffmpeg RTSP_ALARMS now when keepalive is:8
2021-11-27 10:44:49.884 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -i rtsp://user:********@192.168.2.79:88/audio -af silencedetect=n=-32dB:d=2 -f null -
2021-11-27 10:44:50.194 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - ffmpeg version 4.1.8-0+deb10u1 Copyright (c) 2000-2021 the FFmpeg developers
2021-11-27 10:44:50.197 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] -   built with gcc 8 (Debian 8.3.0-6)

Thanks for reporting as since I dont use that feature I was not aware it would not restart, but it makes sense…

Correct, same for all cameras if using ffmpeg. If your using Hikvision, Dahua, Amcrest and Instar they will all auto restart the event/alarms methods. Foscams built in should also work automatically. ONVIF cameras that support audio alarms should also restart if the camera goes offline but I have not tested that. Try forcing the foscam to be a ONVIF thing type and check to see if it sends an alarm via the onvif methods.

If the logs say that it had to stop the process when you change the threshold, I don’t think it is an easy fix unless the camera goes offline which will close the process. If you set the gifPreroll to a positive number then it will be polling snapshots and will go offline quickly, that may solve half the issue of knowing when it has stopped, then it would need something added to relaunch the detection. You may be able to restart it with a rule when the camera comes back online.

Hi,

I am trying to use IP Camera Binding, but no luck. I have a Fibaro intercom, that has generic camera, that streams mjpeg. My intercom requires that I provide login:pass within URL. Can this be an issue?
My camera is configured like this:

Thing ipcamera:generic:FibaroCam
[
    ipAddress="192.168.1.229", serverPort=54322,
    gifPreroll=1,
	username="username",
    password="pass",
    snapshotUrl="http://username:pass@192.168.1.229:8080/live/mjpeg",
    mjpegUrl="http://username:pass@192.168.1.229:8080/live/mjpeg",
    ffmpegInputOptions="-f mjpeg",
    ffmpegOutput="/tmp/FibaroCamera/", ffmpegInput="http://username:pass@192.168.1.229:8080/live/mjpeg"
]

I enabled trace, but I don’t see any errors. Camera shows as online.
What I would like to do is to access it using openhabs ip: http://192.168.1.34:54322/ipcamera.mjpeg (in my case)

I use OpenHab 3.1

EDIT:

After playing with it a bit more, now I notice, a line like this in the log:

It looks like ffmpeg can’t somehow access mjpeg stream. Any ideas will be very welcom.

Many Thanks!
Marcin