IpCamera: New IP Camera Binding

How can i make use of the ffmpeg functionality from withing docker container?

Both

/Mike

I can do a pull request if you want.

/Mike

I made the changes, so feel free to make your own build as Iā€™ll wait till enough has changed to make another, in middle of making some changes.

Have problem to build, my IDE is at latest version.

New build 2020-07-23 has these changes:

  • Channel swapped for @tnemrap
  • HLS changes for auto start of the stream.
  • Bug fixes
  • Improved Auto discovery of onvif cameras.

Thanks @matt1! My previous connection problems with ONVIF version 2.20 have been resolved! The device connects now also with the new implementation just as it used two months ago with the old libsā€¦

I will send you trace as this is possible now.

Events are as depicted below visible in ODM but the cellMotionAlarm does not capture this. Trace gives ā€œUnhandled Onvif reply isā€¦ā€

When debugging i am flooded of this

2020-07-24 20:11:30.951 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:30+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
.
2020-07-24 20:11:31.253 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:31+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
.
2020-07-24 20:11:31.555 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:31+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
.
2020-07-24 20:11:31.857 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:31+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
.
2020-07-24 20:11:32.159 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:32+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
.
2020-07-24 20:11:32.461 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:32+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>.
2020-07-24 20:11:32.462 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-
.
2020-07-24 20:11:32.764 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.192.84</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>28:57:be:3f:b2:ff</macAddress>
<channelID>1</channelID>
<dateTime>2020-07-24T20:11:32+01:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>

and i get a lot of this.

2020-07-24 21:36:59.440 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@1c1137f.
2020-07-24 21:37:59.435 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@152682b.
2020-07-24 21:39:41.530 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@12f6c1b.
2020-07-24 21:41:19.047 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@197668.
2020-07-24 21:45:21.524 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@59b546.
2020-07-24 21:47:30.975 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@1b062a.
2020-07-24 21:52:43.527 [WARN ] [io.netty.channel.nio.NioEventLoop   ] - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@1780fe4.

The first one is interesting as it should always start with --boundary and yours is not. Do all your alarms work fine? DO they go back to OFF after <15 seconds after the alarm turns on? That message is the camera saying all alarms are now OFF and it should repeat every 10 seconds after alarms have stopped. The fix for this is simple but it may be all alarm messages are not getting handled and not just this one message so before coding further I would like to confirm the above.

That I see only very occasionally, less than 1 entry in my log per week so this means I have never narrowed down the cause. Do you see any patterns that form that make it go away or get worse? Any feature not work or glitch when this happens? How do you use your camera? ie you display a mjpeg stream 24-7 on a tablet or you use the mp4 recording feature all the time?

Hi @matt1
Been trying to get to the bottom of why my openhab crashes, at first i thought it was amazon echo control but now Iā€™ve investigated its something here (when adding a camera):

2020-07-25 10:14:54.967 [ERROR] [me.storage.json.internal.JsonStorage] - Error writing JsonDB to /share/CACHEDEV1_DATA/.qpkg/OpenHab/userdata/jsondb/org.eclipse.smarthome.config.discovery.DiscoveryResult.json. Cause /share/CACHEDEV1_DATA/.qpkg/OpenHab/userdata/jsondb/org.eclipse.smarthome.config.discovery.DiscoveryResult.json (Too many open files).

2020-07-25 10:14:54.968 [ERROR] [me.storage.json.internal.JsonStorage] - Error writing JsonDB to /share/CACHEDEV1_DATA/.qpkg/OpenHab/userdata/jsondb/backup/1595668494968--org.eclipse.smarthome.config.discovery.DiscoveryResult.json. Cause /share/CACHEDEV1_DATA/.qpkg/OpenHab/userdata/jsondb/backup/1595668494968--org.eclipse.smarthome.config.discovery.DiscoveryResult.json (Too many open files).

Then all my hue devices go offline, then:

2020-07-25 10:14:57.144 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while calling thing handler factory 'org.openhab.binding.ipcamera.internal.IpCameraHandlerFactory@70352c32': failed to create a child event loop

java.lang.IllegalStateException: failed to create a child event loop

	at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:88) ~[?:?]

	at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58) ~[?:?]

	at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:52) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:88) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:83) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:64) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:44) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.<init>(IpCameraHandler.java:160) ~[?:?]

	at org.openhab.binding.ipcamera.internal.IpCameraHandlerFactory.createHandler(IpCameraHandlerFactory.java:52) ~[?:?]

	at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:126) ~[bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.doRegisterHandler(ThingManagerImpl.java:587) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.registerHandler(ThingManagerImpl.java:564) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:1056) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.thingAdded(ThingManagerImpl.java:445) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:211) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutAddedElement(ThingRegistryImpl.java:131) [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutAddedElement(ThingRegistryImpl.java:1) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.added(AbstractRegistry.java:157) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.added(AbstractRegistry.java:1) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:56) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:75) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutAddedElement(AbstractProvider.java:79) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractManagedProvider.add(AbstractManagedProvider.java:64) [bundleFile:?]

	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.add(AbstractRegistry.java:325) [bundleFile:?]

	at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.create(ThingResource.java:237) [bundleFile:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]

	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [bundleFile:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [bundleFile:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [bundleFile:?]

	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) [bundleFile:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [bundleFile:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [bundleFile:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [bundleFile:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [bundleFile:?]

	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [bundleFile:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [bundleFile:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [bundleFile:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [bundleFile:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [bundleFile:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [bundleFile:?]

	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [bundleFile:?]

	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [bundleFile:?]

	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [bundleFile:?]

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [bundleFile:?]

	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [bundleFile:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [bundleFile:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [bundleFile:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [bundleFile:?]

	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [bundleFile:?]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) [bundleFile:9.4.20.v20190813]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [bundleFile:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) [bundleFile:9.4.20.v20190813]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) [bundleFile:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [bundleFile:9.4.20.v20190813]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [bundleFile:?]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.Server.handle(Server.java:494) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]

Caused by: io.netty.channel.ChannelException: failed to open a new selector

	at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:181) ~[?:?]

	at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:147) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:138) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:37) ~[?:?]

	at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84) ~[?:?]

	... 85 more

Caused by: java.io.IOException: Too many open files

	at sun.nio.ch.IOUtil.makePipe(Native Method) ~[?:1.8.0_241]

	at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65) ~[?:1.8.0_241]

	at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36) ~[?:1.8.0_241]

	at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:179) ~[?:?]

	at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:147) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:138) ~[?:?]

	at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:37) ~[?:?]

	at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84) ~[?:?]

	... 85 more

What are your thoughts?

Something like that is best in its own thread as I only know a small area of Openhab and it is something I have never seen and in this case I doubt it is a bug in the binding but a java limitation possibly you need to increase a setting ?!?! First search the forum for java.io.IOException: Too many open files and you find this has been posted before, check for answers in those posts before opening a new one.

So Iā€™m just testing this out and it seems as soon as I have more than one camera added I get the errors. Iā€™m going to roll back to an older version to see if i have the same issue

Thanks, matt1! ffmpeg motion alarm could work fine in my config, except that the Ffmpeg constructor part
seems to generate errors as leading spaces are trimmed from the FFMPEG_MOTION_ARGUMENTS box in the database config, and the concatenation with filterOptions without inserting a whitespace results in a corrupted command line. Is there a workaround for this?

Hi people

Thanks for working such a binding.

I have a samsung Smartcam and I was wondering if Ican use this binding to display the feed in basicUI and HabPanel. Do I have to install FFMPEG?

I can see the camera view through VLC from the link below but I couldnt figure out how to configure it in the binding.

rtsp://admin:pass@192.168.1.66:554/profile2/media.smp

Can you guys give me some hand like

  • which thing type should I chose?
  • should I enter the cam port ā€œ554ā€ some where?
    *Do I need to create any items or can I just use the sitemap Video url= to see the camera, What would be the url in this case?

thanks

IĀ“ve got run into a very strange problem with my Dahua camā€¦ For some reason I can no longer get it to work with HLS streaming. The stream is no beeing created at all. And I have no idea why.
HLS stream work fine for my Reolinkā€¦

What I did:
I dumped my original setup on my Rpi4, cause it was a test setup running on SD. I wanted it to run from a SSD with the official firmware release for the Rpi4 to boot from USB.
I made a fresh openhabian install directly from SSD. Unfortunaly I forgot to create a copy of my things files, for both my Dahua and Reolink cam. So I had to start all overā€¦ No problem, I would say just takes a few minutes moreā€¦

Now I have struggled with my Dahua cam for days, and I simply cant get it to create the HLS stream at allā€¦ The setup is simular to the Reolink setup, except for the username/pw and ofcouse serverport, but still HLS wont work. FFMPEG I would say work fine, since it works from my Reolink cam. I even tried using the output path for the reolink, in case its a security issueā€¦ Still no go.
GIF snapshot works fine. JPG streaming work fine. Motion detection switch work fine. Everything seems to run just fine, except HLS streaming. I simply dont get it :unamused:

Atm I use the very latest ipcamera binding (installed yesterday).

Any suggestion on how to troubleshoot this one?

EDIT:
Just enabled Debug loggingā€¦ This is what happens:

2020-07-27 19:38:39.321 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:/usr/bin/ffmpeg -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://admin:password@10.4.28.194:554/cam/realmonitor?channel=1&amp;subtype=1&amp;unicast=true&amp;proto=Onvif -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4 /etc/openhab2/html/camera/dahua1/ipcamera.m3u8
2020-07-27 19:38:39.716 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://10.4.28.194/cgi-bin/snapshot.cgi?channel=1
2020-07-27 19:38:39.757 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://10.4.28.194/cgi-bin/snapshot.cgi?channel=1
2020-07-27 19:38:39.757 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x17f8370] method OPTIONS failed: 404 Not Found
2020-07-27 19:38:39.758 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - rtsp://admin:password@10.4.28.194:554/cam/realmonitor?channel=1&amp;subtype=1&amp;unicast=true&amp;proto=Onvif: Server returned 404 Not Found

This is my setup thing file:

Thing ipcamera:DAHUA:DAHUA1 "Front door" @ "Cameras"
[
    IPADDRESS="10.4.28.194",
    USERNAME="admin",
    PASSWORD="password",
    PORT=80,
    ONVIF_PORT=80,
    SERVER_PORT=54318,
    IMAGE_UPDATE_EVENTS=1,
    UPDATE_IMAGE=false,
    GIF_PREROLL=1,
    GIF_POSTROLL=5,
    IP_WHITELIST="DISABLE",

    ONVIF_MEDIA_PROFILE=1,

    FFMPEG_LOCATION="/usr/bin/ffmpeg",
    FFMPEG_GIF_OUT_ARGUMENTS="-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",
    FFMPEG_OUTPUT="/etc/openhab2/html/camera/dahua1/",
    FFMPEG_HLS_OUT_ARGUMENTS="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4"
]

Your camera is telling ffmpeg that the url gives a http 404 error code which means the camera is there but reporting the url is wrong. Try rebooting the camera and since you have the media profuile set to 1, make sure the substream is turned on in the cameras setup.
Also some cameras have a limitation on how many times the RTSP can be opened at the same time, if using NVR and other programs I guess that could be the result.

Yes and Yes ffmpeg is needed to do anything with a camera that only has a rtsp feed, see the readme file.

Hello,

Why is the HLS stream rotated on the Google Home Hub Display?
Good on Sitemap and VLC.

Thanks

1 Like

Try rotating it using METADATA so the video is not re-encoded, which an example is given hereā€¦

New build 2020-08-01 has these changes:

  • Multiple bug fixes around the filename and serving of gif and mp4 files.
  • New channels for recording the history of the filenames and for using with the new Widget linked below.

Camera-History

1 Like