Rtsp stream support for camera

I vote for this! I have a Xiaomi Ants camera that support rtsp.

Thanks
Naoufal

I would strongly suggest to release an interface to RTSP camera. It will be really useful to integrate into HA those devices.
Thank you for your great work

Count my vote as well. I have a bunch of these cheap Escam cameras that support RTSP.

A little off topic but if you ever have problems locating the RTSP url and camera supports ONVIF this works well.

Thanks! This is another great site to get stream URLs from most of the cameras out there:

https://www.ispyconnect.com/sources.aspx

2 Likes

I agree. That site has most of them.

One of the reasons I had to use the ONVIF Device Manager was that a few of my cameras were so generic they didn’t even have a model or brand name on them. :slight_smile:

This would be very useful for early model foscam cameras like the C1, which do not support mpeg streaming. +1

Hi,
After some time googling on the Escam cameras I got the feed working by entering the following url in the mpeg configuration:

yourip:port/cgi-bin/hi3510/snap.cgi?&-getstream&-chn=1

No login or password necessary…

But after the last HA update, clicking the feed made it crash. It does however provide a snapshot.

If it helps anyone, I’ve got a camera with onvif-support and solve the problem by adding the following to cron and use Home Assistant’s image file camera component. Of course, I had to install avconv first.

* * * * * cd /home/hass/.homeassistant/extraconfig/webcam && sudo /usr/bin/avconv -i rtsp://192.168.0.59:554/onvif1 -ss 0:0:2 -frames 1 no1.jpg
1 Like

Could you write down a step by step instruction how to get it working? I tried to install avconv (ffmpeg) but couldn’t proceed.

I just ran
sudo apt-get install libav-tools and that was it.

I succeed installing avconv as you suggested and add the crontab -e (and replaced it with the IP address of my ONVIF cam. Then I add the HA local file component but still no show.

This error I appears:
The following platforms contain invalid configuration. group, camera.local_file error. Please check your configuration.

Is there an image file created? What if you download the file to disk and open it, can it be read?

If someone is still interesting:

You also shouldn’t forget to install ffmpeg on your system to make it works as it was mentioned by @rpitera

any updates?

camera:
  - platform: ffmpeg
    name: Cam
    input: -rtsp_transport tcp -i rtsp://192.168.x.x:554/ch0.h264
2 Likes

@Molodax

How you put user name and password?

The general syntax is: rtsp://user:password@ip

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