IpCamera: New IP Camera Binding

Yes it is possible, best to raise this as an issue on github as it can get lost in this forum. Also if you have tested and found that Foscam thing type does not detect offline the same as other cameras, then add that to the same issue as it can be looked into at the same time. Changes to the online/offline detection were made recently in 3.2m4 so upgrade if you are not using the latest.

Does anyone have the same issues as me?

The mjpeg stream works for about half a day before becoming completely unresponsive. I can view the feed from the camera itself so it’s not the feed that’s down.

When this happens, other parts of OH GUI stop working as well (BasicUI/HabPanel all timing out as well).

When the mjpeg stream is open, BasicUI/HabPanel sometimes get stuck on loading until I kill the stream then everything immediately comes back.

I’m guessing the mjpeg stream doesn’t close properly so it ends up running out of available sockets. Where do I start looking to confirm this theory?

Edit: I’ve also had to restart the entirety of openhab each time this happens to restore functionality. Would appreciate if someone knows of a less intrusive specific service reboot if it exists.

What version of openhab and which stream is it?

Streams can end for example
The camera reboots because the firmware has it scheduled to do that.
The camera does not allow long running streams and closes them to free up resources.
The browser goes into a sleep mode.
Wifi or network issues break the stream.

In the latest milestone the snapshot based streams will keep running even if the camera reboots or you pull the cable and fix the issue.

Use the pause button to reboot just a single thing.

I’m on openHAB 3.2.0.M4.

I do think the cam is dropping off randomly due to wifi but somehow the mjpeg stream never comes back after that.

I’ve tried the pause button. Once I press pause on a cam that’s “broken” it just makes the Thing unresponsive entirely. The rest of OH would work but when I click into the cam that I paused it would not finish loading. That means I can’t unpause the cam that I just paused unless I reboot OH entirely.

Ipcamera.mjpeg will NOT come back after that.
snapshots.mjpeg and autofps.mjpeg both WILL come back but only in the latest milestone which you have.

It is possible to make the same change to the binding to allow ipcamera.mjpeg to come back but can you test if one of the other two works for you?

If it is the browser going into a sleep mode to save battery life on a tablet, then that will kill all of them and need the refresh to be pushed on the browser.

I have no clue as to the cause of this. You need to look at the TRACE logs to work out what causes the camera to break in the first place.

I’m not sure what you consider as “working”.

They do not go into the same never ending loop of load as ipcamera but they do not serve the updated frames at all. They’re serving an old static frame that does not update.

That is not normal. Unless you have changed the pollTime setting from the default 1000ms value, the snapshots.mjpeg should update every second. I can pull the cable out of the wired cameras that I have here, wait unlimited time, plug the camera back in and the stream without any action needed from me will start updating again every second. It works flawlessly here. As mentioned this feature was only added in the latest milestone unless my memory has failed and it wont be out until 3.2 Stable in a few weeks time.

If you looked at the TRACE logs you would know what is happening.

There is another method and that is using a jpg URL and doing an auto refresh on it with the oh image card widget. This by design can handle bad camera connections.

Hi,

The binding is woking and generaging a mpjepg on the dedictated port. In the properties I set the correct FFmpeg Input link (validated with my browser), the FFmpeg Install Location is correct (/usr/bin/ffmpeg) and the output folder is set to: /etc/openhab/html/camera_north/

The sub-folder in html is created, but no files are generated. What do I wrong?

Thank you for this great binding.
One information from me: Im using an Amcrest Cam (IP2M-841B).
In the documentation of the binding is the following information:"

Amcrest

It is better to always setup your Amcrest camera as a dahua thing type. The old alarm polling based method is used if you setup as amcrest, and the newer/better event based method is used if you setup as dahua instead. All other features should be the same between the two."

At first i used the camera with the “dahua” thing type. But Unfortunately the motion alarm/audio alarm polling was not working. After switching to the “amcrest” thing type evertyhing works well.

Is there an disadvantage to use the amcrest thing type?

PS: Sorry for my englisch

Not that matters or you will notice
 Polling uses more resources then if something is event based. CPU load only occurs when something happens VS CPU load every X seconds even if something is not happening.

There may be less channels in amcrest thing type especially with some of the newer features I am adding as they rely/require the event stream.

You will also find the alarms are quicker to respond with dahua method.

That is very similar/same to my main test camera and I have noticed an issue with the audio alarm in recent firmware’s and found a fix for it recently that has not been pushed to the main project yet. Not aware of any issues with the motion alarm. I should have a newer build in the coming weeks that you should try.

EDIT: @Mike5 I found time and the build is found here.
Index of /openhab/IpCameraBinding/ (pcmus.com)

I have a Hikvision doorbell DS-KV6113. I was unable to get the image/video using the IPCamera binding. I tried several ways to connect to the camera (Hikvision, Onvif, RSTP), and none of these worked. Is there someone who successfully configured the binding for this doorbell camera ?

The camera appears to have no ONVIF in it so onvif thing type wont work (correct me if I am wrong on this).
You will need to manually give any URLS to the binding as it can not auto find them if the camera has no ONVIF.

ONVIF Port: 8999
rtsp://ip:554/cam1/h264
rtsp://ip:554/ch1/main/av_stream
rtsp://ip:554/Streaming/Channels/101
rtsp://ip:554/Streaming/Channels/102
snapshots may work with this:
http://ip/jpeg/view.html

What happens if you run this from linux terminal?

curl -i --digest -u admin:password http://192.168.0.70/ISAPI/Event/notification/alertStream

Do you have it connected to the indoor monitor, NVR or standalone?

You are right concerning the lack of ONVIF support. With the curl command, I got the following results:

<?xml version="1.0" encoding="UTF-8"?>

if I execute:

curl -i --digest -u admin:password http://192.168.1.147/ISAPI/VideoIntercom/callStatus?format=json

I got this:

{
	"CallStatus":	{
		"status":	"idle"
	}

So the camera is reachable through the Hikvision API

Yes I have an Hikvision indoor station. It works perfectly.

Not really the normal API, as the API is normally XML based and that reply looks to be JSON based. It wont work with the binding, however there appear to be some python scripts around that talk to those cameras and custom hacked firmwares. Using a firmware that is hacked, you really have to trust the person that has created and shared the firmware.

Thank you matt1. I want to install the binding, but have a problem: After putting the .jar file in the addon directory i get the following error message:
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [270]
Unresolved requirement: Import-Package: io.netty.bootstrap; version="[4.1.0,5.0.0)"

i think i have to install the “io.netty.bootstrap” first. But i have no idea how to do this (google is this time not my friend :smiley: ).
Do you have an idea?

PS: the (old) binding works very well with the “amcrest thing type” for me. But i never have an actual snapshot (if i open the URL of the .jpg there is always an old pic - i guess from the start of the camera?!?) I will test it with the new version.

Thank you so much !

The info you need is found in this post and will also explain the breaking change if you are using very old.

The old snapshot was a bug that is fixed in newer builds already.

Hi matt1,

thank you for your reply.

Point1:

i have installed the new bindig version and created a new “dahua” thing for my amcrest cam.
Unfortunately the items AudioAlarm, MotionAlarm and LastMotionType still not be updatet.
Following code is showing in the trace-log - But the item is not be updating:

Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

Point 2:

I still dont get a picture with “192.168.0.80:8080/ipcamera/1921680108/ipcamera.jpg”. The log is showing the follow:

[WARN ] [amera.internal.servlet.CameraServlet] - ipcamera.jpg was requested but there was no jpg in ram to send.

I can see in the logtrace that every second a get is send.

2021-12-12 11:55:21.886 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.108:80/cgi-bin/snapshot.cgi?channel=1
2021-12-12 11:55:21.981 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - Camera at IP:192.168.0.108 gave a reply with a response code of :500

I have testet the get link with “username:passwort@192.168.0.108/cgi-bin/snapshot.cgi” but nothing is showing. I think my cam is not working correct


Sorry for the long post.
Greetings Mike

See this post and follow the steps. I suspect this is the cause.

Amcrest camera work around for http 500 errors - Hardware / Home Automation - openHAB Community

Strange, can you post the actual multiple lines from the TRACE log as that may help see what is happening. Perhaps it is linked to the camera not giving the snapshot, probably fix that first and then work back on the alarms.