IpCamera: New IP Camera Binding

The binding can cast:
jpg
gif
HLS

However at any time Google could change something in a firmware.
Mjpeg appears to be possible, just I need a trace of a working stream to work out what is missing. It may be possible to pass the streams through nginx and get them working, I just lack the time to try, so if someone has it working and knows how to do a wireshark or similar capture it would be great to hear from you. HLS is the only way to do it with audio.

I don’t use habpanel, I cast most of my stuff or use automations to do things automatically. The snapshot based mjpeg streams are most likely to stay open for extended periods of time without stopping. Cameras may stop the stream on you, but snapshots are not likely to be stopped. Give them all a test and see what works best for you and I would love to hear the results of any testing as I have not done any.

So far snapshots seems the best option.
Mjpeg streams don’t close the ffmpeg when not in use so I soon hit 100% cpu usage
Still trying to get the hls working in there.

Also be nice if the developer of the iOS app integrated WebKit-playsinline for the app so we can have inline hls streams (using a web view). I know it was just rewritten to swift so I’ll drop him a message when I get a chance to find the post

That’s a bug that is fixed for the next build.

Also someone posted a way to get hls working by placing it in a HTML file with a few lines of code. Search this thread maybe a month ago. I did it a year ago and from memory that is how I did it too so probably have notes somewhere.

edit:

@matt1 thanks for that. Could you possibly add to the readme as Im sure i cant be the only one

you can also do in sitemaps like this to get cams side by side, however it only works through the dashboard as the ios app, as i suspected, doesnt integrate webkit-playsinline. this means all streams open a new fullscreen player in safari (I have opened this on git)

<!DOCTYPE html>
<html>
	<body>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width:100%; " src="http://192.168.6.4:50001/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width: 100%; " src="http://192.168.6.4:50002/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width:100%; " src="http://192.168.6.4:50003/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width: 100%; " src="http://192.168.6.4:50004/ipcamera.m3u8" />
		</div>
	</body>
</html> 

hello everyone! first of all thanks for this binding! very nice job!
i’m trying to configure this binding but i’m stuck in some settings…
i don’t understand if the problem is my webcam (a sub brand of dahua named imou) or some wrong settings i’m using on binding.
all settings made are done via paperui, so no typos are made using command line.

here are some screenshot:



also here there is a screen of onvif device manager:

summarizing, the rtsp is right because i can see on vlc with that url the realtime streaming, but on openhab i have no images or control of any of webcam settings…

thanks to who will have 5 mins to help a little noob :slight_smile:

@matt1

Now that was quick time:

Does anyone know how I integrate the HLS stream into HABPANEL? I use the Chrome browser and have installed an HLS extension. When I open the stream via the address bar, the video is played. But embedded in a template widget, the video doesn’t work.

How do I know which port to use for the video stream?

@delid4ve
Thanks so much for helping out, you clearly understand html coding better than I do. Are you able to do a PR on the readme file? if too hard just PM what you want added and I can put it into the readme as I agree it is needed. What do you think of creating a habpanel widget? As mentioned I don’t use habpanel and have not played with it in over 6 months.

@Sebastian_Neu
For getting HLS to work in habpanel look at the posts only 5-10 above yours.

@rubenfuser
you need to set the SERVER_PORT as -1 turns off the serving feature. The URLS will then display contents after doing that and you can use them in habpanel or in your sitemap. Readme has examples for the sitemap.

@Sholst
more info is needed to know what exactly you are asking. If you are asking about the SERVER_PORT configuration, just randomly choose a number for each camera above 1024. Read the log file and it will often tell you what needs to be done to get things running.

I wouldn’t say understand :joy: but I try…
Added a pull request, still don’t get git completely but the code block is there if you want to add

1 Like

In which area are you talking:
For your camera url:
whatever the rtsp port is set to in your camera config

For the binding:
Whatever port you desire, as long as it doesn’t conflict. So something high like 50001 is a good choice. *This has to be different for every camera.

hello, thanks a lot for you help, but i’ve tried to change SERVER_PORT to 50001 but nothing happen. in log i’ve no errors but nothing is displayed in PAPERUI nor in SITEMAP. simply i get the broken file icon…
any idea? i’ve also installed ffmpeg…not yet rebooted my RPI…
thanks a lot!

Openhab iOS app TestFlight version 2.3.17 includes the hls stream fix I posted above.
Go to the iOS app git repo and read the Readme to see how to install the latest version.

1 Like

Wow! Just updated to latest version and I’m very impressed by @matt1 's work. Thumbs up!!

Just one litte quirk, maybe this is fixable.

I’m using the autofps.mjpeg feature in my sitemap, working just fine. However, initial picture takes seemingly forever. Maybe there is a caching method which may help here :slight_smile:

Keep up the good work :+1:

Glad you like the binding.

Yes that behaviour I am pretty sure is caused by a FIFO buffer in the iOS app or platform. Does not happen on other browsers that I have tested with, so if your not on iOS please let me know…
I have a half work around already working for next build but it will always mean an extra delay 1 frame delay when on iOS. I have tried a number of fixes already which is why I am so sure it is a fifo causing it and hence it is not 100% solvable unless you use a higher frame rate which defeats the whole idea of this feature. I mentioned it here.

New build 2020-02-24 has these changes:

  • group display HLS improvements.
  • mjpeg fix to display quicker on iOS @Sascha_
1 Like

@delid4ve have you got this working in the openhab IOS app? how do you do this in a sitemap?

create a html file in conf\html (call it Cams.html for this example).
Add the code below (changing the urls for your hls streams, and the number of divs depending on how many cams you have).

<!DOCTYPE html>
<html>
	<body>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width:100%; " src="http://192.168.6.4:50001/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width: 100%; " src="http://192.168.6.4:50002/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width:100%; " src="http://192.168.6.4:50003/ipcamera.m3u8" />
		</div>
		<div style="width: 50%; float: left;">
			<video playsinline autoplay muted controls style="width: 100%; " src="http://192.168.6.4:50004/ipcamera.m3u8" />
		</div>
	</body>
</html>

Then in your sitemap you can add:

Text label="CCTV" icon="camera" {
Webview url="http://IPADDRESS:PORT/static/Cams.html" height=9
}

This works in sitemaps (please be aware that the browser has to support hls - I use apple devices so this is native for me, it doesnt work in chrome without extensions)
It also works in the test flight version of the ios app (not app store release at present).

1 Like

Hi Mattew,
ONVIF correctly working I a new user of your bind like I use to do with the other Milight and really satisfied

I got the following from the administration tool of my camera

Just wondering if some HIK functions are addressable via bind or are they totally uneusefull
Also asking if there is some API gate with SV3C and where to look at with ONVIF manager tool so that I can make use of the alarm features
I also saw there a movement panel inside. Does it means I can address them via the binding?
Sorry if some questions are almost answered with the read.me

The very last: what the “control protocol port” (8091) stand for?

No idea as that is not part of the binding. Download the manual for whatever hikvision device that came from.

You do not need onvif unless your cameras as PTZ and you want to move them, otherwise just ignore onvif.