IpCamera: New IP Camera Binding

I’ve never seen that, have you done a reboot after the install completed? If it happens after a reboot can you list the steps you are taking to create this and I will test.

@matt1 Thank you. Finally I was able to run the camera. My Mistake was, that I forgot to add the Port for ffmpegInput

Hi, this looks very promising. Do you know if I run openhab with docker, will I need to build my own docker file to include ffmpeg? Or do I specify the ffmpeg path on my host system?

Additionally, do I need to create the output path in my docker container and mounted to my host machine? Or do I specify the output path just as my system path?

Sorry, I am not very familiar with docker.

Thank you for your help.

Hello,
one question:
my ESP 32 cam, before upgrade OH3 was woring good.
After update, with same code line in the Sitemap, no resoults:

Text label="Camera" icon="camera" {
			Video url="http://192.168.178.100:54333/ipcamera.mjpeg" encoding="mjpeg"
		}

Can you help me to make it work again ???

There may be a bug with the video element, try using the webview element instead. I don’t think this is a binding issue.

Just a heads up that there are now 2 camera widgets created for the new OH3 main UI. This makes it very easy to get PTZ cameras moving.

I’m struggeling in getting my D-Link DCS-6511 to work with the IP camera binding in OH3.

I used the cameras successfully in OH2 and OH3 sitemaps with Basic UI as follows:

Video url="http://user:pwd@192.168.0.15:80/video2.mjpg" encoding="mjpeg"

Mjpeg streams are natively supprted by this model !

For OH3 Main UI I was recommended to go with the IPCamera binding…

The cams were successfully autodetected by the binding:
Identifier: ipcamera:onvif:192168015

I added:

  • user/pwd
  • server port: -1 (I honestly don’t know how to use this parameter)
    to get the camera to status “online”.

The output of the MJPEG URL item linked to the MJPEG URL channel is “NULL”.

The openhab log shows this:

2020-12-26 14:35:40.002 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2020-12-26 14:35:40.002 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2020-12-26 14:35:40.097 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.15:80/dms?nowprofileid=1
2020-12-26 14:35:40.271 [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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="true">http://192.168.0.15/onvif/device_service?SubscriptionIdx=2</wsa5:To><wsa5:Action SOAP-ENV:mustUnderstand="true">http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2020-12-26T13:35:40Z</tev:CurrentTime><tev:TerminationTime>2020-12-26T13:35:48Z</tev:TerminationTime></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2020-12-26 14:35:40.272 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2020-12-26 14:35:40.272 [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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="true">http://192.168.0.15/onvif/device_service?SubscriptionIdx=5</wsa5:To><wsa5:Action SOAP-ENV:mustUnderstand="true">http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2020-12-26T13:35:39Z</tev:CurrentTime><tev:TerminationTime>2020-12-26T13:35:47Z</tev:TerminationTime></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2020-12-26 14:35:40.273 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2020-12-26 14:35:40.310 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>

As I mentioned, the camera natively supports mjpeg streams - there shouldn’t be any need for ffmpeg.

Still, I don’t know how to make use/configure the server port.
How to set this properly in the carmera and in openhab?

How to get the stream work

It’s working !!

Set server port to 54321 and I’m getting the stream via:
http://192.168.0.13:54321/ipcamera.mjpeg

One observation though:
The livestream only updates every 3 seconds - in the browser, in Basic UI and the webgui of the camera itself…

How to get a smooth stream?

The stream is smooth after restarting the camera and openhab.

Hi. I’m trying to put some Blue Iris mjpeg and image items into Open Hab 3 with the IP Camera binding. On the local network, no username/password is needed for BI. The snapshot and mjpeg URLs I put in those fields work in a browser. I am not using any of ffmpeg functions and don’t have it installed on the pi.

Using the mjpeg or snapshot item channels in a video or image card in the OpenHAB 3 main UI does not work. No image shows, just the little broken image icon.

Then you probably can use those urls without using the binding at all.

Just use this widget which works with the binding or can use any url from any source:

OH3 Widget: Building a camera widget - Add-ons / UIs - openHAB Community

You should open a new thread if your having issues with the video or image cards.

1 Like

Hi Guys,

Sorry for (probably) asking something already asked. I have an door IP camera, Edimax IC-6220dc

I just need some hints correctly setting up the ipcamera things.

The camera has an working mjpg url, which is accessable over LAN with VLC player or browser, camera setting also over RTSP setup.

I first just tried basic video url (http://192.168.88.125/mjpg/video.mjpg) add to sitemap, but it just loads and no image is shown. Same url in VLC or browser opens a video stream.

Do I need the complete setup (binding -> things -> items -> sitemap) or is a possibility of just adding of url to sitemap?

Thanks and sorry if the same question was already asked.

br,
Mario

Does the camera need a user/pass to view the url in a normal web browser? if no, then you can use it without the binding. if yes then you may need the binding. You did not mention what version of OH you use so it is hard to give more help. Camera work a lot better in OH3 using the new UI instead of sitemaps.

I can’t use it without the binding because it will then only function from the local network. That’s why I’m trying to use the binding!

Hi Matt,

The camera uses user/pass to view the mjpg, but if I’m not mistaken it’s also possible to setup anonymous view.

OH Version: 2.5.10 (Build)

Thanks

I just updated the binding on my Debian install to the latest version from the APT repo, 2.5.11, previously I’d been using a snapshot from July this year. I’ve verified that I’ve removed the snapshot binding using the Karaf console and the 2.5.11 version is active:

318 x Active   x  80 x 2.5.11                  x openHAB Add-ons :: Bundles :: IpCamera Binding

I then deleted the thing and recreated it by using the binding to add the camera as a HikVision thing. The camera is a HikVision 2CD2086G2-I, I’ve changed the first substream to be a MJPEG stream and checked that the password for the camera works using VLC in Windows and I’ve also logged in to the camera’s web maintenance page.

I have two rules that use the binding, one that’s triggered when movement is detected:

@rule("Front Door Porch PIR Triggered")
# @when("Item PIRMotionSensor12_MotionAlarm changed from OFF to ON")

@when("Item gFrontDoorIntrusion changed from OFF to ON")

def frontDoorPorchPIRTriggered(event):

    log = logging.getLogger("org.eclipse.smarthome.model.script.security")
    log.info("SECURITY: Front door porch PIR triggered.")
    
    Pushover.sendPushoverMessage(Pushover.pushoverBuilder("SECURITY: Front door porch PIR triggered."))
    events.sendCommand("CameraFrontDoor_CreateAnAnimatedGIF", "ON")

This rule detects motion from a group (the group that is an AND of an item linked to the the MotionDetected channel and an item linked to a ZWave PIR) and then turns the CreateAnAnimatedGIF switch on. This triggers this rule that sends an animated GIF via Pushover:

rule "Send front door camera GIF via Pushover"
when
    Item CameraFrontDoor_CreateAnAnimatedGIF changed from ON to OFF
then
    // sendTelegram("BarkersButlerBot", "Front door camera intrusion detected")
    // sendTelegramPhoto("BarkersButlerBot", "file:///etc/openhab2/html/tmpfs/camerafrontdoor/ipcamera.gif", "Intrusion detected at front door, GIF sent")
    sendPushoverMessage(pushoverBuilder("Sending GIF from front door").withAttachment("/etc/openhab2/html/tmpfs/camerafrontdoor/ipcamera.gif"))
end

The problem I’ve discovered is that the CreateAnAnimatedGIF channel doesn’t seem to exist any longer. Is it supposed to? The three channels I can see in the thing that contain GIF in the name are:

GIF Recording (Seconds)
Gif Filename History
GIF History Length

I’ve checked the README file on github but I can’t find anything about the CreateAnAnimatedGIF channel. It refers to a updateGif channel but I can’t see that in the thing either. What am I doing wrong?

Hi there!
With my recent update to latest version of Ubuntu on my server and update to OH3 my old way of creating mjpeg streams directly through ffmpeg and using ffserver to stream them finally crapped out - ffserver hasn’t been available for a while anymore. So I guess I am back to using this binding.

Still the same issue as always - HLS stream has too much of a latency (around 5-10s) to be usable. But since I am now using ffmpeg 4.2 I am wondering if it’s possible to try LHLS to see if that improves things?

@higgers
Don’t use the GitHub anymore it is outdated. For all merged bindings you will find the docs on the webpage. The way gif recording has changed so now you need to use an action. There is also a bug in the 2.5 merged binding that stop gif from working, search for the download link of a fixed version and use that instead. V3 has the bug fixed.

@roli
The binding can create mjpeg streams for you and that is the way if you want low latency which is usually 1 second behind real-time. Docs cover this.
As for low latency HLS, I tested it a while ago and found a few things.

  1. The browsers will buffer the stream and funnily you still end up with a 5 to 10 second delay. It would need a custom JS player.
  2. Less compatible.

Since I upgrade to an Odroid N2+ I can now create 10fps mjpeg streams in 1080p only using 25% of the cpu and its smooth and reliable. Older slower ARMs could not do that as they could not process fast enough to meet real-time. The stream stops unless you lower things back for their cpu to handle it.

How can I create a 10fps mjpeg stream from the primary stream though? I’ve read the docs and I can’t figure it out. ipcamera.mjpeg doesn’t work for me (it just displays either a blank page or the typical broken image symbol) and snapshots.mjpeg is definitely low res (so it looks like secondary stream) and low fps (about 1fps). And I don’t see anywhere how I can create a mjpeg stream that is faster than 1s. It looks like I am missing something here.

EDIT: Never mind that. I did some snooping around. Changed the mjpeg URL to “ffmpeg” (which made the ipcamera.mjpeg stream work) and after some googling for ffmpeg docs figured out how to increase framerate. Seems to be a lot better now. About 2s delay.

That will be because you have a Dauha camera? from searching your previous posts. The docs state the binding is setup to use the first substream for mjpeg and that you need to setup the camera to be mjpeg format on that stream for that url to work. If you do that your camera will be the source and the CPU load will be zero. Its possible that the res will be lower, but it is simply another choice you can make on what you prefer.
If you override the default to be ffmpeg then the CPU load is high and you have to tweak it which the docs do cover this in a basic form.

Should be whatever you set the onvifMediaProfile to be. Recommend you leave that as 0 the main stream or whatever stream is your highest resolution. Yes it is 1FPS but it is zero cpu. You can also specify your own snapshot URL to use instead of the auto detected one.

Lots of choices and this can be handy when you use the new V3 widgets or HABpanel widgets that only open up to a high CPU load stream when you click on the thumbnail that is a 1fps stream.