IpCamera: New IP Camera Binding

I just would like to report some issues I have seen.
Maybe someone else has similar experience.
(see below the gap between 09:49 and 10:30

I still have the issue that the ipcam binding seems to causes my OH to kind of hang up.
2020-06-21 09:48:54.869 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:48:55.190 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:48:55.565 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:48:59.285 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:48:59.362 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:48:59.560 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:48:59.848 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:49:03.929 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:49:03.959 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:49:04.219 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:49:04.381 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-06-21 09:49:05.188 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.68.57/tmpfs/auto.jpg
2020-06-21 09:49:24.062 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.openhab.core.events.$
2020-06-21 10:30:31.461 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io$
2020-06-21 10:30:44.315 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to 'localhost'. Next attempt in$

I am not quite sure where thisis coming from (might be one new camera I added).
However, without the binding it’s running stable for weeks / months.

another point which caught my attention is, that even after removing the jar files from the addons folder, the ipcamera binding was still reporting in the logs.

When I started another try this morning (no jars in addons) and put your latest version in the addons folder), I got these messages:

2020-06-22 07:39:03.736 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.codec) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:03.839 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.resolver) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:03.880 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.codec-http) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:03.971 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.transport) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:04.051 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.handler) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:04.125 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.common) and version (4.1.42.Final) is already installed.  Updating this bundle instead.
2020-06-22 07:39:04.214 [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (io.netty.buffer) and version (4.1.42.Final) is already installed.  Updating this bundle instead.

Even though, I restarted OH yesterday without the jars in addons!?

I will try to identify the culprit for the hang up

Another minor thing I found out:
The snapshot image is not updated, if NULL.
That means, I need to trigger the update once, so that it will update in the frequency which is setup in PaperUI.
(Time in milliseconds between checking camera states and fetching a JPG/Image)
UPDATE_IMAGE setting is OFF

New Habpanel widget created for the latest version of this binding for any cameras that are PTZ. Please keep all feedback and questions in the thread at the link below.

Do a little more research, there is much better hardware available, that is actually open source. RPi 4 certainly have fixed some of their worst hardware gaffes, but at the end of the day it’s still a locked down platform with a binary blob running the show (instead of the OS you installed).

You mean this community?
Will do.
Any suggestion about a specific thread would be helpful though.

I have seen in the past a lot of HW discussions and in some cases it seems to be very depending on what the users used in the past.

I am actually quite happy with my RPi3B+ (after changing the sd-card to an SSD), so I guess I am biased to RPi as well.

I actually see RPi recommended quite a lot around here, lol, so I think you may need to venture out of the confines, perhaps. :grin:

Nowadays I use the Armbian “Supported” Board list as a starting point / short list / jumping off point for further research. You will find a lot more interesting (and performant) devices over there. The tradeoff, is you will need to do a little research. But there are lots of hardware options, some very well suited to particular tasks like NAS, video display, networking stuff, etc…

The best thing about using Armbian as a base is that it is just plain Debian. Armbian project handles all the low level details and optimizations and therefore you have a nice common base you can build upon, regardless of hardware chosen to fit your particular need.

I have been running it for years, first on a Cubietruck, and more recently on a couple ODROID-XU4. But that is because those meet my requirements. There is a whole another world out there besides RPi! Come on in, the water is fine! :smile:

Thanks for sharing - I will look into the Armbian list.
During my investigation yesterday I found also an Intel NUC mentioned regulary.
Maybe that will be my next choice as I do not need digital IOs for the OH central unit.

EDIT: Sorry just recognized that I kind of hijacked this thread with HW discussion.
This was not my intention.
@TRS-80 I will proceed with my activities here:

Yes @matt1, sorry about that! We will excuse ourselves now! :slight_smile:

Nice looooooooong thread you’ve got here! Nice seeing you, keep up the great work! :slight_smile:

Has anyone else found mjpg streams going offline? I was testing with two on a HapPanel page in CameraFeed widgets, using /ipcamera.mjpeg.

After a while they end up showing the broken image icon. Both are Dahua cams, and when the binding feeds stop, I’m still able to access them directly, via /cgi-bin/mjpg/video.cgi?channel=1&subtype=1

Restarting OpenHab gets them working again. I think modifying my camera .things file will resolve it as well.

Here the same with my china dahua cam. I do openhab service restart and the picture is back again.

Thanks for reporting it. I have had it happen to my Amcrest which is made by dahua. Since it is a PTZ camera when this happens the camera appears to have rebooted and the direction of the camera has changed. Only started happening since I used it in habpanel so only known for a few days, going to look into it ASAP but this may be a camera bug hopefully triggered by something that can be changed in the binding. If people have seen it with another brand that is not made by dahua then please let me know.

FWIW, I had set logging for the binding, and found something in it that looked like it was related to authentication issues (I have since cleared those logs.) Is it possible the binding gets locked out, and then stops trying?

I’ve also seen that it isn’t both cameras at the same time, often one will still be working while the other has gone offline.

I can test anything you’d need, or enable any specific logging if that would help. I removed another camera, so I only have the two Dahua connections at the moment.

Thanks!

No since I can reproduce it easily I don’t need logs and it should be a quick fix.

EDIT:
@jace
I have done some testing and I can confirm this only happens with Dahua based cameras as Hikvision can handle it without the same issue. Work around is to use ‘snapshots.mjpeg’ or ‘autofps.mjpeg’ as different code creates these streams and they don’t come from the cameras file server. The camera gives a http error 500 meaning the file server inside the camera crashed or something like that occured. It is 100% reproducible here by calling a REFRESH when the cameras mjpeg stream is open which means the stream is closed and re-opened only 200 milliseconds apart, it may be a bug in the firmware and if this is the case it should be checked by changing firmware to confirm and then reporting it to the cameras support.

Going to run some tests to look for a work around by increasing the delay to >1 second when a refresh is called for.

1 Like

New build 2020-06-26

  • Fix for cameras that give http 500 error when refreshing mjpeg streams. @jace

Hello

I use your Binding with my onvif IP Cam, it works, but i found a Problem, when i for example Open the SNAP.jpg url in kodi, when someone Rings i send the Link to the SNAP.jpg in a strm File to my kodi.

And i have the SNAP.jpg url in my sitemap.

Then the Alarm function of the camera doesnt works anymore, and after a time the Thing in openhab goes offline.

I think the Problem is that two devices use the SNAP.jpg URL at the Same time.

Have you perhaps a Idea ?

Use the ipcamera.jpg feature to pass the snapshot onto Kodi. The camera will not know other programs are getting the jpg and will only see one login. It is common for some cameras to limit how many devices can connect which is why the binding has this feature so that many tablets can use the camera without issues.

hey

you mean the imageUrl ?

String camera_string "Bild String" { channel="ipcamera:ONVIF:1921680249:imageUrl" }

that was in my case http://192.168.0.73:8099/ipcamera.jpg.
but when I try to open this adress I only get a “page cannot be opened” error message in my browser.

the IP 192.168.0.73 is my openhab.

I simply chose a port in the thing that is not otherwise used, that’s correct isn’t it? (8099)

EDIT
I deactivated the thing and reactivated it, now it works.
which url should I use for a live stream ? not only pictures?
when someone rings its nice to see a live stream.

the mjpeg ?

http://192.168.0.73:8099/ipcamera.mjpeg

If you can work out what caused it to not work until the camera was re-ininitialised by the binding then please let me know so I can look into it for others.

Correct.

This post lists the options and the readme goes into more detail.

Hi!

I have a OEM Camera with ONVIF support.
Via onvif device manager the PTZ works (inclusive the Preset function).
But vie the Binding it doesnt work.
Also the RTSP stream is ok.

This is the log entry after enabling the thing:

2020-06-29 11:22:43.871 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - File server for camera at 192.168.77.142 has started on port 50003 for all NIC's.
2020-06-29 11:22:46.895 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Binding has no snapshot url. Using your CPU and FFmpeg (must be manually installed) to create snapshots.

and this after select a preset:
2020-06-29 11:23:59.915 [WARN ] [nding.ipcamera.onvif.OnvifConnection] - Camera did not report any ONVIF preset locations to the binding

This is my configuration:
Thing ipcamera:ONVIF:Garage “Garage”

[
    IPADDRESS="192.168.77.142",
    PASSWORD="admin",
    USERNAME="admin",
    ONVIF_PORT=554,    
    SERVER_PORT=50003,
FFMPEG_INPUT="rtsp://192.168.77.142:554/user=admin_password=6QNMIQGe_channel=1_stream=0.sdp?real_stream",
FFMPEG_OUTPUT="/tmpfs/camera3/"

]

Can someone help?

See the readme, I will need DEBUG logs from when the camera is connecting to look at the reason why.

Hi!

Here is the log.
First block: Enable thing
Second block: Set Preset (after that, the Open/close StreamserverHandler has a very short intervall time)
Third Block (after disable/enable thing): Set Tilt.

2020-06-29 15:39:25.709 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:Unsubscribe
2020-06-29 15:39:25.745 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Stopping ffmpeg SNAPSHOT now
2020-06-29 15:39:27.250 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Possible NIC/IP match found:192.168.77.60
2020-06-29 15:39:27.252 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - File server for camera at 192.168.77.142 has started on port 50003 for all NIC's.
2020-06-29 15:39:27.254 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-06-29 15:39:30.259 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.77.142:554
2020-06-29 15:39:30.262 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-06-29 15:39:30.272 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Binding has no snapshot url. Using your CPU and FFmpeg (must be manually installed) to create snapshots.
2020-06-29 15:39:30.273 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:/usr/bin/ffmpeg -rtsp_transport tcp -threads 1 -skip_frame nokey -hide_banner -loglevel warning -i rtsp://admin:admin@192.168.77.142:554/user=admin_password=6QNMIQGe_channel=1_stream=0.sdp?real_stream -an -vsync vfr -update 1 http://127.0.0.1:50003/snapshot.jpg
2020-06-29 15:39:36.583 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2020-06-29 15:39:36.605 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x55c9dab4fee0] deprecated pixel format used, make sure you did set range correctly
2020-06-29 15:39:36.634 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:39:36.635 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:39:43.334 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:39:43.335 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:39:50.648 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:39:50.650 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:00.614 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:00.617 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
.....
2020-06-29 15:40:48.636 [WARN ] [nding.ipcamera.onvif.OnvifConnection] - Camera did not report any ONVIF preset locations to the binding
2020-06-29 15:40:48.698 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:48.702 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:48.860 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:48.862 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.008 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.012 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.171 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.173 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.339 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.341 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.491 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.493 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.701 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.704 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:49.856 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:49.860 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:50.011 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:50.013 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:40:50.172 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:40:50.174 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
...
2020-06-29 15:41:42.659 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:41:42.661 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:41:49.407 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:41:49.410 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.
2020-06-29 15:41:52.062 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.
2020-06-29 15:41:52.062 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove
2020-06-29 15:41:57.744 [TRACE] [pcamera.internal.StreamServerHandler] - Opening a StreamServerHandler.
2020-06-29 15:41:57.746 [TRACE] [pcamera.internal.StreamServerHandler] - Closing a StreamServerHandler.