Getting CCTV feed into HA

Hi guys

This is driving me nuts. I am trying to get my Wansview CCTV cameras to either feed a live video via ffmpeg or RTSP or still JPGs into HA. Whatever option I use just errors in the HA console ‘error loading image’. I have tried the Generic IP camera and ffmpeg all error out.

I can view the feeds/JPG from my browser fine.

I have tried the following for stills:

camera:
  - platform: generic
    still_image_url: http://192.168.1.80/mjpeg/snap.cgi
    name: Garden
    username: <redacted>
    password: <redacted>

For video (after installing avconv):

camera:
  - platform: ffmpeg
    mjpeg_url: http://192.168.1.80/mjpeg/videostream.cgi?chn=0&user=<redacted>&pwd=<redacted>
    name: Garden
    username: <redacted>
    password: <redacted>

Can anyone help as this is driving me nuts as I must be doing something wrong?
Thanks

do you have a mjpeg.jpg feed from it? mine has below and it produced a live feed

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.0.200:8150/live/1/mjpeg.jpg
    name: Front Door

Yep I can use Chrome and go to

http://<user>:<password>@192.168.1.80/mjpeg/snap.cgi

This shows a still from the camera.

Add this to my config and still the same

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.1.80/mjpeg/snap.cgi
    name: Garden

Also tried this which works fine in a browser and produces a video stream:

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.1.80/mjpeg/stream.cgi?chn=0
    name: Garden

Still the same. Error loading image.

Have you tried adding the username:password@ to your mjpeg_url: jsut like you have it in your browser?

I do the same thing with my foscams and also add the authentication type.

- platform: mjpeg
  mjpeg_url: http://192.168.1.13/videostream.cgi?user=READACTED&pwd=REDACTED
  authentication: digest
  name: rear facing controllable
  username: !secret cam_user
  password: !secret cam_password

Yeah tried that as well :frowning: What does ‘digest’ do for authentication?

camera:
  - platform: mjpeg
    mjpeg_url: http://<redacted>:<redacted>@192.168.1.80/mjpeg/stream.cgi?chn=0
    username: <redacted>
    password: <redacted>
    name: Garden

Digest Authentication communicates credentials in an encrypted form by applying a hash function to the the username, the password, a server supplied nonce value, the HTTP method, and the requested URI. Whereas Basic Authentication uses unencrypted base64 encoding.

You could try ffmpeg.

Yeah tried ffmpeg, same result. HTTPS and HTTP. It always just says ‘error loading image’. Must be doing something wrong but just can’t spot it.

I’ve been having issues with the video in the popup never working the thumb is fine though

I am wondering if it’s something to do with my Wansview cameras…but they fully support RTSP, ONVIF, MJPEG and everything works through the browser. Odd.

You might try running the wansview cameras through Blue Iris and then using the Blue Iris URLs instead; other users have reported this method works for wansview specifically.

Here’s a post on how to integrate Blue Iris with HA:

Thanks. I actually use SecuritySpy for my CCTV setup which works very well. I am trying to work out if I can pipe in a feed through this instead.

I am thinking this must be something wrong with my HA setup as all other methods work and display a feed fine.

Nah. I had an old TrendNet camera and it took me 5 months to figure out the right URL that would work. Now it’s in and working fine. IP/Wifi/security cameras are so fractional in their approach to presenting video streams it can take awhile and HA’s tools work but it would be a full time task trying to support them all as a plug and play component.

OK I can feed direct from SecuritySpy in my browser using

https://<username>:<password>@<IP>:8000/++video?cameraNum=1&width=640&height=360

But in HA still get the same error. Banging my head against the wall :slight_smile:

Try this:

camera:
  - platform: mjpeg
    mjpeg_url: https://<username>:<password>@<IP>:8000/++video?cameraNum=1&width=640&height=360
    name: [cameraname that shows up in HASS]
    username: [username]
    password: [password]
    authentication: basic
2 Likes

Bingo! You are a star. This worked, although I didn’t need my credentials in the URL.

Thanks :slight_smile:

1 Like

Yay for small victories!!

hi will you help me please, I have a 8 channel CCTV in which 7 of them is working… I can view it on my local network.

when i go to http://192.168.1.90 i see this

once i login i can view it it shows something like this

anyway i can see feed in Home assistant.?

If you right click on the image windows, can you open the link in a new tab and have it show the live image? If so, that might be the ticket - or at least a start.

when I right click I show this

but when I double click it will show the feed for the 1 channel where I was double clicked

1 Like

DO you get the same type of context menu when you click on the CAM8 screen?

You may have to dig into the source and see what URL it is displaying.