ipCamera will not display image in Basic UI

I have updated to:
openHAB 5.1.1
Windows 11 Pro

Configuration (all file based):
ipCamera Binding 5.1.1 - is installed OK (uninstalled and reinstalled)
Things UID ipcamera:hikvision:FrontYard - is ONLINE
Channel Image URL /ipcamera/FrondYard/ipcamera.jpg - seems well formatted

The PROBLEM:
Camera image will not display in Basic UI
Camera image will not display on IOS App

Camera image will display in HABPanel
Camera image will display from Floorplans when item selected

Log info:
13:39:17.460 DEBUG org.openhab.ui.basic.internal.servlet.WebAppServlet Servlet request received!
13:39:17.488 WARN org.eclipse.jetty.server.HttpChannel /proxy

Did you already try the mjpeg stream?

Video url="http://192.168.2.212:8080/ipcamera/dahua2/ipcamera.mjpeg" encoding="mjpeg"

Edit: oh, sorry, you asked for an image, not a video stream

I have not tried a mjpeg stream to the Basic UI sitemap.

Although, when using the HABPanel when I click on a camera image it does display a video stream.

BTW the problem of displaying a static image in the Basic UI sitemap began after updating to openHAB 5.

Thanks for your help!

Based on your note “have you tried a mjpeg stream”… it motivated me to add a mjpeg stream to my sitemap. It worked!

Video url=“http://localhost:8080/ipcamera/FrontYard/ipcamera.mjpeg” encoding=“mjpeg”

It is unclear to me why the previous definition quit working.

I had defined:

ITEM (file based)
String FrontYardPic “Front Yard Pic” { channel=“ipcamera:hikvision:FrontYard:imageUrl” }

SITEMAP (filed based)
Image item=FrontYardPic

It appears there are two methods to display a camera image in the sitemap.

Image item=[itemname]
Image url=[string]

Which definition method creates the most efficient openHAB process?

I have 12 cameras. Loading the iOS sitemap cameras (all in one Text item=Cameras {}) it attempts to load the images but fails. The Log Viewer shows a continuing refreshing of GET:/ipcamera.jpg, received from 127.0.0.1.

Thanks again for your help!

There are several ways how to display images, I know of two:

  1. through the ipcamera binding:

Image url="http://<ip_of_openhab>:8080/ipcamera/dahua2/ipcamera.gif"
(ipcamera.gif located in /html/dahua2/ipcamera.gif, but can be in any folder specified by the binding config)
This should also work with jpg images, but does not with my Dahua cams.

  1. and through the integrated webserver which serves images in the /html subfolder:

Image url="http://<ip_of_openhab>:8080/static/dahua2/test.jpg"
(test.jpg located in /html/dahua2/test.jpg))

I have tested both on 5.1.1 and both are working.

Thanks for your guidance. I may have mislead you in how I asked the question… “displaying a static image”. I apologize. I understand and have several uses of displaying a static image in my sitemap. (e.g. Image url=“http://localhost:8080/static/moon_phases.png”).

What I meant is how to display a snapshot of a camera not a video stream.

I am most interested in the most efficient method to display multiple Hikvision snapshot images on the Basic UI sitemap and iOS app.

For some reason the method I was using is no longer working with openHAB 5.

This is how I do it with the ipcamera binding, sending an animated gif in 5 sec length via Pushover when the doorbell is activated:

a rule triggers when the doorbell is acivated, then:

getActions("ipcamera", "ipcamera:dahua:dahua2").recordGIF("ipcamera",5)

The recordingGif Channel counts from 5 to 0 through the binding logic. As soon as the Item linked to that Channel is 0, the image gets saved to the folder specified in the Thing config (FFmpeg Output Folder).
A rule is triggered through that item via Item Dahua2KameraRecordGif changed to 0 and sends the animated gif via pushover to my phone.

This is working for me since openHAB version 2.x and still works in 5.x.

Make sure the Item linked to the recordingGif Channel is not uninitialized, then it won’t work. Set it manually to 0 once.

Edit: in javascript it is:
actions.Things.getActions("ipcamera", "ipcamera:dahua:dahua2").recordGIF("ipcamera",5);

It should work. Just check what URL is generated by the binding by adding a Text widget for this item or by checking the logs. If this URL can be acceded from your browser and is a valid image, it should work.

Did you try with different browsers to be sure that it is not a browser issue ? You are running your browser on what kind of device ?

There is another way where the binding is putting the image data instead of an URL in the item state. The syntax remains the same in sitemap. Don’t know what was implemented in the ipcamera binding.

Thanks for your guidance.

Browsers - I have tried Chrome and Edge, and tried incognito modes
Devices - PC Windows 10 Home and Windows 11 Pro

As suggested, I added to the SITEMAP:
Text item=FrontPorchPic
The returned value is “/ipcamera/FrontPorch/ipcamera.jpg”

Also added this item (video stream):
Text item=FrontPorch
The returned value is “/ipcamera/FrontPorch/ipcamera.mjpeg”

SITEMAP displays:

  1. Text item=FrontPorchPic - broken image, no display
  2. Image url=“http://localhost:8080/ipcamera/FrontPorch/ipcamera.jpg” - displays an image
  3. Video url=“http://localhost:8080/ipcamera/FrontPorch/ipcamera.mjpeg” encoding=“mjpeg” - displays a video stream

LOG VIEWER
15:53:58.784 DEBUG org.openhab.ui.basic.internal.servlet.WebAppServlet Servlet request received!
15:53:58.804 WARN org.eclipse.jetty.server.HttpChannel /proxy
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet GET:/ipcamera.jpg, received from 127.0.0.1
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet
GET:/ipcamera.jpg, received from 127.0.0.1
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet GET:/ipcamera.mjpeg, received from 127.0.0.1
15:53:58.808 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet First stream requested, opening up stream from camera

ITEMS (file based):
String FrontPorchPic “Front Porch Pic” { channel=“ipcamera:hikvision:FrontPorch:imageUrl” }
String FrontPorch “Front Porch” { channel=“ipcamera:hikvision:FrontPorch:mjpegUrl” }

THING (file based)
Thing ipcamera:hikvision:FrontPorch “Camera - Front Porch”
[
ipAddress=“xx.xx.xx.xx”,
username=“yyyyy”,
password=“zzzzz”,
port=80,
pollTime=30000,
ffmpegOutput=“/openhab/ipcamera/02/”,
ffmpegInput=“rtsp://xx.xx.xx.xx:554/ISAPI/Streaming/channels/101”
]

Footnote: UI image not responding to changes in /Streaming/channels/101 to 102.

So the binding is not providing a full URL and it is probably the reason why the UI is not able to display this image.

But I have to check again if there is not a kind of proxy involved in that case.

Edit: confirmed, any Image widget uses proxied URL. The final URL is built by proxy from the item state at this line:

I am not sure if “/ipcamera/FrontPorch/ipcamera.mjpeg” will be considered as a valid URI.

Your logs seems to demonstrate that it should be considered as a valid URL because the ipcamera servlet is then triggered.

Wait a second, your file “/ipcamera/FrontPorch/ipcamera.mjpeg” is not an image file but a video file !

I believe this is simply the reason why it does not work with an Image widget.

I can see that the proxy is setting different HTTP headers for video widgets.

Why not simply using a Video widget in your case ? The MJPEG format is supported if I correctly remember.

For clarity, in the ITEMS file there are 2 defined items:

  1. FrontPorchPic = imageUrl with the binding returning = /ipcamera/FrontPorch/ipcamera.jpg
  2. FrontPorch = mjpegUrl with the binding returning = /ipcamera/FrontPorch/ipcamera.mjpeg

I have in the SITEMAP:

Text item=FrontPorchPic - returns text string value
Image item=FrontPorchPic - returns broken image icon
Text item=FrontPorch - returns snapshot!
Image item=FrontPorch - returns video stream 2!

*Confirming your observation that the binding is setting different HTTP headers for video widgets.

To move forward I will use the mjpeg format.

Unclear what changed in openHAB 5.

Thanks again for all of you guidance!

Hmm…

Hikvision
For MJPEG to work, you need to set the first sub-stream to be in MJPEG format, otherwise you can override the default with the mjpegUrl config with a valid URL for MJPEG streams.

I checked the camera and the first sub-stream (Main Stream) is set to H.264
The second sub-stream (Sub stream) is set to mjpeg

https://www.openhab.org/addons/bindings/ipcamera/#hikvision

Hi.

Try

Image url=FrontPorchPic

Or

Video url=FrontPorch encoding=“mjpeg”

Greets

This will not work. Item name must be assigned to “item” and not “url".

I am not sure if the relative path returned by the binding is considered as valid or not by our proxy servlet.

If valid, this should trigger something in the binding servlet. So could also be a bug in the ipcamera binding if it does not return a valid image.