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]

Hi @Matt, I have a feature request: I have a Hikvision ANPR Camera DS-2CD7A26G0/P-IZHSWG which provides number plate information in the data stream. Below is a verbatim output bar the change of licensePlace number and UUID. It would be good to have an event alert and the licencePlate available. I am aware there may be small set of users for this and so had hoped to be able to make a community contribution, but many attempts to get a working eclipse setup have failed one way or another. I wrote my first program in 1971 – I am going to put my failure down to advancing years



Be very grateful if you are able to fit it in to your busy workload. Cheers.


<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.1.139</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>10:12:fb:ef:36:40</macAddress>
<channelID>1</channelID>
<dateTime>2023-07-24T08:39:29+00:00</dateTime>
<activePostCount>1</activePostCount>
<eventType>ANPR</eventType>
<eventState>active</eventState>
<eventDescription>ANPR</eventDescription>
<channelName></channelName>
<ANPR>
<country>GreatBritain</country>
<licensePlate>AB12CDE</licensePlate>
<line>1</line>
<direction>forward</direction>
<confidenceLevel>98</confidenceLevel>
<plateType>unknown</plateType>
<plateColor>other</plateColor>
<licenseBright>120</licenseBright>
<plateCharBelieve>100,100,100,100,100,100,100</plateCharBelieve>
<speedLimit>0</speedLimit>
<vehicleType>vehicle</vehicleType>
<detectType>0</detectType>
<dwIllegalTime>0</dwIllegalTime>
<vehicleInfo>
<index>2</index>
<vehicleType>3</vehicleType>
<colorDepth>0</colorDepth>
<color>unknown</color>
<speed>0</speed>
<length>0</length>
<vehicleLogoRecog>0</vehicleLogoRecog>
<vehileSubLogoRecog>0</vehileSubLogoRecog>
<vehileModel>0</vehileModel>
</vehicleInfo>
<pictureInfoList>
<pictureInfo>
<fileName>licensePlatePicture.jpg</fileName>
<type>licensePlatePicture</type>
<dataType>0</dataType>
<absTime>20230724083929297</absTime>
</pictureInfo>
<pictureInfo>
<fileName>detectionPicture.jpg</fileName>
<type>detectionPicture</type>
<dataType>0</dataType>
<absTime>20230724083929297</absTime>
<plateRect>
<X>502</X>
<Y>341</Y>
<width>26</width>
<height>120</height>
</plateRect>
</pictureInfo>
</pictureInfoList>
<originalLicensePlate>AB12CDE</originalLicensePlate>
</ANPR>
<UUID>1234c000-ed0b-11b5-1234-1234fbef1234</UUID>
<picNum>2</picNum>
<deviceId>Camera 01</deviceId>
<monitoringSiteID></monitoringSiteID>
</EventNotificationAlert>

Guys, just quick question, is there support for Foscam & Two Way Audio? I believe this type of camera, doesnt use RTSP backchannel for two way audio, but i think its somekind of CGI ?

OH: 4.4.3
ipcamera binding:

openhab> bundle:list | grep Camera
238 │ Active  │  80 │ 4.0.0.202308131102     │ openHAB Add-ons :: Bundles :: IpCamera Binding
265 │ Waiting │  80 │ 4.0.3                  │ openHAB Add-ons :: Bundles :: IpCamera Binding

Rocky Linux 8.8

Been trying this binding (I guess it’s beta since I downloaded the jar file into addons) with partial success. I can get snapshots from a couple older grandstream cameras, a couple Amcrest cameras and one Reolink Trackmix POE. But so far getting the stream setup in an oh-video-card has not worked at all. Got the things added, linking items for image url and mjpeg url but only the image works so far.

I always get:

No compatible source was found for this media.

ffmpeg is installed and working if that’s a possible issue.

[root@hostname addons]# ffmpeg -version
ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 8 (GCC)

Any suggestions on where to look for a config issue or missing library/utility?

It’s not beta it’s been stable for a while

Yes open the stream in VLC and look into codec for audio to get an ideea of what you need to configure in the IP camera binding. Always use VLC to get an ideea if stream is correct.