IpCamera: New IP Camera Binding

I upgraded 2 days ago to the latest versions. I wanted to try out the marketplace, and noticed that this binding was still manual through /addons/. So I installed the binding through the GUI. I’m on 3.2.0.

283 │ Active │ 80 │ 3.2.0 │ openHAB Add-ons :: Bundles :: IpCamera Binding

I was in contact with Reolink to get the latest firmware for that camera. They confirmed thay I had the lasted one, and offered to have a look at the ONVIF settings. This is what they suggest:

There are three of ONVIF PTZ control: Absolute move, Relative move and Continuous move.
For our cameras, our current ONVIF only supports Continuous move.
In this case, please configure PTZ continuous: true to have a check.

Not sure if this help?

I’ll try to have a tcpdump this evening if this can be helpfull.

Hi @matt1 ,

i have also the problems like @paglatz .

In Version 3.1 everything works very fine, but now there are massive picture fragments, is flickering all the time and is really not nice to look at.

The Problem is only in the Mjpeg Stream. The HLS Stream is very fine.

Here is my configuration:

Thing ipcamera:dahua:XXXXXX “Q-XXXX-XXXX-LAN”
[
ipAddress=“192.168.XXX.XX”,
password=“XXXX”,
username=“XXXXX”,
pollTime=1000,
ffmpegInput=“rtsp://192.168.XXX.XX:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif”,
hlsOutOptions="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4",
port=80,
updateImageWhen=“1”,
onvifPort=80,
gifPreroll=5,
ipWhitelist=“DISABLE”

]

I lower down the quality of the stream but it is always flickering.
I think there has to be a problem in the binding because it was working with version 3.1…

I have 2 dahua cams, and 1 Instar cam. All cameras have the Problem in the mjpeg Stream.

Thanks for your help

I’m not sure if this has been mentioned already but in case it’s any help to anyone I’ve migrated my DSL rule for sending an animated GIF notification via Pushover from a DSL rule to a JS Script rule.

The DSL rule is:

rule "Send front door camera GIF via Pushover"
when
    Item CameraFrontDoor_GIFRecordingSeconds changed to 0
then
    sendPushoverMessage(pushoverBuilder("Sending GIF from front door").withAttachment("/etc/openhab2/html/tmpfs/camerafrontdoor/ipcamera.gif"))
end

The equivalent JS Script rule is:

  rules.JSRule({
    name: "Front door GIF recorded",
    description: "Front door GIF recorded",
    triggers: [triggers.ItemStateChangeTrigger('CameraFrontDoor_GIFRecording', '5', '0',)],
    execute: data => {
        var logger = log(this.ruleUID);
        var triggeringItem = items.getItem(data.itemName);
        logger.info("CameraFrontDoor_GIFRecording item name is ({}), value = ({}), label = ({}), type = ({}).", triggeringItem.name, triggeringItem.state, triggeringItem.label, triggeringItem.type);
  
        actions.get("pushover", "pushover:pushover-account:59025b14aa").sendAttachmentMessage("Sending GIF from front door", "openHAB3", "/etc/openhab/html/ipcamera/camerafrontdoor/ipcamera.gif", "image/gif");
    }
  });

Thanks again for all your hard work, Matt.

Hi guys

Binding version 3.1.1, openhabian install on a Pi 3.

Great binding. I have generally got things working well for a Hikvision NVR however I seem to be having difficulty getting the line crossing alarm to come through reliably.
I have the Motion Alarm (working fine and triggers straight away) and the Line Crossing Alarm channels & items set up.

I am having the Line Crossing Alarm sometimes come through to openHab and sometimes it comes through however a few minutes later. I do know the Line Crossing Alarm is working correctly on the NVR as it sends an email with the images and does the Audible Warning on the NVR.

Has anyone had a similar experience or got any ideas I could check?

Cheers,

See here
Flickering mjpeg stream of ipcamera binding after upgrade to 3.2 - Add-ons / Bindings - openHAB Community

I have been doing some fault finding on mjpeg streams at the moment.

I do not see any issue with your mjpeg stream, it should work with the latest binding. What FPS do you use and does going to a lower value help? What is your symptom and it is best to open a new thread so the history is not tangled up in this massive thread.

The only issue I know of that Marcin was having was for a JPG url. The camera did not give a size for the jpg and then never closed the data stream, so there was no way to know when the full jpg was sent without resorting to a work around using timers to detect when the jpg stream had finished.

With mjpeg streams, it is normal as the stream never closes, but for a jpg it should close.

Without knowing what your trying to do and what the problem is I can’t fault find and I refuse to help if someone does not open a new thread as it is insane to dig through a thread like this to find previous info and details.

If anyone is able to help test, I have made changes so that the stream from ipcamera.mjpeg now will keep working on a tablet (or other device) even if the camera reboots or drops out of the wifi. @justjosh this may interest you. Contains other fixes in the same areas and fixed an issue with using the stream multiple times if it came from a RTSP source. Fixes an issue with flickering pictures as well that some have reported.

http://pcmus.com/openhab/IpCameraBinding/

Hi,

I tested the the mjpeg stream an everything is fine. Clear and stable picture and the mjpeg stream even continues without page reload after a camera reboot.

My setup:
Raspberry Pi 4 Model B 4GB RAM
Openhab 3.2
Raspbian GNU/Linux 10 (buster)
OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
Camera: Lupus LE 202
MJPEG Stream 640x480 px, 20 FPS, 2048 kb/s

Hi,

My security cam seem very simple to view. I open this URL in VLC

rtsp://1.2.3.4/user=admin_password=_channel=1_stream=1

And VLC shows the stream. Great.

I’m not sure how to replicate this in this camera binding. I have this.

But get this error;

2022-01-03 21:09:53.312 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.ipcamera.internal.handler.IpCameraHandler@22bfbe05': Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@6cf78e1f[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@1517a110[Wrapped task = org.openhab.binding.ipcamera.internal.handler.IpCameraHandler$$Lambda$1415/0x0000000101287440@7814a06]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2624a16d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@6cf78e1f[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@1517a110[Wrapped task = org.openhab.binding.ipcamera.internal.handler.IpCameraHandler$$Lambda$1415/0x0000000101287440@7814a06]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2624a16d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:340) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:680) ~[?:?]
        at org.openhab.binding.ipcamera.internal.handler.IpCameraHandler.tryConnecting(IpCameraHandler.java:1646) ~[?:?]
        at org.openhab.binding.ipcamera.internal.handler.IpCameraHandler.initialize(IpCameraHandler.java:1635) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
2022-01-03 21:09:53.313 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'ipcamera:generic:ac0f3d4faa': Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@6cf78e1f[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@1517a110[Wrapped task = org.openhab.binding.ipcamera.internal.handler.IpCameraHandler$$Lambda$1415/0x0000000101287440@7814a06]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2624a16d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@6cf78e1f[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@1517a110[Wrapped task = org.openhab.binding.ipcamera.internal.handler.IpCameraHandler$$Lambda$1415/0x0000000101287440@7814a06]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2624a16d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:340) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:680) ~[?:?]
        at org.openhab.binding.ipcamera.internal.handler.IpCameraHandler.tryConnecting(IpCameraHandler.java:1646) ~[?:?]
        at org.openhab.binding.ipcamera.internal.handler.IpCameraHandler.initialize(IpCameraHandler.java:1635) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Can this be made to work?

It should work you just need to supply that url to the ffmpegInput config Field. Instead of a screen shot please post the CODE tab details so all settings can be seen. I’ll see if I can reproduce the error here but I suspect it won’t happen when you fill in the ffmepg input field.

You will also need to install ffmpeg if not done already.

Yes I have that installed on my box.

UID: ipcamera:generic:ac0f3d4faa
label: RTSP/HTTP IP Camera
thingTypeUID: ipcamera:generic
configuration:
  mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ipAddress: 172.17.90.102
  mjpegUrl: rtsp://172.17.90.102/user=admin_password=_channel=1_stream=1
  updateImageWhen: "0"
  gifPreroll: 0
  ffmpegLocation: /usr/bin/ffmpeg
  ipWhitelist: DISABLE
  mp4OutOptions: -c:v copy -c:a copy
  pollTime: 1000
  port: 554
  snapshotUrl: ffmpeg
  snapshotOptions: -an -vsync vfr -q:v 2 -update 1
  hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
    -hls_flags delete_segments -hls_time 2 -hls_list_size 4
  gifOutOptions: -r 2 -filter_complex
    scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse

Tick the show advanced box if you can not see it, but there should be a field called ffmpeg input. What version of openHAB are you using? what format is the camera sending, h264 or mjpeg? I found a number of bugs and fixed them in the 3.2 Stable build that effected people with RTSP only cameras, so make sure you upgrade.

Working fine now thanks!! :slight_smile:

Hi, since upgrading to OH3.2 from 3.1 I am struggling to get my Reolink 511WA to work. It was working pretty well under 3.1 (the below issue would come up very, very rarely), but with OH3.2 the camera is not working most of the time.

I have set up the camera with an Onvif profile, port 8000. As I said, that was all working well enough with OH3.1. I have linked only a few channels to items, mainly the ones relating to alarms / motion detection, none related to getting images, video, etc.

Ever since upgrading to OH3.2 I am getting the below warning every few hours, and then usually four times within a minute:

2022-01-07 16:48:18.726 [WARN ] [amera.internal.onvif.OnvifConnection] - Binding could not determin the cameras current PTZ location. Not all cameras respond to GetStatus requests.

Also, most of the time now the items stop functioning, ie motion alarms do not arrive in OH anymore, although there have been episodes where they have been working again for a couple of hours. Could not make out what was different, though.

There were no obvious configuration errors in the camera thing, so I tried deleting the thing and then re-adding it (the scan function did not find the camera, so I had to add manually as an Onvif camera). That did not fix the issue, though, the above warning popped up afterwards again.

Looking at the thing / items a bit closer, I see that all the alarm items, including the ones that used to work previously (eg LastMotionType and CellMotionAlarm) remain NULL, despite alarms being registered by the camera. On the other hand, just for testing I activated the Url items, and they do receive proper values.

Not sure whether that is relevant, but I also have the camera connected to Synology Surveillance Station, and there all alarms are registered well and recordings are created.

I am a bit at a loss now and would very much appreciate any ideas or pointers on how to get this going again…

Can you open your own new thread and place a summary of your system in it and also some DEBUG and TRACE level logs from when the camera first connects (use pause and unpause button in the thing) and also when the alarm first stop working. The docs have a section titled what to do if you need help, please read that first.

Sure, will do, thanks.
Here’s the post:

Hi,

I have a very similar issue. In OH 3.1 everything works as expected then I upgradet to 3.2 because of an other Binding witch wasn´t working in OH3.1.
But now the Camera Binding isn´t working anymore.

When I power the camera OFF and ON the stream URL (http://openhab:8080/ipcamera//ipcamera.mjpeg) is not working.
When I have a fresh installation of the Binding the url is working till I power off the camera.

Do you have a fix for that?

Hi community,
I’m looking for a security camera most compatible with OH.
On first post I can read the most featured cam are the ONVIF with API.
Now when I read the tested cam list I can see 2 kind of cameras:
API cameras
Onvif Cameras.
Is right to say that the API cameras include the onvif and are the most complete?

Any suggestion is accepted. I don’t have any cam, so I want to buy a unique brand and I need a pan/tilt cam and some static cam.
The pan/tilt can be PoE but I prefere WiFi (better wifi6), the static cameras should be wifi.
All the cameras should be API and onvif.
Thanks to all

Yes all cameras in the first post of this thread that have an API are onvif as well as I have not bothered to add any apis from brands that are not. The exception is foscam which not all models get support added to them for some reason. If your wanting PTZ then look at Dahua and Amcrest.

@Joko my reply is the same as I posted in reply to the person above just a few posts before yours.