IpCamera: New IP Camera Binding

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.

Hi ,

i am running my oh3 in docker . Now I have the problem that the urls (imageUrl,mjpegUrl,…)
Have the local ip of the docker container and not the public one of the host .
Can be this changed ?

Try settings then network settings

Hi all,

I am relatively new to the IP cam binding but have a rather large OH3 install on the latest snapshot.
I wanted to install the current YI 1080p cams which all have been flashed with yi-hack for support of RTSP and ONVIF. I just wanted to show a simple snapshot or better video on the habpanel dasboard like everyone else I guess.

I will provide seperate serverports for each cam but what wonders me is that the cams IP is indicated above as my openhab server IP and then port 80? I dont really get how its working, although I have had a look at the doc for the ip cam binding.

Also the snapshot which is working in a browser, does not get displayed, even when I just pick URL item with this url: http://192.168.100.75:8080/?page=snapshot

Do I need specific adjustments to get the picture properly displayed?
Thanks for ideas, I am little bit stuck

Yeah my NVR doesn’t do mjpeg. It only does h264 or h265. I guess Dahua removed that option on their newer NVRs.
I don’t mind higher CPU usage (right now my server isn’t breaking a sweat doing this) so I prefer having high quality/high FPS stream on all the time.

Speaking of Habpanel though. I am using the image widget for displaying the mjpegs (like I did before in OH2 with ffserver) and I am noticing that while using the binding some streams will just disappear after a few minutes (I get a blank background) or the whole habpanel will crash. Not sure if this is related to the binding or OH3. Just asking if you’ve noticed this before.

EDIT: Hmmm this is fun. This has somehow managed to crash my NVR. No RTSP streams were working and I couldn’t login into the web admin without rebooting the NVR.

EDIT2: I switched to the “generic RTSP” thing instead of using the Dahua specific thing and this seems to help in the stability of the NVR. It’s now running fine and the streams seem to be stable. However… habpanel is still crashing on two different android tablets every few hours. And it’s definitely connected to the mjpeg streams generated by this binding.

Fantastic! Thanks for the info. I installed the fixed version dated 2020-11-15 but initially I couldn’t get the rule that contained the call to getActions to work. Every time that line of code was executed I’d see this error in the log:

Rule 'Create front door camera GIF when front door motion detected': Instance is not a IpCamera class.

I searched the forum and found a few threads with similar issues (for other bindings) that suggested that the rule file containing the affected rule needed to be changed/touched to force it to be reloaded. That didn’t work for me but a restart of the openhab service resolved it.

How long should it take to generate a 6 second GIF on a Raspberry PI 4 with 4GB of RAM running OH 3.0.0? On mine it takes 30-60 seconds, but on my Windows box running 2.5M10 it takes about 10 seconds. I’m new to openHABian, but 60 seconds seems way too long to generate a 6 second GIF. Has anyone else noticed this? I can post the logs, but before I go there I want to make sure this isn’t normal behavior.

Marty

The camera list at the beginning ist old. Please add working cameras!

Hi,
I have an issue with Foscam FI9926P and PTZ functionalities.
I use OpenHab 3.0.0 with a docker image.
I try to configure it manually with the user interface and with the following config files, but without any success to PTZ:

ipcamera.things
Thing ipcamera:foscam:cam “Foscam Camera” @ “Living Room” [ipAddress=“192.168.0.28”, serverPort=38000, port=88, onvifPort=888, username="…", password="…"]

and

ipcamera.items
Group Camera
Group Foscam “IP Camera (Living Room)” (LivingRoom) [“Camera”]
Switch Foscam_LED_Auto “Auto LED” (Camera,Foscam) [“Switch”] { channel=“ipcamera:foscam:cam:autoLED” }
Switch Foscam_LED_Enable “LED” (Camera,Foscam) [“Switch”] { channel=“ipcamera:foscam:cam:enableLED” }
Dimmer Foscam_Pan “Pan” (Camera,Foscam) [“Control”] { channel=“ipcamera:foscam:cam:pan” }
Dimmer Foscam_Tilt “Tilt” (Camera,Foscam) [“Control”] { channel=“ipcamera:foscam:cam:tilt” }
Dimmer Foscam_Zoom “Zoom” (Camera,Foscam) [“Control”] { channel=“ipcamera:foscam:cam:zoom” }

The AutoLED and LED are functionnal, but the PTZ items are not. I tried everything without any success.
PTZ functionnalities are ok using the ONVIF device Manager (and using the same username and password).

Some help will be appreciated.