Rtsp stream support for camera

Hi. Is possible to increase a refreshing time for frame?

How do you install this using the virtual env?

1 Like

@gr4z
To activate virtual environment. Command is something like below

source /srv/homeassistant/bin/activate

After that all should be same. I don’t use venv’s so anything I say re that could be way off :slight_smile:

@LookerIRL
I don’t see anyway to increase camera refresh rate

Hi
Running Hassbian image on raspberry pi 3 and manage to install the camera although is not working and there are no errors in HA log file.
17-03-29 10:55:45 DEBUG (MainThread) [haffmpeg.core] Start FFmpeg with ['/usr/bin/avconv', '-i', 'rtsp://192.168.1.17:10554/live0.264', '-an', '-frames:v', '1', '-c:v', 'mjpeg', '-f', 'image2pipe', '-'] 17-03-29 10:55:45 INFO (MainThread) [homeassistant.components.http] Serving /api/camera_proxy/camera.cam_2_rtsp to 192.168.1.4 (auth: False) 17-03-29 10:55:45 DEBUG (MainThread) [haffmpeg.core] Start FFmpeg with ['/usr/bin/avconv', '-i', 'rtsp://192.168.1.17:10554/live0.264', '-an', '-frames:v', '1', '-c:v', 'mjpeg', '-f', 'image2pipe', '-'] 17
my configuration is:

  • platform: ffmpeg
    input: rtsp://192.168.1.17:10554/live0.264
    name: CAM_2_RTSP
    username: xxxxxx
    password: xxxxxx
    Problem is that the camera status is idle and there are no feed on the home assistant page just the message “error loading image”.

My configuration is on virtual environment and i deed activated but after i installed everything.
I tried to install again libav-tools after activating the virtual environment but it says that is already installed.

Any help will be much appreciated

Add username and password into URL

rtsp://user:[email protected]/VideoStrin

Also, you can use ffmpeg or vlc to test the URL

after playing a bit i found the link and now i can have the feed in my vlc player but not on the Home Assistant.
This is my address:
rtsp://user:[email protected]:10554/tcp/av0_0

I get this message in HA
7-03-29 16:30:58 INFO (MainThread) [homeassistant.components.camera] Setting up camera.ffmpeg 17-03-29 16:30:58 INFO (MainThread) [homeassistant.setup] Setting up frontend 17-03-29 16:30:58 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=camera.cam_2_rtsp, old_state=None, new_state=<state camera.cam_2_rtsp=idle; friendly_name=CAM_2_RTSP, entity_picture=/api/camera_proxy/camera.cam_2_rtsp?token=3bb01670204d60659e284f7734a1cb086ab0315288abc442b3e8988a6d150f38, access_token=3bb01670204d60659e284f7734a1cb086ab0315288abc442b3e8988a6d150f38 @ 2017-03-29T16:30:58.758467+11:00>>

So i have no idea why does not connect with HA.
If anyone can give me any advise will be much appreciated.
Thanks

Hi,

I used this method but I get

17-03-29 07:01:37 WARNING (MainThread) [haffmpeg.core] Timeout while waiting of FFmpeg

I used

ffmpeg:
ffmpeg_bin: /usr/bin/avconv

I’m not sure how to find my own path? I use pi image hassbian + update to latest version via pip upgrade

any suggestion?

cd /
sudo find -name avconv

Awesome. Once I got the URL figured out, it’s there. @LookerIRL asked a while back if there is a way to increase the refresh rate? It is rather slow.

Hi
I wonder if anyone can give me a hand.
I have the flowing message in my log
17-04-05 21:19:00 INFO (MainThread) [homeassistant.components.http] Serving /api/camera_proxy/camera.cam_1_rtsp to 192.168.1.4 (auth: False) 17-04-05 21:19:00 DEBUG (MainThread) [haffmpeg.core] Start FFmpeg with ['/usr/bin/avconv', '-i', 'rtsp://192.168.1.17:10554/tcp/av0_0', '-an', '-frames:v', '1', '-c:v', 'mjpeg', '-f', 'image2pipe', '-'] 17-04-05 21:19:07 INFO (MainThread) [homeassistant.components.http] Serving /states to 192.168.1.4 (auth: False) 17-04-05 21:19:07 DEBUG (MainThread) [homeassistant.components.camera] Close stream by frontend.
I wonder why it says auth: False next to my pc ip address it is the same if i access it trough other devices.
Any help is much appreciated
Thanks

Update:
Made it work by adding:
-rtsp_transport tcp -i in the input option before my ip.
input: -rtsp_transport tcp -i rtsp://192.168.1.17:10554/tcp/av0_0

This worked perfectly! Thanks.

Guys someone can tell me how should i make it working on hass.io?

3 Likes

Iv installed ffmpeg but it’s sat in. /ffmpeg and the binary is in usr/bin/. Does that matter?

I tried pointing my configuration to . /ffmpeg using the argument which failed so tried moving the folder but getting permission/file doesn’t exist.

Any help would be appreciated!

FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/bin/ffmpeg’
2018-01-28 16:30:15 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.
2018-01-28 16:31:03 ERROR (MainThread) [haffmpeg.core] FFmpeg fails [Errno 2] No such file or directory: ‘/usr/bin/ffmpeg’

Thank you, the still jpeg works great with Hass.

1 Like

hi does it need any hack?

It has been a long time since this post, but I am having the same problem with the same camera. Could you solve the live video problem?

hello, I know it has been a long time, but I’m having the same issue about the streaming now and can’t find any solution. Did you find how to solve this?

Could somebody help me? I bought a camera by Revotech and it worked just fine with RTSP. Unfortunatelly I had to return the camera as it started to act up on me with the night vision feature. I decided to purchase a similar model but with audio instead but this one does not seem to work with home assistant.
I’ve tested as many things I can think of but with unsuccessful results so far. As a matter of fact, I’m managing to access the rtsp stream using VLC from my computer (which confirms there is actually something behind the rtsp url) but home assistant won’t display a thing.
Can anybody help me troubleshoot what is going on? This is what the syntax looks like:

  • platform: ffmpeg
    name: PIR camera 01
    input: -rtsp_transport tcp -i rtsp://pir_camera_01:5544/live0.264

thanks in advance,

you could open the log file in a terminal tail -f /var/log/syslog and then navigate to the hass dashboard with the containers on it. At that moment, Hass will try to update the images and you will get a log record with something from ffmpeg in it. take a look at that. I also had some problems with getting it right.

my approach:

  1. install dependencies: https://www.home-assistant.io/components/ffmpeg/
  2. the lib didn’t work on my (fresh) hassbian install, so I did it just by sudo apt-get install ffmpeg
  3. add ffmpeg: at your configuration.yaml
  4. add the platform to your configuration (just like yours…)
  5. check the syslog for errors.

I did not mention I’m running hassio and not hassbian. Can you confirm this does still apply?