IpCamera: New IP Camera Binding

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.

You have the onvif port set to 554 which I am pretty sure will be wrong. Use paper ui to auto discover the camera and it will also find the onvif port for you.

The auto discover function doesnt find the camera. But I found the correct ONVIF port with device manager (8899). Now presets are working, tilt and pan not. But the camera is real crap, so I think its the camera and not your binding.

Thx for your help!

There seems to be two different ways ONVIF can discover with and the binding only has 1 way implemented. Upnp vs the implemented WS-Discovery… Or it may be that the camera is on a different subnet to the Openhab server that the binding is running on, without more info I can not tell…

That could be if your camera does not support absolute or relative movements, best to fire up onvif device manager and test if the camera can be moved with either ABOLUTE or RELATIVE methods. I think it defaults to using CONTINUOS movements… Personally I find presets to be enough and are the easiest to get working in Openhab without creating heaps of items and links. There is a new widget for moving cameras via the presets if your using Habpanel.

Hi,

i have an Amcrest IP3M-941B. Everything is working fine with the binding and the camera.

The only thing which is not working is Pan,Tilt and Zoom . On the Onvif Device Manager i can move the camera with absolute values from -1 to 1. See here:

Unbenannt1

But when i open the Onvif device manager the continous move is activated. Like this:

Unbenannt2

The camera is detected automatic via openhab and the onvif port is 80 from the default settings.

My configuration is the following:

Dimmer eg_XXXXX_kamera_pan “Schwenken [%d] links/rechts” { channel=“ipcamera:DAHUA:XXXXXXX:pan” }

Sitemap:
Slider item=eg_XXXXX_kamera_pan icon=movecontrol

I would need DEBUG logs to work out what is happening. PM me a small amount of the log when the camera is connecting plus when you try to move the camera.

New build 2020-07-04 has these changes:

  • Now supports Onvif continuous movements (updated the widgets for habpanel so they work as well). All movement types are now implemented. Due to a new config added, you will need to delete and readd the camera if you did not use the textual config method.
  • Moved to a new method of polling the camera to lower traffic down when features are not needed, and to remove the need to set the poll time at exact rates for certain features to work. Will greatly lower network traffic and make things more flexible. It is marked as Beta as it will probably take me a month to go over every possible combination in depth so any help testing the binding with IMAGE_UPDATE_EVENTS=0 would be great.

i added the new binding and added the cameras also new.

it doesnt work:

2020-07-04 11:53:52.822 [me.event.ThingUpdatedEvent] - Thing ‘ipcamera:DAHUA:192168178XX’ has been updated.

2020-07-04 11:53:52.841 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Possible NIC/IP match found:192.168.178.XX

2020-07-04 11:53:52.916 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_enableMotionAlarm changed from NULL to ON

2020-07-04 11:53:52.919 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_zoom changed from NULL to 39

2020-07-04 11:53:52.926 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_tilt changed from NULL to 52

2020-07-04 11:53:52.928 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_pan changed from NULL to 38

2020-07-04 11:53:52.933 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_enableAudioAlarm changed from NULL to ON

2020-07-04 11:53:52.935 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_thresholdAudioAlarm changed from NULL to 50

2020-07-04 11:53:52.938 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - File server for camera at 192.168.178.XX has started on port 54324 for all NIC’s.

2020-07-04 11:53:52.944 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime

2020-07-04 11:53:52.964 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_streamUrl changed from NULL to http://192.168.178.XX:54324/ipcamera.mjpeg

2020-07-04 11:53:52.965 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_hlsUrl changed from NULL to http://192.168.178.XX:54324/ipcamera.m3u8

2020-07-04 11:53:52.970 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_imageUrl changed from NULL to http://192.168.178.XX:54324/ipcamera.jpg

2020-07-04 11:53:53.052 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetCapabilities

2020-07-04 11:53:53.104 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC time is : 10:53:55

2020-07-04 11:53:53.110 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC date is : 2020-7-4

2020-07-04 11:53:53.113 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Openhabs UTC dateTime is:2020-07-04T09:53:53.113Z

2020-07-04 11:53:53.147 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - deviceXAddr:/onvif/device_service

2020-07-04 11:53:53.150 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - eventsXAddr:/onvif/event_service

2020-07-04 11:53:53.157 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - mediaXAddr:/onvif/media_service

2020-07-04 11:53:53.161 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - ptzXAddr:/onvif/ptz_service

2020-07-04 11:53:53.163 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetProfiles

2020-07-04 11:53:55.996 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.178.XX:80

2020-07-04 11:53:55.999 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime

2020-07-04 11:53:56.055 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_19216817861_rtspUrl changed from NULL to rtsp://192.168.178.XX:554/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif

2020-07-04 11:53:56.056 [vent.ItemStateChangedEvent] - ipcamera_DAHUA_192168178XX_updateImageNow changed from NULL to OFF

2020-07-04 11:53:56.069 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetCapabilities

2020-07-04 11:53:56.104 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC time is : 10:53:58

2020-07-04 11:53:56.105 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC date is : 2020-7-4

2020-07-04 11:53:56.107 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Openhabs UTC dateTime is:2020-07-04T09:53:56.106Z

2020-07-04 11:53:56.149 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - deviceXAddr:/onvif/device_service

2020-07-04 11:53:56.150 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - eventsXAddr:/onvif/event_service

2020-07-04 11:53:56.152 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - mediaXAddr:/onvif/media_service

2020-07-04 11:53:56.153 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - ptzXAddr:/onvif/ptz_service

2020-07-04 11:53:56.155 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetProfiles

2020-07-04 11:54:00.043 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - The alarm stream was not running for camera 192.168.178.XX re-starting it now

2020-07-04 11:54:24.082 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - There are 13 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.

2020-07-04 11:54:24.084 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect[0]

2020-07-04 11:54:24.086 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=AudioDetect[0]

2020-07-04 11:54:24.088 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule

2020-07-04 11:54:24.090 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect[0]

2020-07-04 11:54:24.092 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule

2020-07-04 11:54:24.094 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/configManager.cgi?action=getConfig&name=AudioDetect[0]

2020-07-04 11:54:24.096 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/snapshot.cgi?channel=1

2020-07-04 11:54:24.098 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is 0 for URL:/cgi-bin/snapshot.cgi?channel=1

2020-07-04 11:54:24.102 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/eventManager.cgi?action=attach&codes=[All]

2020-07-04 11:54:24.103 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is 1 for URL:/cgi-bin/eventManager.cgi?action=attach&codes=[All]

2020-07-04 11:54:24.113 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is 1 for URL:/cgi-bin/snapshot.cgi?channel=1

2020-07-04 11:54:24.120 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/snapshot.cgi?channel=1

2020-07-04 11:54:24.122 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/cgi-bin/snapshot.cgi?channel=1

2020-07-04 11:54:45.966 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg

2020-07-04 11:54:49.836 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:49.837 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:50.470 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:50.471 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:50.974 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:50.975 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:51.670 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:51.671 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:52.158 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:52.159 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:52.647 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:52.648 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:53.765 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:53.766 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:53.913 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:53.914 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:54.081 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:54.082 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:54.316 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:54.317 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:54.419 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:54.421 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:54.594 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:54.595 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:54.700 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:54.701 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:55.435 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:55.436 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:55.608 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:55.609 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:55.782 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:55.783 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:56.770 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:56.772 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:56.792 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:56.793 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:56.795 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:56.797 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:57.321 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:57.322 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:57.343 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:57.344 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:57.387 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:57.388 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:57.416 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:57.417 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:58.237 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:58.238 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:58.416 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:58.417 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:58.555 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:58.556 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:58.776 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:58.777 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:58.870 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:58.871 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.027 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.028 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.185 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.186 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.348 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.349 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.498 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.499 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.644 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.645 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:54:59.854 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:54:59.855 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-04 11:55:00.881 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-04 11:55:00.882 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

Hi @matt1,
Thanks for the great work with this binding. I just bought a HIKVISION ptz camera (DS-2DE4425IW-DE) and immediately tried this binding. My config as follows:

Things file:


Thing ipcamera:HIKVISION:001
[
   IPADDRESS="192.168.2.60", 
    PASSWORD="<mypassword>",
    USERNAME="admin",
    ONVIF_PORT=80,
    POLL_CAMERA_MS=2000,
    SERVER_PORT=54322,
    FFMPEG_OUTPUT="/tmpfs",
    FFMPEG_INPUT="rtsp://192.168.2.60:554/Streaming/channels/101"
]

Items file:

Image Snapshot "Hikvision Snapshot" { channel="ipcamera:HIKVISION:001:image" }
Switch Hikvision_UpdateImage "Hikvision image update" { channel="ipcamera:HIKVISION:001:updateImageNow"}
Number Hikvision_preset "Hikvision Preset" { channel="ipcamera:HIKVISION:001:gotoPreset" }
Dimmer Hikvision_Pan "Hikvision Pan" { channel="ipcamera:HIKVISION:001:pan" }
Dimmer Hikvision_Tilt "Hikvision Pan" { channel="ipcamera:HIKVISION:001:tilt" }
Dimmer Hikvision_Zoom "Hikvision Zoom" { channel="ipcamera:HIKVISION:001:zoom" }
Switch Hikvision_StartStream "  start HLS stream" { channel="ipcamera:HIKVISION:001:startStream"}
String Hikvision_HLSUrl "HLS URL" { channel="ipcamera:HIKVISION:001:hlsUrl"}
String Hikvision_ImageUrl "Image URL" { channel="ipcamera:HIKVISION:001:imageUrl"}

Sitemap file:

sitemap ipcamera label="IP Camera"	{
   Frame label="IP Camera" {
    	Default item=Hikvision_UpdateImage
        Default item=Snapshot
        Default item=Hikvision_Pan
        Default item=Hikvision_Tilt
        Default item=Hikvision_Zoom
        Default item=Hikvision_preset
       Text label="HLS Video Stream" icon="camera"{Video url="http://192.168.2.20:54322/ipcamera.m3u8" encoding="hls"}
       Text label="HLS Webview Stream" icon="camera"{Webview url="http://192.168.2.20:54322/ipcamera.m3u8" height=15}
    }
}

Now there are many things that work, for example:

  • Movement of PTZ works throught the dimmer items
  • I receive the image snapshots in paper ui and sitemaps
  • If I copy/paste the image URL http://192.168.2.20:54322/ipcamera.jpg in my browser, it returns the image
  • Streaming the rtsp video stream (directly from the camera) through VLC works perfect

But, following does not work:

Looking at the logging at TRACE level, I see following errors:

2020-07-04 11:15:55.018 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2020-07-04 11:15:55.144 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 840
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.2.60</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>ac:cb:51:4b:27:57</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-04T18:15:54+08:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2DE4425IW-DE20200309AAWRE21285870W</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2DE4425IW-DE20200309AAWRE21285870W,2020-07-04T18:15:54+08:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
:
2020-07-04 11:15:56.588 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.2.60/ISAPI/Streaming/channels/101/picture
2020-07-04 11:15:56.606 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.2.60/ISAPI/Streaming/channels/101/picture
2020-07-04 11:15:56.613 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:<!DOCTYPE html>
<html><head><title>Document Error: Unauthorized</title></head>
<body><h2>Access Error: 401 -- Unauthorized</h2>
<p>Authentication Error</p>
</body>
</html>

This error logging is repeated over and over again every second

Following additional info on my configuration:

  • ONVIF and CGI is enabled in the Hikvision configuration with username and admin matching the credentials in the things file
  • Date/time has been set aligned with the openhab server
  • Enable illegal login has been unticked
  • FFmpeg has been installed on my RPI
  • Tmpfs mounted through etc/fstab (although the directory is empty, is this normal??)

Questions:

  • Credentials seems to be ok as I can PTZ the camera and receive the picture. Yet I still receive the aunauthorized errors in the loggings. What is happening here?
  • Any idea why the video stream is not working? Probably related to the unauthorized errors?

Thx

Care to give a more helpful description? do older versions work and it is just the latest? do you mean only ptz is not working… what exactly?!?

The camera needs to be less than 5 seconds of the time that Openhab reports and yours is over an hour, this will cause some cameras to refuse to work as it is a security feature of ONVIF. Check your time zone settings are correct.

It may be that your browser does not support HLS video streams without having something else installed. Try the Habpanel widgets found in the widget gallery… Also when you ask for the stream, you should see it get mentioned in the logs that the binding recieved the request and then ffmpeg should fire up and produce log output, does that occur?
I recommend mjpeg especially if you are going to use PTZ to move the camera in realtime, HLS is behind realtime due to how it works.

That is normal as your camera uses DIGEST and that is how it works, its normal and can be ignored. If you set the camera to use the less secure BASIC method it wont give the errors.

The PTZ is not working. But i tried it also with older versions.

I dont know why the camera is not moving. Maybe you can see something in my logs i send above.

New build 2020-07-05 has these changes:

  • Bug fixes for cameras that create snapshots and mjpeg streams from RTSP feeds with ffmpeg
  • Changes to Onvif which may help cameras that wont connect if they break the HTTP convention and are case sensitive to headers. @SaschaQ88 @MrTBone this may be worth you trying this build.