IpCamera: New IP Camera Binding

Do you have the date that the jar file was created on? I can use that to compare code. It is possible to work around this but is there a newer firmware for the camera?

I copied the files produced from ffmpeg to my windows machine. I can watch the ts-files and i can watch the gif. The content of the m3u8 is the path to some ts-files.

The right way of showing the live-stream inside my sitemap is to use the mjpeg-stream produced from ffmpeg? Or will this mjpeg-stream be only visible if the camera can show me a mjpeg? My cam only has a rstp-adress for the stream.

On my android phone the sitemap only shows me an empty box with a big ā€œplayā€-button. And on my windows machine with chrome i get a file-explorer-box opening where to save the m3u8-fileā€¦

But my goal is to show the live-stream inside my sitemap - working on every machine, also on android phones - like the mjpeg-stream provided from my dahua-cam to the binding.


In the logs i can see this line:

2020-01-13 08:09:31.418 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.102.113rtsp://192.168.102.113:554/user=admin_password=tlJwpbo6_channel=0_stream=0.sdp?real_stream

There is something wrong, it only should be http or rtsp - but not bothā€¦

Here is some more log, maybe this is helpful?

2020-01-13 08:13:23.527 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
2020-01-13 08:13:23.527 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:<html><head><title>404 File Not Found</title></head>
<body>The requested URL was not found on this server</body></html>
:
2020-01-13 08:13:24.680 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.102.113rtsp://192.168.102.113:554/user=admin_password=tlJwpbo6_channel=0_stream=0.sdp?real_stream
2020-01-13 08:13:24.786 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.0)
HTTP/1.0 200 OK
Content-type: application/binary
Server: uc-httpd 1.0.0
Expires: 0
2020-01-13 08:13:24.786 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 120, cap: 120/120, unwrapped: PooledUnsafeDirectByteBuf(ridx: 192, widx: 192, cap: 1024)), decoderResult: success)
2020-01-13 08:13:24.787 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
2020-01-13 08:13:24.787 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:<html><head><title>404 File Not Found</title></head>
<body>The requested URL was not found on this server</body></html>
:
2020-01-13 08:13:25.418 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.102.113rtsp://192.168.102.113:554/user=admin_password=tlJwpbo6_channel=0_stream=0.sdp?real_stream
2020-01-13 08:13:25.527 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.0)
HTTP/1.0 200 OK
Content-type: application/binary
Server: uc-httpd 1.0.0
Expires: 0
2020-01-13 08:13:25.528 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 120, cap: 120/120, unwrapped: PooledUnsafeDirectByteBuf(ridx: 192, widx: 192, cap: 1024)), decoderResult: success)
2020-01-13 08:13:25.528 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
2020-01-13 08:13:25.528 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:<html><head><title>404 File Not Found</title></head>
<body>The requested URL was not found on this server</body></html>
:

Mjpeg can only come from a http source currently, I am literally in the middle of trying to code what you want to do.
HLS needs a plug-in in some browsers. For iOS it works right away and if you use a chromecast it should work right away to cast to your tv. In the Android app I donā€™t know how to add plugins so mjpeg is your best best. I am working on a few new features for RTSP only cameras at the moment.

All this is covered in the readme here

Ok, thanks, so i can stop testing. Then i will wait, until mjpeg from rtsp-streams will work.

My cheap china cam offers only one rtsp-stream and no snapshot. So currently iĀ“m not able to see the picture on my multiple devices.


My dahua cam is working very well, but there i have a https-stream-adress and a mjpeg-stream also.

Will check when I get back home to night. But I believe itĀ“s almost a year old.

Hi @matt1
This is the binding I use on my main OH setup (Rpi3).

openhab> bundle:list -s |grep -i ipcam
207 x Active x  80 x 2.5.0.201901260300      x org.openhab.binding.ipcamera
openhab>
1 Like

Hi,
I have moved everything over to openHAB 2.5 on RPi4. (openhabian)

I am also using HTTP only. Thing is online but no image is received. Checked the log in trace mode and saw this:

 HTTP Result back from camera is 	:<html><head><title>Document Error: Unauthorized</title></head>

		<body><h2>Access Error: Unauthorized</h2>

		when trying to obtain <b>/live/0/jpeg.jpg</b><br><p>Access Denied

Unknown User or Wrong Password</p></body></html>

Login hasnā€™t changed. openHAB v2.4 is still OK. I have it running on a RPi3.

Any ideas?
M

I made a Firmware Update on my camera, but it didnā€™t helped.
So maybe you find the Problem with the Old Version compareā€¦

Just for the record. I get the same error as soon as I override the snapshot URL in the config, even if I declare my camera as a httponly type.

2020-01-13 21:57:52.551 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)

HTTP/1.1 200 OK

Server: nginx/1.6.2

Date: Mon, 13 Jan 2020 20:57:53 GMT

Content-Type: image/jpeg

Content-Length: 74244

Connection: keep-alive

X-Frame-Options: SAMEORIGIN

Strict-Transport-Security: max-age=63072000; includeSubdomains; preload

X-XSS-Protection: 1; mode=block

X-Content-Type-Options: nosniff

2020-01-13 21:57:52.553 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 2578, cap: 2578/2578, unwrapped: PooledUnsafeDirectByteBuf(ridx: 2896, widx: 2896, cap: 65536)), decoderResult: success)

2020-01-13 21:57:52.555 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!! Camera has closed a channel URL: Cause reported is: {}

java.lang.ArrayIndexOutOfBoundsException: null

Thanks for looking at the logs first. Some cameras lock an IP out if they see multiple trys with a wrong password, possibly this has been tripped in some way and needs to be turned off in cameras setup? Not sure from that little info as I donā€™t even know the brand of camera for example. Is there any other difference between 2.4 and 2.5? Iā€™m guessing they use different IP addresses so a lockout may effect only 1 of them. Is the binding the same version on both? if not put the newer binding on 2.4 and does it still work? backup first of course :slight_smile:

I know I have to restart my hikvisions if I get it wrong 5 times I think,

@Desmond206x
@Kim_Andersen

I found a solution that will mean your systems will chew more ram to allow the snapshot to work and wont mean everyone elseā€™s cameras have to suffer. For the fix to occur you will need to update your firmware so this exact header is reported by the camera as it then trips the fix to be applied. This header and value must be an exact match, any different and it will do the same as previous builds. Will be in the next build.

My Reolink RCL 410 is already up to dateā€¦
But I wonder, how come it works with the old binding, and not with the latest one?

1 Like

New build 20200114 has these changes:

  • Fixed bug that stopped GIFā€™s being created from a snapshot source.
  • Reolink workaround
  • snapshots.mjpeg which is a very cool new feature. Explained in the readme file, but in short this allows 1fps high res photos to be streamed to all the Openhab UIs without the flashes of white or black that can happen when a snapshot is refreshing. This is how I display my cameras now unless I want HLS streams for higher framerate. Works in android and iOS apps and basicUI.

Is there a way to set the size of an image inside openhab sitemap?

Your new feature snapshots.mjpeg works great, but it is very big and crashes the visibility of my sitemap - it would be nice if i can set the size like in the webview-item.

You could use a sub stream with lower res as the snapshot source to reduce size I guess never tried it as this is very new.

You can use mjpeg in web view the readme points you to a link for examples on how.

Is this something i should worry about?

I get this in my openhab-log every now and then.

2020-01-14 13:33:27.687 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@7ffee3be.

2020-01-14 13:33:30.007 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@52b5539e.

Maybe we should test the other versions of the binding to find out when it breaksā€¦

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

I think Matt got it allrightā€¦ I just need to try the latest one to see if it works.

Hi,

I am using Phylink PLC-132SPW and Phylink PLC-336SPW cameras.

On booting up my openHAB v2.4 RPi3 the camera images reappeared. When I setup openHAB v2.5 I downloaded the latest binding files. If I remove these latest jar files and replace them with the binding I used for v2.4 then the camera images are back again. I have not yet tried the newer IPcamera binding with v2.4. Will post back when I do.

Both bindings are org.openhab.binding.ipcamera-2.5.0-SNAPSHOT except the working one has a last modified date of 21 ā€ŽMarch ā€Ž2019, ā€ā€Ž20:18:08 and is just the one jar file.

@matt1
Thanks for the New Version, but it did not changed anything for meā€¦

2020-01-14 21:46:25.901 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.21/cgi-bin/api.cgi?cmd=Snap&channel=0&user=admin&password=####&width=1024&height=768&rs=WWdwNmACQ56HLBkC&token=ea567f4943cbe09

2020-01-14 21:46:26.166 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)

HTTP/1.1 200 OK

Server: nginx/1.6.2

Date: Tue, 14 Jan 2020 20:46:28 GMT

Content-Type: image/jpeg

Content-Length: 73487

Connection: keep-alive

X-Frame-Options: SAMEORIGIN

Strict-Transport-Security: max-age=63072000; includeSubdomains; preload

X-XSS-Protection: 1; mode=block

X-Content-Type-Options: nosniff

2020-01-14 21:46:26.170 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8135, cap: 8135/8135, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8453, widx: 8453, cap: 65536)), decoderResult: success)

2020-01-14 21:46:26.176 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!!! Camera has closed a channel 	URL: Cause reported is: {}

java.lang.ArrayIndexOutOfBoundsException: 73489

	at org.openhab.binding.ipcamera.handler.IpCameraHandler$CommonCameraHandler.channelRead(IpCameraHandler.java:723) ~[?:?]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [bundleFile:4.1.42.Final]

	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) [bundleFile:4.1.42.Final]

	at org.openhab.binding.ipcamera.internal.MyNettyAuthHandler.channelRead(MyNettyAuthHandler.java:239) [bundleFile:?]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [bundleFile:4.1.42.Final]

	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) [bundleFile:4.1.42.Final]

	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328) [bundleFile:4.1.42.Final]

	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302) [bundleFile:4.1.42.Final]

	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [bundleFile:4.1.42.Final]

	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [bundleFile:4.1.42.Final]

	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final]

	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [bundleFile:4.1.42.Final]

	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [bundleFile:4.1.42.Final]

	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [bundleFile:4.1.42.Final]

	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [bundleFile:4.1.42.Final]

	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [bundleFile:4.1.42.Final]

	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [bundleFile:4.1.42.Final]

	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [bundleFile:4.1.42.Final]

	at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final]

	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final]

	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]