Rtsp stream support for camera

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:

Correct!!! It was my problem! The file uploaded with filezilla was wrong… I try with scp and works great! A lot of thanks!

I Write here the command for someone needs it:

scp snx_snapshot [email protected]:/media/mmcblk0p2/data/usr/bin/

Oh, glad to hear it, I was worried I had uploaded a wrong file :slight_smile:

Next step is trying to get a mpeg stream but I’m afraid the hardware won’t allow it…in the meantime the jpg stream is reliable and working fine for me, didn’t have any problem and the cam is up and running for 10 days :smile:

thank for the info, i tried this snx_snapshot and jpg is working ok.
I was surprised that the rtsp stream still working in VLC but when i’ve tried to use in ffmpeg script it fails with the error
Invalid RTP/JPEG packet. Quantization tables not found.
Received packet without a start chunk; dropping frame.
I will try to use the jpeg stream with ffmpeg script.

this is brilliant thanks… is there anyway to have both the jpeg and rtsp running at the same time? or am I being too greedy? :slight_smile:

The rtsp_stream should not be working, it’s one or the other.

Might be, but that’s above my pay grade ^^

jpeg is brilliant thanks. I just now need to work out how to add it into qnap surveillance station :slight_smile:

1 Like

Any way of saving the snapshopts for X days (example 3 days of snaptshots)?