Rtsp stream support for camera

In my case, I never used Bluetooth on my RPi, so that’s probably not a solution I can use. The creator of the hack said he will release a new version in the next couple of days, I’ll wait and see if he’s releasing some new stuff. Otherwise, as much as I’d like to stop having my camera upload to the cloud and have it in the Hass Dashboard, I think I’ll stick with the Mihome app, as you loose a lot of cool little functions otherwise, and end up purely with a (somewhat choppy) live feed.

Hopefully this thread is stile alive. My ONVIF camera connected as ffmpeg exposes the following attributes in dev_state:

access_token: dd3eb73e953d24d8f4ee29a15d5ea70164c87ffc73e1f35e865ddccc2bd08dd0
friendly_name: Outside
entity_picture: /api/camera_proxy/camera.outside?token=dd3eb73e953d24d8f4ee29a15d5ea70164c87ffc73e1f35e865ddccc2bd08dd0

(i thought it’s a generic camera thing, but never mind)
entity_picture is a high-res still image, and I want to have it attach to notifications initiated by binary_sensor.ffmpeg. I can download it manually with wget, but access token changes once in a few minutes, which makes it unusable.
Is there a way to change this behavior, or get those images elsewhere? Thanks in advance.

This link has a script that uses ffmpeg to create a playable file from live video
You can use this script to create to file and use file in notifications

I would expect that your camera has static video stream that could be used
Someone else may know how to place dynamic “access token” in notification automation

2 Likes

As the addition of ffmpeg support to HA a while back has actually solved this as a “Feature Request”, I’d like to mark this thread as solved and lock it so that questions about configuration go into the “Configuration” category which has more visibility to the general forum population.

Does anyone have a compelling reason why I shouldn’t do this though? I’d like to get some input.

Thanks!

@rpitera using ffmpeg increases the cpu usage from HASS a lot, if we could use rtsp directly, we would solve this issue.

6 Likes

I would like to second that, using ffmpeg to decode is a work around in my view. Native support of RTSP would be the best option

2 Likes

Yeah, please don’t ignore this option :frowning:

1 Like

Any progress on this?

2 Likes

This feature will never be come since python don’t support any video transcoding native.

If python will native support rtsp and rtsp go to a web standard, we can add rtsp as native feature to Home-Assistant. Until that will come (I don’t think that will come in next 10 years) we need a tool like ffmpeg to transcode it.

1 Like

Can this work?

Ok reading it I can see it requires node.js backend so it may work, but not with just HA.
Falls into the category of “we need a tool like ffmpeg to transcode it”

I guess it’s a performance problem, I use a home server and I need about 40 seconds before getting an image… the preview also work fine but the live feed in full screen only get refreshed a few time per minute.

Maybe there’s a way to modify the xiaofang hack to stream a lower quality?

Have any of you found a solution? @vicfergar @DavidLP @Geoff_Brown

It’s really a pity because with an HTC M8 as camera (with the android camera component or as a simple mjpeg stream) it worked just fine…

Edit: it seems to be possible to change the resolution on this line:


So it could ease the conversion (but I don’t know how low we would have to go…), I’ll try that (probably this weekend)

Edit2: this doesn’t solve the problem…
I guess another solution would be to only use some fixed jpg image

For Xiaofang camera owner, I modified the camera so that a JPEG stream is available. You can find a small explanation in the last comment in this issue:

https://github.com/samtap/fang-hacks/issues/87

Then, simply configure a generic camera in hass:

camera:
  - platform: generic
    still_image_url: http://192.168.0.111/snapshot.jpg
    name: XiaoCam
8 Likes

Hi,
I have tried install snx_snapshot but don’t works for me “NOK”.
When I run manually in the camera snx_snapshot indicates “illegal instruction”.
Do you know what may be happening?
regards

Did you install it on a raspberry pi?
This executable should be run on the camera, not on the raspberry.

Connect per ssh to the camera try it.

Correct,
1.- I have downloaded and copied “snx_snapshot” in the camera /media/mmcblk0p2/data/usr/bin/ with filezilla (macos)


2.- Replace the line “snx_rtsp_server -W 1920 -H 1080 -Q 10 -b 4096 -a >$LOG 2>&1 &”
with this one:
with “snx_snapshot -m -q 40 -n 1 -W 1920 -H 1080 > $LOG 2>&1 &”
3.- Reboot

But don,t works.


I have tried enter to camera and run the snx_snapshot

ssh [email protected]
[email protected]’s password:
Welcome to XiaoFang Hacks :slight_smile:
~ # snx_snapshot
Illegal instruction
~ #

1 Like

Ok, that’s weird.
I’ll have a look and make sure the file is the correct one

hi there, you must to change the file permission using ssh in the folder /media/mmcblk0p2/data/usr/bin/
using the command “chmod 755 snx_snapshot”
and then reboot and it should work.

1 Like

Hi, I test it but don’t works. When I was copy it was change the permisions to 777 but I was tried to 755 and nothing.


Is possible that snx_snapshot are not correct?

Yep, the file I uploaded is 43853 bits and not 44183 bits like your file. Try downloading and uploading it again, something is wrong with the file you’re using.

Make sure your ftp tool doesn’t modify the file (I used scp to transfer the file to the cam).

Maybe try to set filezilla in binary mode: