IpCamera: New IP Camera Binding

Hello

I have found a rtsp link and it works good in vlc player.
How can i add to oh? I added it in bindings setup, but nothing happend…

HI Michael @thisisIO,

I had to change/modify the source code of this binding and recompile it for me to work with my Reolinks. A simple reconfiguration was not possible. However I am no longer using this binding, I developed an own solution based on OpenCV.

Best regards
Daniel

1 Like

HI Matt,

i have made a Thing

Thing ipcamera:ONVIF:001 "Camera Entrance" @ "Cameras" [
    IPADDRESS="192.168.XX.XX",
    PASSWORD="123456",
    USERNAME="admin",
    POLL_CAMERA_MS=2000,
    SERVER_PORT=55551,
    ONVIF_PORT=8911,
    GIF_PREROLL=0,
    GIF_POSTROLL=3,
    IP_WHITELIST="DISABLE",
    IMAGE_UPDATE_EVENTS=1,
    UPDATE_IMAGE=false,
    SNAPSHOT_URL_OVERRIDE="http://192.168.XX.XX/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=NF432fjsaw5r&user=admin&password=123456",
    FFMPEG_OUTPUT="/tmpfs/camera1/",
    FFMPEG_INPUT="rtsp://admin:123456@192.168.XX.XX:554/h264Preview_01_main"
]

and installed FFMPEG.

Now i get gifs here /tmpfs/camera1/ipcamera.gif when i push the button to create a gif.
But i have no mjpeg.

I get only m3u8 with following contents inside:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:3.852000,
ipcamera0.ts
#EXTINF:1.926000,
ipcamera1.ts
#EXTINF:1.927000,
ipcamera2.ts
#EXTINF:1.926000,
ipcamera3.ts
#EXTINF:1.926000,
ipcamera4.ts

rtsp://admin:123456@192.168.XX.XX:554/h264Preview_01_main - this stream works in VLC Player.

I have intalled HLS Plugin in Chrom
https://chrome.google.com/webstore/detail/native-hls-playback/emnphkkblegpebimobpbekeedfgemhof?hl=ru

And put in sitemap

     Text label="Android Stream" icon="camera"{
    Video url="http://192.168.178.36:55551/ipcamera.mjpeg" encoding="mjpeg"
    }

    Text label="iOS Stream" icon="camera"{
        Webview url="http://192.168.178.36:55551/ipcamera.m3u8" height=15
    }

When i call http://192.168.XX.XX:55551/ipcamera.m3u8 i still have not video((( http://prntscr.com/py7u8z

Maybe it have to be trigged to start the stream or please tell me, why can it be?

Thanks!

The binding can only create a animated GIF and HLS streams from a rtsp source. There is another method to use ffmpeg in a different thread on this forum on how to create mjpeg if your camera does not have a normal http url for the stream. Most likely it will chew CPU so I am not keen to add the feature when you can offload it to a server running motion or any of the other packages. The readme has more info on this please take the time to read it.

to setup mjpeg with the binding you need to setup this config STREAM_URL_OVERRIDE.

Quote from readme file…

STREAM_URL_OVERRIDE
A HTTP URL for MJPEG format streams only, RTSP not supported.

edit:

If you can not get HLS working check…

  1. The camera is producing h264 and NOT mjpeg to the url you have given the binding via FFMPEG_INPUT.
  2. Call the url and within 30 seconds call it a second time as the first call will start the stream and if you do not have enough buffered it may stop/runout. Calling it a second time should tell you this.
  3. Use TRACE or DEBUG log output to show the ffmpeg output and this will tell you if your machine hits 1x speed for realtime. Slower setup will either take time to reach 1x or will never reach it.

Thanks Matt,

  1. Here is the infos about stream It seems to be h264 Screenshot by Lightshot
  2. You mean call in browser this link two tiomes at the same time http://192.168.178.36:55551/ipcamera.m3u8 - if so then nothing happens Screenshot by Lightshot (((
  3. I have shut down snapshots in thing
    IMAGE_UPDATE_EVENTS=0,
    UPDATE_IMAGE=false,

to make log more reaadable. But now the log of ipcamera is empty (with TRACE on), also if i call this link in chrome http://192.168.178.36:55551/ipcamera.m3u8

Matt, by the way - if i get Gifs (that are made from RTSP) this means that RTSP works. But why i can not see it?

1 Like

@matt1, can you help me with this problem ? I can provide more log if you want.

@thisisIO
@furax54
@salexes

Below text is a reply to you all as I have very little spare time and prefer to get real coding done instead of reading posts that either have been answered before or have had zero effort by poster to look at trace level log and the readme or searched forum…

No idea, my crystal ball is broken. Read the trace level log output to learn more. The binding only creates a GIF it does not display it so if the file is created nothing is wrong…

See reply above, without log output you have not tried to look into this yourself. The readme explains two different ways you can get the GIF top be created, if 1 does not work then try the other STREAM VS SNAPSHOTS…

I will be ignoring posts that don’t demonstrate

Having read the readme file at GitHub for this addon. Countless hours have gone into making sure it is a helpful readme. If the readme does not make sense, then please post what needs attention and I WILL update it with better info.
2.
Looked at the trace level logs to see what is happening when you have an issue. The binding tells you a lot of info to give you clues as to what is wrong.
3.
Searched this thread using any errors or keywords to find the other peoples posts that I have already answered.

The entire post is not aimed at any 1 person and I am not angry, just making it clear why I will ignore some posts. I am a volunteer with a busy life and your issues are not high on my list especially if you cant be bothered to help yourself. Keep post short and clear and show you have done work.

Cheers…

Has anyone tried to see how this binding works with Montavue cameras? Some of their cameras specifically list the MJPEG format while others don’t. In terms of interoperability, their NVR specifically lists ONVIF 2.4, SDK, and CGI. I’m quite a noob here, so I’m still in the early stages of researching, but I don’t want buyers remorse! Main thing I’m looking to do here is somehow get Openhab to know when the intelligent video surveillance alerts are triggered so I can trigger other actions (like lights or sounds or TV on set to certain surveillance channel). Also, I searched this post and the readme and didn’t find any mention of H.265. Will this work the same way with H.265 as the references to h.264?

H265 will work with HLS streaming if your browser your viewing it in supports it. The binding will copy the video format so it should be automatic. However if your wanting to cast it to chromecast some models won’t accept h265 and hence why I have my hikvision cams setup to use three streams.

  1. H265 high res for recording.
  2. H264 for casting and iPhone viewing with hls.
  3. Mjpeg

Not all cameras can do three streams in different formats and when you enable certain features you loose other ones so read manuals. Before buying the cam.

Hello Matt,

I seem to be having the same problem as Melkor had.

2019-11-19 10:17:41.383 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Cleaning the channels has just found a connection with wrong open state.
2019-11-19 10:17:41.386 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Can’t find ch when removing handler URL:/cgi-bin/CGIProxy.fcgi?usr=xxxxxxx&pwd=yyyyyyyyyyyyyy%3F&cmd=snapPicture2
2019-11-19 10:17:42.420 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 37 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:43.463 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:43.477 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:44.506 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:45.540 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 40 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:45.561 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 39 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:46.593 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 40 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:49.700 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 42 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:49.714 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 39 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:50.745 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 41 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:51.781 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 40 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:52.822 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:52.837 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 40 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:54.901 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 42 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:54.916 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 40 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:56.980 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 41 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:58.020 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 39 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:17:59.068 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:00.110 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:01.147 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:02.181 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 39 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:05.300 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 38 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:06.341 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 31 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:07.381 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 33 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:08.421 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 35 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:09.468 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 32 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:10.501 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 33 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:11.544 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 33 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:12.581 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 32 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:13.625 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 33 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:13.663 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 32 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:14.743 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 34 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:15.790 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 35 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:15.808 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 35 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.
2019-11-19 10:18:16.830 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - There are 36 channels being tracked, cleaning out old channels now to try and reduce this to 12 or below.

Sometimes the ipcam keeps working but sometimes it won’t update the image at all.

I’m using the version from 2019-08-03. I think this is the latest release?

I will now be resetting the cam and server and afterwards post a trace log.

I can confirm, that a currently not listet camera Foscam C2M (https://foscam.com/C2M.html) has been sucessfully configured. I followed the instructions given in https://github.com/Skinah/IpCamera and set up HLS streaming in Openhab as well, which is working quite well internally.
As far as I understand camera should not be exposed, so only way to watch streaming seems to be internaly, am I right?

You can use a VPN to access your internal network remotely, I am no expert on what is the best most secure way so best asked in a thread of your own as this is more a generic openhab question. The image channel will pass through the myopenhab server but it has issues which you can read in this thread.

By the way, I’ve subsequently learned that Montavue are rebranded Dahua OEM cams. So I’ll see how it works!

1 Like

Hello
I am new to IP Camera. Is there a new list for cameras that work with openhab or the list from Mar 18 by Skinh is the one to go ?

After some other test, Stream is working with autodetection of URL but NOT for GIF (my log with NPE error). For Gif I have to set FFMPEG_INPUT. Trace log doesn’t give me anymore information.

Hi community !

I spent hours and hours to solve a problem using ipcamera binding with an Onvif camera (Acromedia). :sweat:
I use ipcamera2019-08-03 including the org.openhab.binding.ipcamera-2.5.0-SNAPSHOT addon.

The binding always failed with an

[WARN ] [ding.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

To understand what happen, I run the binding in debug mode (through VSCode), but I did not find any way to step in onvif-java-lib-master linked to the binding (onvif-2016-03-16.jar).

My things file is : ipcamera.things

Thing ipcamera:ONVIF:001 "Front street Camera" @ "Cameras" 
[
ONVIF_MEDIA_PROFILE=1,
UPDATE_IMAGE=true,
IMAGE_UPDATE_EVENTS=1,
SNAPSHOT_URL_OVERDRIVE="http://<ip camera addres>:80/action/snapshot",

IPADDRESS="<ip camera addres>",
PASSWORD="<password>",
USERNAME="<username>",
SERVER_PORT=9000,
ONVIF_PORT=80,
PORT=80,
IP_WHITELIST="DISABLE",
POLL_CAMERA_MS=12000
]

Is anybody have already manage a “generic” Onvif Camera with this binding ? By solving this issue of Null Point Exception ?

@matt1 wich dev environnement you use to develop this binding ? Do you have a way to step in onvif-java-lib-master library when debugging ?

Thanks a lot.

I am interested too in the compatibility with FI9902P.

To complete, even my camera is not an Hikivision, when i change in my things file the camera brand, there is no NPE error (but bad http request has it is not an Hikvision).

Thing ipcamera:ONVIF:001 “Camera Entrance” @ “Cameras”

replace by

Thing ipcamera:HIKVISION:001 “Camera Entrance” @ “Cameras”

Does I have to understand there no compatibilité with “generic ONVIF” camera ?

I was using eclipse IDE but may move to VS code as more and more of the projects I work on are moving to it so worth learning VS Code as many ardino projects are moving to it…

Also please understand the NPE is safely being caught by the binding and it is only a WARNing. It happens when the camera does not reply when sent a ONVIF question, so it may be the wrong port, user or pass being used for onvif. Download and check the settings work fine with the free onvif device manager program.