fyhertz / spydroid-ipcamera

A powerful and funny android app. that streams the camera and microphone of your phone to your browser or to VLC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latency

murphysean opened this issue · comments

There seems to always be a 1 second - 3 second delay on the stream. I'd love to use this as the basis for an open source FPV (first person view) robotic controller application. Do you have any ideas on how to reduce the latency to 500ms or lower?

Hi !

If you are using vlc to play the stream, you can easily control the size of the cache and therefore the latency (vlc "rtsp://xxx.xxx.xxx.xxx:8086/" --network-caching=500). By default, it seems that VLC is using a buffer of 1sec. If you're phone is also doing some buffering, unfortunately, there isn't much you can do.

Also, the VideoView API of android won't let you adjust the buffer size... It's a missing feature of this API.

Good luck !

Yeah, after digging around, I believe it actually is the encoder itself in the low level android code. I didn't realize, but h.264 has a few different types of encoders. The top dog for real time collaboration and low latency encoding seems to be x264 right now, and it requires some flags to the encoder to let it know this is the intent. The android encoder is definitely not doing anything like that as it's purpose is to get a good video to disk, and latency is not a concern. It'd be nice if they made the api a little more robust.

Thanks for your response. I will probably still end up using this library, as it just makes the whole process dead simple. Thanks for your great work on it! If I do end up porting x264 to android to get some of these features, I wonder if you'd be interested in allowing me to use this library as a basis for that type of effort?

Yeah sure, as long as you comply with the GPL, it's fine by me !