IpCamera: New IP Camera Binding

Thanks a lot! I read all the link : GitHub - Skinah/IpCamera: A binding for Openhab 2 that allows you to use IP Cameras without the need to disable authentication. and nothing speak about,

Thanks again!, also when I press the snapshot switch I can see request on Trace log, but the snapshot is not updated, the ffmpeg is working correctly, I place the rstp url of my blue iris server and I can see through port 54200 the mpeg video, can you help me also on this?

Hey folks,

I’m asking for support for XMeye cameras as many cheap but powerful cameras and NVRs are made using this App respectively the sofia protocol.

Protocol descriptions and a communication program in python is located in this repo:

What do you think about this?
May there be tasks I (with limited java skills) can do?

Best,
Sascha

I have a Foscam FI9912P that has an MJPEG stream. Its picture is shown as 4:3, but it’s clearly an 16:9 image. Is it possible to display it as 16:9 in the sitemap?

Not sure if you would want to stretch the picture and distort how people look, ie make them look fat. Or if you wish to CROP and throw away some of the picture. If it is a MJPEG source then it is not too difficult (low CPU) to get ffmpeg to do which ever of the two you are wishing to do. The stretching can be done using a widget and CSS to stretch it when viewed by the browser.

Another solution would be to use ffmpeg to create the MJPEG from the h264 source and this would use high cpu, you enter in ‘ffmpeg’ as the source and this is covered in the bindings docs.

So there would be four ways to achieve what your wanting to do.

Thanks! Went with the ffmpeg approach, resizing the MJPEG stream. CPU usage is about half of what transcoding the rtsp stream takes. The 4:3 image was actually distorted, 16:9 is what it should be.

Hi, i already use my cam and this binding to provide me an email with a recorded gif, when someone rings the bell.

This is working fine.

Now i tried to use mp4 instead of gif. I changed the Action-command. But i only get files with 0 bytes.

Is there something i have to change? Do i have to add someting into the things-file?

First line alone is working, second line gifs me a file with 0 byte.

getActions("ipcamera", "ipcamera:dahua:CamEingang").recordGIF("ipcamera",20)
getActions("ipcamera", "ipcamera:dahua:CamEingang").recordMP4("ipcamera",20)


**and my email-command:**
mailActions.sendMail("xxx@gmail.com", "Openhab IP-Cam Haustür", "Openhab IP-Cam", "file:///tmpfs/camera1/ipcamera.gif" )
mailActions.sendMail("xxx@gmail.com", "Openhab IP-Cam Haustür", "Openhab IP-Cam", "file:///tmpfs/camera1/ipcamera.mp4" )
    

And second question: How can i send me an email with a jpeg picture instead of a gif-file, when someone rings my bell?

I’m trying to get ffmpeg working for a little while now. The latest issue I am running into: ffserver is no longer available except if I install an older version and compile it all myself. Is there any alternative that works on a raspberry pi?

This docker container is very useful: GitHub - eroji/rtsp2mjpg: RTSP to MJPEG stream conversion using FFmpeg and FFserver. It also works on the Pi (use the Dockerfile.armhf)

It is not needed if you follow the documentation on the ipcamera binding. The binding can do it.

Thanks for your response. It turned out to be the Thing that was faulty. Various things: /etc/openhab2 still in the configuration which I couldn’t modify through the UI. URLs like the MJPEG-URL were not discovered either. Deleting and then rediscovering made it work.
So if your cam doesn’t work under openhab 3, don’t hesitate to delete the thing and start again. Saves you time.
I’ve got a Dahua DH-SD59225U-HNI which now works well including motion detection alarm and cross line detection. So that model can probably be added to the list of supported devices.

2 Likes

Hi ulij, happy to see your camera works as expected. I’m not so lucky, as I can’t get my Imou IPC-A22EP (a Dahua’s consumer brand, as I know) to work in openHAB 3
I always get log “The alarm stream was not running for camera 192.168.0.214, re-starting it now”.
Can you please share your settings of camera in .things and .items file?
If I only want to get the camera’s alarm (face detected, motion detected…) then do I need to install FFmpeg, FFserver of something?
Thank you in advance!

Hello

I created the Thing and the items entirely through the openhab ui, so there are no thing or item files I could share.
However, the json code of the thing looks as below.
I did see the same error message and it disappeared once I got the serverPort right. It is important that it is not blocked by any firewall.
It’s also a good idea to increase the log level of the ipcamera binding to trace because then you see the results of the onvif discovery.
Also, the ffmpegOutput must be a directory where openhab has full access. And yes, I think you do need to install ffmpeg for streaming.

UID: ipcamera:dahua:1921681153
label: PTZ North
thingTypeUID: ipcamera:dahua
configuration:
mjpegOptions: -q:v 5 -r 2 -vf scale=1920:1080 -update 1
ipAddress: 192.168.1.153
updateImageWhen: “0”
mjpegUrl: ffmpeg
onvifPort: 80
gifPreroll: 0
ffmpegLocation: /usr/bin/ffmpeg
serverPort: 8081
ffmpegOutput: /etc/openhab/html/camera1/
ipWhitelist: DISABLE
mp4OutOptions: -c:v copy -c:a copy
pollTime: 1000
password:
port: 80
nvrChannel: 1
snapshotOptions: -an -vsync vfr -q:v 2 -update 1
ptzContinuous: false
onvifMediaProfile: 0
hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
-hls_flags delete_segments -hls_time 2 -hls_list_size 4
gifOutOptions: -r 2 -filter_complex
scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse
username: admin
location: Outdoors

I will try to re-config the binding based on your configuration and report later. Thanks for your supports!

Hi Uli. Thank you!
After hours of struggling with the camera binding, finally I get it to work! Now I can see HLS streams of the camera in Sitemap. The point is, the password is the Secret Code that printed behind of camera, not the password that I’ve set in the Imou software. I don’t know why maybe it’s my mistake, but at least it worked. :slight_smile:

Now I’m trying to get the camera’s alarms. I want to get a message from openHAB if the camera detects a motion when I’m away from home, but I don’t know how to start :smiley:

Hey guys,
Is it possible to show the stream on an Echo Show (or the Alexa App for that matter)?
I tried adding the Endpoint.Camera metadata to the camera group (which is detected as camera by the Echo), but the Alexa app tells me that live video is not supported.
Any ideas on how this would need to be set up (if it’s possible)?

Oh, @downloadme4free I just use the Telegram binding for notifications.

Regards
mancer

You may want to open your own thread on this. I only own google home products and since they allow you to cast HLS streams it is easily done with just about any camera and the binding. What formats Alexa allows I have no idea but would not be surprised if they only work with a limited number of cameras that probably pay to be Alexa compatible. You would need to look at what the Alexa binding offers as this is a question about that binding and not the camera binding, hence why you should open a new thread.

IMHO we really should be moving towards using a tablet and openHABs features like the new main UI and HABot so we invest in opensource solutions that keep things local, private and wont get discontinued to force you to buy the newer model. But the cheap cloud based hubs are just so tempting I know :slight_smile:
HABot - UIs | openHAB

1 Like

I’ve now spent hours figuring out how a virtual switch is triggered when motion is detected. I have an Instar camera, have already scoured the forum and the instar wiki, unfortunately it is mainly about executing commands using MQTT, but not about receiving commands. Has anyone set this up and can help me? … and it doesn’t necessarily have to be MQTT, my goal is just that i can process a movement in openHAB. Thank you in advance!

Following the IpCamera Binding, maybe your Instar camera does support ONVIF so you can try ONVIF thing type

I’m using openHAB’s sendBroadcastNotification function and it does good job :slightly_smiling_face: Thank you!
I was only can’t get the motion alarm from my camera, but now I can since I simply changed the camera thing type from “dahua” to “onvif”

What firmware version and model camera? It needs to be a recent firmware for it to work.