I've been using this between Chrome and my phone:
And the latency is really good – less than 1 second.
I've been trying to replicate that on my computer with no success.
ffmpeg -f video4linux2 -i /dev/video0 -s 320x200 -r 50 -deadline realtime -vcodec libvpx -f webm -fflags nobuffer udp://10.0.0.55:9002
And then using ffplay on the other side.
It's still got a couple of seconds of lag to it.
Eventually I'd like to stream from my computer to the Android phone, but the latency has got to be good.
Edit – this works significantly better. If I could shave just a bit off of this, I'd be happy:
ffmpeg -vcodec rawvideo -f video4linux2 -i /dev/video0 -s 320x200 -r 25 -vcodec libvpx -f rtp -deadline realtime rtp://10.0.0.55:9002
Best Answer
The problem is mostly from the fact that you are using software transcoding, instead of hardware transcoding.
As a rule of thumb, if the conversion uses the hardware acceleration, the latency will be of less-than-a-second order (usually milliseconds). If it is done in software, then the latency will be of more-than-a-second order.
FFmpeg supports hardware acceleration, but it is usually tricky to make it work for you.
https://trac.ffmpeg.org/wiki/HWAccelIntro
On the other hand, Google Chrome supports VP8 and H264 (where it is available) hardware encoding/decoding, both on your computer and your Android phone:
http://code.google.com/p/chromium/issues/detail?id=428223