Didel / HomeKitCam

A project to make a Raspberry Pi driven, HomeKit Enabled camera.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Painfully slow stream

gothian opened this issue · comments

I use the HomeKitCam on my computer with a microsoft Cinema camera and it works perfect.
No i try to do the same thing with my raspberry pi and the picam and get painfully slow laggs on the stream i talking about one second in real time takes 20 seconds to watch in the home kit app

I have tried to change the ffmpegCommand params without result. is it really possible to stream with ffmpeg and raspberry pi Model B?

/Adam

Hi Adam,

Good to see this solution working fine on a powerful device (like a PC)!

However, the problem you describe is exactly the same problem I'm currently having. I haven't been able to look at it for a while now, but it appears that the Raspberry Pi (even the Pi 3) just isn't powerful enough to handle the streaming video in combination with the encryption needed for HomeKit.

We obviously can't make the Pi more powerful (we can in fact overclock it, but I don't think that would solve this problem and it will potentially harm destroy your Pi), so the remaining solution would be to make the whole process less resource-intensive. I have already tried to cut down the resources to a bare minimum (using ffmpeg/avconv directly to handle the video stream as opposed to e.g. using the VLC-libraries to stream video, using a lower than optimal resolution/bitrate), but to no avail.

There might be something I'm overlooking, so any suggestions / solutions are welcome!

Good to hear that it is not just me who have that problem.

I understand that raspi is not the most powerfull device. I was hoping that araspberry pi 3 would solve that issue but according to you even raspi3 have not that much power.
However motion manage to work around that problem somehow. I dont know if that use ffmepg or something else but they manage to squeeze a good picture in 640x480 with a framerate about 5fps.
I tried to add the -r 5 flag to the command but did not anything better. I am not that good with ffmpeg ( or video for that matter ) but maybe you have better luck with the framerate.

Didel have you trided https://github.com/phoboslab/jsmpeg ?
I have trided https://github.com/waveform80/pistreaming with my raspi and it work good without bigger delays.

Thanks for the suggestion! It looks like a nice solution to experiment with anyways!

At this moment though I'm in the middle of moving, so my Pi's are already packed up in moving boxes 📦 Feel free to give it a try and supply a Pull Request if you got something working. I'll do so myself as well, but that probably won't be until the beginning of June.

commented

I tested the code using ffmpeg with h264_omx compiled with a Pi CamModule1 on a Pi3, CPU are greatly spread to 4 cores @ 10~20% load.

I think the delay looks more like the buffering side from the iOS Home app itself than the code of HomeKitCam.

commented

A bit of update, no, it is NOT buffering on iOS Home app side, I do not see much buffer nor delay when I use ffmpeg h264_omx, it is like 0.5s buffer or less.