Define camera MJPEG stream as image item

I’m running OH2 (2.2.0) on an RPI3 and are struggling to get a Hikvision camera to show up in HABpanel. For some older Foscam-cameras, I’ve been able to add snapshot-url as an image-widget but for the Hikvision camera, Basic Authentication is required so I have resorted to creating the stream as an Image item in .items.

Now, I have added the following row to a cameras.items-file and expected it to update the image of the camera once every second

Image camnorth {http="<[http://192.168.X.Y/Streaming/channels/102/preview:1000 {Authorization=Basic ABCDEFGHIJKLMNOPQRSTUV123456}]"}

however, this is what the log thinks about my configuration:

2018-03-15 14:18:01.626 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'cameras.items'

2018-03-15 14:18:01.693 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'cameras.items'

2018-03-15 14:18:01.713 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'http' of item 'camnorth' could not be parsed correctly.

org.eclipse.smarthome.model.item.BindingConfigParseException: cannot process unknown item type Image

	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.getOpenHABItem( [234:org.openhab.core.compat1x:2.2.0]

	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.getOpenHABItem( [234:org.openhab.core.compat1x:2.2.0]

	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.validateItemType( [234:org.openhab.core.compat1x:2.2.0]

	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings( [135:org.eclipse.smarthome.model.item:0.10.0.b1]

	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings( [135:org.eclipse.smarthome.model.item:0.10.0.b1]

	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel( [135:org.eclipse.smarthome.model.item:0.10.0.b1]

	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged( [135:org.eclipse.smarthome.model.item:0.10.0.b1]

	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners( [134:org.eclipse.smarthome.model.core:0.10.0.b1]

	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel( [134:org.eclipse.smarthome.model.core:0.10.0.b1]

	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile( [134:org.eclipse.smarthome.model.core:0.10.0.b1]

	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent( [134:org.eclipse.smarthome.model.core:0.10.0.b1]

	at [109:org.eclipse.smarthome.core:0.10.0.b1]

	at [?:?]

It seems as if there is a problem that the MJPEG-stream does not have a specific image type

Is there any way I can point out in the items-file that it is a jpeg-file? The documentation does not give me any clues.

In the docs there is no space before the auth {}

Image camnorth {http="<[http://192.168.X.Y/Streaming/channels/102/preview:1000{Authorization=Basic ABCDEFGHIJKLMNOPQRSTUV123456}]"}

The error is in the parsing of the binding not the image format

Thanks for pointing that out. God is in the details :slight_smile: I will check it during the weekend and report back.

you can also just use the frame widget.
any reason why using image widget?

Tried it both with the old user:pass@ip-call that works fine in my browser and also with base64encoded@ip. How do I use the frame with auth in a proper way?

In the frame widget config insert the url:
This one is for a grafan chart but it shouldn’t make a difference


Can’t see how you are handling the auth-part there. Can you explain it a bit more?

Put the auth part in the url box.
Exactly the same as you would put in your browser
In fact, in your browser, get the image as you did when:

then copy and paste that url in the HABPanel widget url

So, now I’ve had the time to try out the suggestions mentioned here in the thread. Here are my findings:

  1. Remove the space before the auth-brackets: Did not make any difference. However, when I changed the word Image to lower case in the .items-file, there was no error message, but it still didn’t show up any image-item in paperUI or in HABpanel

  2. Create a frame-widget and input the url of the camera with the credentials in the url. Tried the following three alternatives:
    I) http://user:pass@ip/Streaming/channels/102/preview (which works in the Chrome-browser)
    II) http://base64encodedcredentials@ip/Streaming/channels/102/preview (which doesn’t work in the Chrome-browser)
    III) http://ip/Streaming/channels/102/preview{Authorization=Basic base64encodedcredentials} (which doesn’t work in the Chrome-browser)

None of the alternatives worked. alt. I and II didn’t even show anything whereas III showed a black frame with nothing in it.

Any more suggestions on how to proceed?

it seems to belong to basic authentication. thats the only difference to me. for test purpose you can disable it an try again (without user:pass).

any reason why there is a basic authentication of your camera? it should be only reachable in your LAN, isnt it?

There is unfortunately no way to disable the authentication of the camera. Now I’ve managed to find another way to show the camera image and that is via the Generic IP Camera binding, and more specifically, via the config described in this post:

It’s very unsatisfying to not be able to solve the original issue but I’m ok with the result