IpCamera: New IP Camera Binding

YOU MESSED UP ALL MY OH INSTALLATION - that was my first impression as I did something wrong I thought…after smooth running of OH in order to get camera working I followed matt’s recommendations, deleted ipcamera binding through paperui, tried to install jar files matt sent by placing them in addons folder - not successful:

bundle:install -s /usr/share/openhab2/addons/netty-buffer-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-codec-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-codec-http-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-common-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-handler-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-resolver-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/netty-transport-4.1.42.Final.jar
bundle:install -s /usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.9-SNAPSHOT.jar

Then deleted cache and temp folder and got OH down - number of errors, after an hour of troubleshooting got OH back again.

In case you get the same issues here is proper way of deleting cache and temp files:

STOP OH service:

systemctl stop openhab2.service

then and only then - after you get cursor back!!! delete cache and temp files:

openhab-cli clean-cache

and finally restart your OH service by:

systemctl restart openhab2.service

once restarted reboot machine!

I almost got hardattack, so much configuration and effort put and I did not have any backup!

BACKUP YOUR MACHINE’s MicroSD BEFORE YOU DO ANYTHING!!!

Once done, I have installed IPCAMERA binding again.
then ran terminal and tried to install the latest *.jar file you have sent me and guess what?

Error executing command: Error installing bundles:
Unable to install bundle /usr/share/openhab2/addons/org.openhab.binding. ipcamera-2.5.9-SNAPSHOT.jar: org.osgi.framework.BundleException: Error reading b undle content.

so I stick with what I have, went and tried to create camera again:

GUESS WHAT:

OFFLINE, wenta and checked RTSP string in VLC:

WORKING

ADDED RTSP string as a input in additional settings:

ONLINE!

checking HTTP: http://192.168.1.100:8086/ipcamera.mjpeg:

NOT WORKING (((

WHAT AM I DOING WRONG???

Dont know what you´re doing wrong. But…
The procedure for deleting cache and tmp should be known to everyone, who ever delete cache and tmp). If not, that the first mistake.

Second.
When you delete cache and tmp, its well know openhab will restart first time with a hell of alot of issues. You need to let it start, and then restart again. (sometimes even three restarts is needed. I dont understand why though, and noone seems to have a good answer).

Again - This should be well known information for people who delete cache and tmp.

DO NOT clear cache and tmp, unless you´re prepared for this. In case of doubts, search this forum, there are quite a few threads with the informations.

Back to your issue…
I´m abit unsure if you managed to install the binding or not?

I have uninstalled binding using Paper UI, then tried to install files sent by matt1 using openhab-cli console - not successfull

then went back to Paper UI and installed latest available package from there.
Added ONVIF IP Camera - Success - it is online. But when tried to play http link through VLC - nothing, on the OH page - nothing!
I went back to OH and played rtsp link through terminal directly:

ffplay -i rtsp://login:pass@192.168.1.13:554/onvif1

but for some reason IPCAM binding does not want to direct rtsp stream to http??? That is for this particular camera, other - old camera works. So question is why rtsp-s different? Where to see logs why, what is the reason this rtsp does not work?

To see any info back from ffmpeg you need to turn on at least debug logs. Funnily how to do this is in the bindings documentation under the heading “How to get help” at the very top.

ok thanks, will check debug log.

for those, who is also struggles, debug log is enabled through openhab console (openhab-cli console passwd - habopen) by the following command:

log:set TRACE org.openhab.binding.ipcamera

I got almost the same with 6 of my cameras:

2020-10-27 21:40:54.623 [DEBUG] [era.internal.handler.IpCameraHandler] - Binding has no snapshot url. Will use your CPU and FFmpeg to create snapshots from the cameras RTSP.
2020-10-27 21:40:54.643 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -threads 1 -skip_frame nokey -hide_banner -loglevel warning -i rtsp://login:pass@192.168.1.13:554/onvif1 -an -vsync vfr -update 1 http://127.0.0.1:8086/snapshot.jpg
2020-10-27 21:40:55.623 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-10-27 21:40:55.729 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x6f22b0] Nonmatching transport in server reply
2020-10-27 21:40:55.736 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - rtsp://login:pass@192.168.1.13:554/onvif1: Invalid data found when processing input

…blablabla…

2020-10-27 21:42:46.088 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg
2020-10-27 21:42:46.102 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -hide_banner -loglevel warning -i rtsp://login:pass@192.168.1.13:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg
2020-10-27 21:42:46.646 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x17c4260] Nonmatching transport in server reply
2020-10-27 21:42:46.647 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - rtsp://login:pass@192.168.1.13:554/onvif1: Invalid data found when processing input

I NEED THOSE CAMERAS TO WORK!

UPDATE:

I finally found what is an issue with these cameras they does not support TCP but UDP Cameras!!!

when I enter the command in terminal: ffplay -rtsp_transport TCP [address]
it gives error, but if tcp changed to udp - WORKS!

SO HOW TO MAKE BINDING TO PLAY UDP INSTEAD OF TCP STREAM???

Matt, sorry for bothering you again, but what needs to be changed to force binding to stream udp rtsp strings?
Please help!

hi guys!just found this binding and looks very interesting.I must try it.My old Mjpeg outdoor camera is at its last days so i must find another new one so i can view it in my habpanel.I now stream mjpeg in a frame widget in habpanel.So…can anyone recommend me a not so expensive outdoor camera that is fully working with this binding?I dont care about high resolution,PTZ,motion detection alarms etc…I just want to view my camera at a habpanel widget.
thnx

Try entering RTSP in the URL in all caps that will probably do the trick. If you see green or missing parts of the video you know it is dropped packets from using udp. Worth checking if the camera has the option in its control panel to change to tcp.

@Constantinos_Contis
The cheapest is probably a esp32 camera for $6-8 but you have no night vision, resolution is low and you won’t be able to cast a video stream. Work fine in habpanel.

Amcrest in the USA are cheap and are well worth the extra $. See the first post of this long thread for more info on what is different between the different level of cameras.

thnx for ur answer.Where i live i dont have access to any of the “API working cameras” noted at the first post.I can only get one of these dahua :

https://www.imoulife.com/product/specs/NewBullet
https://www.dahuasecurity.com/ceen/products/All-Products/Network-Cameras/Consumer-Series/3-MP/IPC-HFW1320S-W
https://www.imoulife.com/product/specs/BulletLite4MP
https://www.imoulife.com/product/specs/BulletLite

do u think any of these cameras can do the job?
thnk you very much mate!

I would not be surprised if the Imou are made by Dahua, they advertise they have a CGI as well which it may be worth looking into. Best to ask on a forum that is dedicated to cameras.

No it did not:

2020-10-28 17:41:36.297 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -hide_banner -loglevel warning -i RTSP://login:pass@192.168.1.13:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg
2020-10-28 17:41:36.518 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - RTSP://login:pass@192.168.1.13:554/onvif1: Protocol not found
2020-10-28 17:41:36.519 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Did you mean file:RTSP://login:pass@192.168.1.13:554/onvif1?

it did not even change tcp to udp in the ffmpeg request - “2020-10-28 17:41:36.297 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -hide_banner -loglevel warning -i RTSP://login:pass@192.168.1.13:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg

I may not understand fully, but when you specify “-rtsp_transport tcp” in the ffmpeg command, you probably prevent UDP operation. My ffmpeg command has “-rtsp_transport udp” for my Hikvision cams and works OK, but then again I have direct access to hand-craft it. There is a linux utility called “netsed” that modifies unencrypted rtsp url just before it leaves the computer on its way to the camera, as I understand it. Although I don’t see examples changing the “tcp” to “udp”, such might be possible. If so, you could then leave out the -rtsp_transport specifier, since I understand ffmpeg is very, very observant to adapt to source characteristics.

EDIT: I’ll admit I see no clear path of success with this info, so I’ll delete this post if it’s in the way.

I looked and the latest code stopped that work around from working, older builds it would have worked, you can try them here but there will be differences:

There currently is no way and it will mean any fix will go into the V3 binding.

OK, thanks Matt, will try older builds, could you advice which version will work?

Placing unzipped jar files in the addons folder is sufficient? binding will be installed automatically or anything else needs to be done?
Tried all of them and latest one dated 21-Sep is the same as the new one - uses tcp, others say:

2020-10-29 12:44:34.887 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg

2020-10-29 12:44:34.890 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:/usr/bin/ffmpeg -hide_banner -loglevel warning -i RTSP://user:pass@192.168.1.13:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg

2020-10-29 12:44:35.110 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - RTSP://user:pass@192.168.1.13:554/onvif1: Protocol not found

2020-10-29 12:44:35.111 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Did you mean file:RTSP://user:pass@192.168.1.13:554/onvif1?

but neither VLC can play [http://IP:port/ipcamera.mjpeg] stream nor shown in the webpage (( So I would say binding does not change to UDP and still using TCP…

When is the V3 binding coming out?

It is already out and built into V3, however a fix for what your wanting to do is not done as your the first to raise this as an issue so it was unknown till now.

if the version 2020-09-20 has a config called ffmpegInputOptions then you can specify that you want to use UDP in there. I do not know when that config was added, and it is possible I added that config after I killed the other (RTSP) work around. Its also possible that FFmpeg does not like the uppercase RTSP. If that is the case then your out of luck until you move to V3 which I could have a build done pretty quick for you to try. You could always manually type in the command that the log is giving you and modify it to see what FFmpeg will accept.

In a future V3 binding I would propose that you will see the TCP option in the ffmpegInputOptions so you can delete it and add whatever you want.

Hi,

how the Things status is set? I upgrade to OH 2.5.10 with buildin ipcamera binding and have some problem with the binding. Previously I used OH 2.5.4 with ipcamera binding 2.5.4.202004080644.

ipcamera:generic:KUCHNIA (Type=Thing, Status=ONLINE, Label=KUCHNIA, Bridge=null)
ipcamera:hikvision:DRZWI (Type=Thing, Status=INITIALIZING, Label=DRZWI, Bridge=null)

Camera KUCHNIA is Yi Home 1080 with yi-hack-MStar onboard. And becase it is inside home I use sonoff to turn on/off the power from this camera. And now (during the day) it’s is off, but the things stays ONLINE.

Camera DRZWI is hikvision outside the house, and it’s powered on all the time. The thing is in state INITIALIZING. I’m unable to update image via items/channel due to Thing status:

CamDrzwiImage (Type=ImageItem, State=raw type (image/jpeg): 337010 bytes, Label=Picture, Category=null)
CamDrzwiUpdateImage (Type=SwitchItem, State=OFF, Label=Get new picture, Category=null)

CamDrzwiUpdateImage -> ipcamera:hikvision:DRZWI:pollImage
CamDrzwiImage -> ipcamera:hikvision:DRZWI:image

but following items in sitemap are working well:

        Text label="Cameras Mjpeg Stream" icon="camera"{Video url="http://192.168.199.251:50022/ipcamera.mjpeg" encoding="mjpeg"}
        Text label="Snapshot 1FPS Stream" icon="camera"{Video url="http://192.168.199.251:50022/snapshots.mjpeg" encoding="mjpeg"}
        Text label="autofps Stream" icon="camera"{Video url="http://192.168.199.251:50022/autofps.mjpeg" encoding="mjpeg"}
        Text label="HLS Video Stream" icon="camera"{Video url="http://192.168.199.251:50022/ipcamera.m3u8" encoding="hls"}
        Text label="HLS Webview Stream" icon="camera"{Webview url="http://192.168.199.251:50022/ipcamera.m3u8" height=15}
        Text label="Image using jpg method" icon="camera"{Image url="http://192.168.199.251:50022/ipcamera.jpg" refresh=1000}
        Text label="Animated GIF" icon="camera"{Webview url="http://192.168.199.251:50022/ipcamera.gif" height=9}

I have two others hikvision cameras and they are working ok.

In logs I see:

2020-10-29 12:11:15.023 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.199.232:8000
2020-10-29 12:11:15.023 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-10-29 12:11:15.024 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.199.232:80/ISAPI/Streaming/channels/101/picture
2020-10-29 12:11:15.026 [DEBUG] [g.ipcamera.internal.onvif.OnvifCodec] - Exception on ONVIF connection: Connection reset by peer
2020-10-29 12:11:15.028 [TRACE] [g.ipcamera.internal.HikvisionHandler] - 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>

2020-10-29 12:11:15.028 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<!DOCTYPE html>
<html><head><title>Document Error: Unauthorized</title></head>
<body><h2>Access Error: 401 -- Unauthorized</h2>
<p>Authentication Error</p>
</body>
</html>

2020-10-29 12:11:15.029 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.199.232:80/ISAPI/Streaming/channels/101/picture

And I’m sure that ONVIF is running on port tcp/8000, HIKVISION-CGI is ON, authorization is digest/basic.

Thanks again Matt, I’m trying to follow your advice:
Deleted addons jar files, copied files from folder mentioned by you 2020 09 20, created onvif ipcamera thing, in the ffinput entered -rtsp_transport udp. Here is log:

2020-10-29 21:33:38.717 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg

2020-10-29 21:33:38.730 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport udp -rtsp_transport tcp -hide_banner -loglevel warning -i rtsp://192.168.1.6:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg

2020-10-29 21:33:39.088 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0xc40260] Nonmatching transport in server reply

2020-10-29 21:33:39.089 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - rtsp://192.168.1.6:554/onvif1: Invalid data found when processing input

then changed RTSP://…:

2020-10-29 21:39:53.719 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg

2020-10-29 21:39:53.721 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport udp -rtsp_transport tcp -hide_banner -loglevel warning -i RTSP://admin:Samir2012A@192.168.1.6:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg

2020-10-29 21:39:53.940 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - RTSP://@192.168.1.6:554/onvif1: Protocol not found

2020-10-29 21:39:53.941 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Did you mean file:RTSP://192.168.1.6:554/onvif1?

Removed -rtsp_transport udp:

2020-10-29 21:42:32.552 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg

2020-10-29 21:42:32.554 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -hide_banner -loglevel warning -i RTSP://admin:Samir2012A@192.168.1.6:554/onvif1 -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8086/ipcamera.jpg

2020-10-29 21:42:32.773 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - RTSP://@192.168.1.6:554/onvif1: Protocol not found

2020-10-29 21:42:32.775 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Did you mean file:RTSP://192.168.1.6:554/onvif1?

NO SUCCESS

With regards to UDP - the cameras which uses “YooSee” protocol are becoming very popular, those are made quite well and I’m using them more that a year already trouble free. The ones bought with HTTP interface burned (I mean it) after 2-3 month of usage - poor quality ones - reason - not designed to properly dissipate the heat from chip.
Of cause I’m talking about cheap chinese cameras widely available over ebay, amazon and aliexpress.
There for I bought more of “YooSee” cameras, but got into trouble now with integration of those into openhab - all those cameras using rtsp over UDP, not TCP and there is no way of changing to TCP as cameras does not have HTTP and only configurable through android “YooSee” software and there is no such a option, just to switch rtsp on and off, nothing else.

Sorry for long story again.

Hi, just a short follow up, as promised.
Received the Reolink E1 Zoom Yesterday. Onvif Device Manager finds it as an ONVIF compliant camera. PTZ works from there too. It was easily added to my HIKVISION NVR as an ONVIF Camera. The PTZ works from the NVR as well.
I just tried adding it to openhab, both directly from the camera, and via the NVR.
Image and video works as expected.
PTZ does not work as far as I can tell. I will try a bit further, since the PAN functionality is needed for my specific application.
Overall, the camera is excellent considered its cost. Of course it doesn’t come close to my hikvision cameras regarding functions. But the video quality is actually quite good.

Thanks for the information. Please let me know if you get PTZ working with openHAB.
I am still struggling to find an indoor PTZ (zoom not necessary) camera with these features:

  • WIFI, night sight
  • web interface works in Chrome without extra applications or plugins
  • works with openHAB
  • ONVIF compatible including PTZ
  • snapshot URL
  • bonus: motion alarm zones
  • bonus: openHAB can get alarms from the camera
  • bonus: dedicated app

Amcrest would check all boxes, but, as I said, you cannot buy non-EOL models in Germany. I already asked Amcrest US about that.

Do you have an indoor PTZ WIFI Hikvision? I cannot find any that is available in Germany and looks legit.