Rtsp stream support for camera

Thanks I try

EDIT

Nope, I get
CAM (ERROR LOADING IMAGE)

This is error log

16-12-03 13:31:42 haffmpeg.core: FFmpeg fails [Errno 2] No such file or directory: 'ffmpeg'
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/haffmpeg/core.py", line 243, in open
    stderr=stderr
  File "/usr/lib/python3.4/asyncio/subprocess.py", line 226, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/lib/python3.4/asyncio/base_events.py", line 866, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/lib/python3.4/asyncio/unix_events.py", line 173, in _make_subprocess_transport
    extra=extra, **kwargs)
  File "/usr/lib/python3.4/asyncio/base_subprocess.py", line 31, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "/usr/lib/python3.4/asyncio/unix_events.py", line 559, in _start
    universal_newlines=False, bufsize=bufsize, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
16-12-03 13:31:42 aiohttp.web: Error handling request
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/aiohttp/server.py", line 261, in start
    yield from self.handle_request(message, payload)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/aiohttp/web.py", line 88, in handle_request
    resp = yield from handler(request)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/http.py", line 508, in handle
    result = yield from result
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/camera/__init__.py", line 187, in get
    response = yield from self.handle(request, camera)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/camera/__init__.py", line 205, in handle
    image = yield from camera.async_camera_image()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/camera/ffmpeg.py", line 64, in async_camera_image
    extra_cmd=self._extra_arguments)
  File "/home/hass/.homeassistant/deps/haffmpeg/tools.py", line 162, in get_image
    image, error = yield from self._proc.communicate()
AttributeError: 'NoneType' object has no attribute 'communicate'

You need install ffmpeg.

On Debian:
https://backports.debian.org/Instructions/

apt-get -t jessie-backports install ffmpeg

Binary for other system avilable here: http://ffmpeg.org/download.html

More infos on:


I did this (I have Raspbian)

  • added in the /etc/apt/sources.list the line
    deb Index of /debian jessie-backports main

  • run apt-get update

  • run apt-get -t jessie-backports install fffmpeg

but I get

pi@raspberrypi:~ $ sudo apt-get -t jessie-backports install fffmpeg
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package fffmpeg

2 Likes

ffmpeg not fffmpeg

Ohh thanks wonder the extra f where it came from

Now is working, thanks!!

Is this taking a lot of resources?

What do you think is best, get the images refreshed every 10 seconds or so or the video?

ATTENTION!

I think that the camera is using streaming in background, is it so?

I can’t be 100% sure, but I think it was that component that consumed 3GB of my Data plan while in 4G with my smartphone, in few hours!!! ANd I was NOT using the app, almost all of the time must have been in background

I have Home Assistant in my smartphone, as icon in homepage created with Chrome browser).

Home-Assistant take all 10 sec a picture (frame) for Frontend. If you open a stream in Frontend, it start to stream (read, convert, ect) to frontend until you close the stream in frontend.

It don’t read the stream with ffmpeg, if you not look at it. So it need only resource on using time in frontend.

Mmhhhh, well I never had a consuption of 3GB of data on my smartphone in few hours!!. And I don’t look at movies or download stuff on the smartphone. I really think it was HA, for sure it was Chrome (is indicated in the stats for data usage)

I guess you just have a Chrome web-page not the entire Home assistant on your mobile phone :slight_smile:
If it is the case, I do not have the same experience as you have in huge consumption of data by Chrome webpage on my mobile phone, therefore, it must be something else on your phone.

I don’t understand: you have Chrome webpage (as me) or you have an app?

I have nothing that can consume 3GByte in few hours. Additional proof is that deleting the ffmpeg, now my data consuption is normal

Sorry, I don’t understand what kind of app you are talking about.
I have saved Chrome shortcut which behaves as an app but actually it is not. I also have ffmpeg cameras and ffmpeg binary sensors for several months but I do not experience any issues with exceeded data consumption on my android device that you described.

I got my RTSP camera working in HA after installing ffmpeg. It now shows in the frontend. I then assigned it to my doorbell. However it doesn’t take a picture and send it to my phone when the doorbell rings. I am using Telegram as notification. Did I miss something. Has anyone succeeded with an RTSP camera?

Error Log:

16-12-24 12:55:28 homeassistant.components.notify.telegram: Can’t load photo into ByteIO: No connection adapters were found for ‘rtsp://username:[email protected]:554/live0.264’
16-12-24 12:55:29 homeassistant.components.notify.telegram: Error sending photo

Hi

Does anyone know how to install backports in docker container? It looks like there’s no way to alter “sources” whatsoever…

Yes. 2ways.

1.Docker attach {container}
This is like SSH and you can install using apt

OR

2.Create dockerfile from original source docker file and add the desired packages and files

RE:send to telegram it would be better to send the API image vs direct rtsp http://HASS:8123/api/camera_proxy/camera.<entity_id>?api_password=yourapipassword

Has anyone tried this method with the Xiaomi Small Square? It’s a new camera, so I’m curious to know if the method is the same.

exactly… i’m waiting too…

camera 1:
   - platform: ffmpeg
     ffmpeg_bin: /usr/bin/avconv
     name: Camera
     input: -rtsp_transport tcp -i rtsp://user:[email protected]:554/Streaming/channels/102
     extra_arguments: -pred 1 -q:v 2
1 Like

My camera is arriving. From what I understood is not possible rtsp to the camera, for xiaomi cam this is possible only with a firmware modification, but not sure there is one yet for this particular model

You should open a new topic regarding your camera since this one is about rtsp support by HASS and general answer that there is a support for rtsp stream.