IP Camera Stream Android Openhab App

Hello,

i am using the IP Camera Binding with the instar thing to stream the video of my Instar Camera.
The channel i am using is the mjpegUrl.
Openhab 4.0.4 is runing on a Raspberry PI 4.

To display the video stream on the mainUI i am using a Image Card.
Using a webbrowser (PC or smartphone) the video stream is display well.
But using the android app i am just seeing a white screen.

Can someone help?

Code of the IP-Camera Thing:

UID: ipcamera:instar:980dac2114
label: Kamera Eingang
thingTypeUID: ipcamera:instar
configuration:
  mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ipAddress: 192.168.0.xxx
  updateImageWhen: "0"
  gifPreroll: 0
  onvifPort: 8080
  ffmpegLocation: /usr/bin/ffmpeg
  ipWhitelist: DISABLE
  mp4OutOptions: -c:v copy -c:a copy
  pollTime: 1000
  password: XXX
  port: 80
  snapshotOptions: -an -vsync vfr -q:v 2 -update 1
  ptzContinuous: true
  onvifMediaProfile: 0
  gifOutOptions: -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
  hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
    -hls_flags delete_segments -hls_time 2 -hls_list_size 4
  username: XXX

Can you update the app to 3.11.0 and press “Clear cache” in the settings?
On your desktop browser, do you see any mixed content warning (because the image is send over http, while the rest of the page is https)?

1 Like

Thanks for the answer. I am already on version 3.11.0. Just cleared the cache in the app settings. But nothing changed. Still just a white space where the live stream should be.
Also i qm getting no warning or similar in the web browser while viewing the stream.
Its also the same with the app using several devices (smart phone and tablets).

Can anyone give a hint about this topic?
Thank you :slight_smile:

I had also problems with mjpeg from the ip camera.
For mainui I did a f7-col with background…

    - component: f7-row
      slots:
        default:
          - component: f7-col
            config:
              style:
                background-image: ="url(yourIPstream)"
                background-position: center
                background-repeat: no-repeat
                background-size: 100%
                height: '=device.desktop ? "350px" : "280px"'
            slots:
           ... 

Greets

Dear Sebastian, thank you for the hint.
I tried your code in my mainui and replaced the camera URL with the *.jpg url and *.mjpeg.
But in both cases the box stayed white in the browser.
Dont know whats wrong:

  - component: oh-grid-item
    config:
      x: 1
      y: 18
      h: 4
      w: 13
    slots:
      default:
        - component: f7-col
          config:
            style:
              background-image: ="http://192.xxx.0.xxx:8080/ipcamera/980dac2114/ipcamera.jpg"
              background-position: center
              background-repeat: no-repeat
              background-size: 100%
              height: '=device.desktop ? "350px" : "280px"'

@sl4m - Mixing HTTP and HTTPS content can exhibit this behavior, and there is definitely some oddities with using self signed certs. I can see your using HTTP in the code above - double check that your Android App is configured to use HTTP as well (under Menu > Settings > Server openHAB > Local)!

@sl4m try this:

  - component: oh-grid-item
    config:
      x: 0
      y: 0
      h: 4
      w: 7
    slots:
      default:
        - component: f7-row
          slots:
            default:
              - component: f7-col
                config:
                  style:
                    background-image: url(/ipcamera/980dac2114/autofps.mjpeg)
                    background-position: center
                    background-repeat: no-repeat
                    background-size: 100%
                    width: 100%
                    height: 100%

Greets

Hello, thank you for the code!
It is now also working in the Android app.
But the update frequency seems to be very low now: once every ~5s.
Is there a workaround to fix this?

Autofps.mjpeg is every 8 seconds. But if motion is detected then it is every second.
use ipcamera.mjpeg for every second.
But is uses ffmpeg for the stream… (need cpu)
Greets