IpCamera: New IP Camera Binding

Thanks. Hopefully it will be merged in next milestone :smiley:

As far I can see it was not merged into 4.0.0.M2. Just upgarded and ffmpeg stream still is not closing.

Hi Skinah,
is there any way to fix it manually for the time being? With 6 cameras only one works ;-(

I believe the above post answers my question. Does the OH4M2 have the fix for only one camera streaming? (I’m guessing not). Does the IP camera PR that wasn’t merged fix the issue or is there something else needed?

There is no fix yet so it is waiting for someone to volunteer to look into a solutuon.

@zacofunny
There may be a way to get it going if you can not compile changes. There was a PR made just before M1 was released but there will be builds on the jfrog server for snapshots built just before that PR was merged. Navigate the jfrog server to find the jar and use it to test if it was the cause. If it was the cause you will then have a working system and helped to fault find.

I am flat out busy for the next month so can not look at this until some time after I slow down. Also a similar thing has happened to another binding I rely on (espmilighthub) that also needs fixing as of M2 which I believe you also use.

1 Like

Fair enough. I would like to help but not sure which repository to even post/issue or look. As a git hub issue been filed somewhere?
I did see this post from @TeeVee with a partial log today.

Registering servlet failed:ServletModel{id=ServletModel-41,name=‘org.openhab.binding.ipcamera.internal.servlet.CameraServlet’,alias=‘/ipcamera/CAM03’,urlPatterns=[/ipcamera/CAM03/*],servlet=org.openhab.binding.ipcamera.internal.servlet.CameraServlet@1e1097dc,contexts=[{HS,OCM-33,default,/}]} can’t be registered. ServletContextModel{id=ServletContextModel-2,contextPath=‘/’} already contains servlet named*

Based on some rigorous checking introduced over that past year with ZWave and the “already contains Servlet named” from the log my educated guess it that some sort of name check has been introduced by @J-N-K and that after the first camera, each subsequent camera is trying to use the same name (and it is rejected). Not sure if the solution is to change the validation to add an unique parameter for each camera or to change the IP camera binding to change how additional cameras are named.

1 Like

I think this PR could serve as an example on what to try?

My java skills (using the term loosely) are limited to copy something similar and then google to try to understand what is going on. Using your hint, a possible solution might be something like this in the IPcameraServlet class;

     public void startListening() {
        try {
            Hashtable<Object, Object> initParameters = new Hashtable<>();
            initParameters.put("servlet-name","/ipcamera/" + handler.getThing().getUID().getId());
            httpService.registerServlet("/ipcamera/" + handler.getThing().getUID().getId(), this, initParameters,
                    httpService.createDefaultHttpContext());
  1. I would like to test, but have not worked with the addons repository before and it is straining my PC with the mvn clean install command. Also hit an error with the Astro binding (that I hadn’t touched) that aborted the whole process. Do you know the command to just recompile the ipcamera jar? EDIT: have asked separately in new posting for guidance.
  2. Also apologies to @J-N-K (re:validation speculation above)
1 Like

So I tested the above code today and it works on my system. Do you want me to do a PR (I assume you will be a reviewer)? Or do you want to test on your system first? Or do you want to add a commit to your Reolink PR? (I have no issues with that as it is basically a copy of the neeo PR)

If it is a few lines edited it should get merged within days, so please create your own one. Just make sure it is signed off correctly to make it quicker and provide a link to the other PR saying it is the same proven fix.

@apella12 thanks for looking, testing, posting back and hopefully also a PR always great to have more people helping out.

1 Like

Just tested latest Build #3429 and all of my 4 cameras show up again, no more servlet issue.
Thanx a lot for fast patch!

1 Like

Hello togther,

i have a wansview cam. Everything working but not PTZ. Via Android and an ONVIF App everything works fine.

TRACE Say:

2023-04-26 21:12:01.662 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:RelativeMoveRight
2023-04-26 21:12:01.754 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns2="http://www.onvif.org/ver10/pacs" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/accesscontrol/wsdl" xmlns:ns3="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:vifsvr="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:vifsvr10="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:vifsvr2="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:vifsvr3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:vifsvr4="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:vifsvr5="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:vifsvr6="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:vifsvr7="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:vifsvr8="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:vifsvr9="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics"><SOAP-ENV:Header><wsse:Security SOAP-ENV:mustUnderstand="true"><wsse:UsernameToken><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">W/UjXXzdRDvSMifn342SvHSPCI=</wsse:Password><wsse:Nonce>MTcxOTIyMTasdwr36sdg4E2OQ==</wsse:Nonce><wsu:Created>2023-04-26T19:12:01.665Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><tptz:RelativeMoveResponse></tptz:RelativeMoveResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

But nothing happens. No moving nor presets.

OH 3.4.3 is in use.

Thanks.

Try selecting continuous move in the things setup. It is a check box from. Memory. Not many cameras support all the onvif methods.

If you find it works in other software then it would be helpful to see Wireshark captures of both to see what is happening but I suspect it is the first reason.

Thanks for reply. I tested your mention, but that doesn’t work. I installed other apps with onvif support. Only openhab doesn’t work. One app has an option for digital PTZ. If i activated this, PTZ isn’t working then.
So is this kind of option implemented into the binding also?
I know about wireshark, but i’m not familiar with it.

FYI The fix you’re after just got merged here.
[ipcamera] Fix orphan ffmpeg process after stopping stream URL by tb4jc · Pull Request #14909 · openhab/openhab-addons (github.com)

2 Likes

Tested it on M3 and it works fine. Thank you for that.

FYI The fix you’re after just got merged here.
[ipcamera] Fix orphan ffmpeg process after stopping stream URL by tb4jc · Pull Request #14909 · openhab/openhab-addons (github.com)
[/quote]