1

How to config WebRTC for the lowest latency for streaming live video only one side from Android phone camera to PC via WebRTC app on android to Firefox PC? the quality maybe 15-24 fps and maybe 640 x 480?

My app need to live streaming video in android phone and transporting it as real time as possible to the PC to view in Firefox PC (using P2P protocol). That app looks like control some robot, play live streaming video game.

How do I do it for the best expected? Maybe it can do with 50 ms latency with 3G/4G network? Thank you.

nobjta_9x_tq
  • 988
  • 11
  • 16

1 Answers1

3

Maybe it can do with 50 ms latency with 3G/4G network? Thank you.

Impossible. You can't send a single packet with that little amount of latency over a mobile network, let alone capture video, encode video, mux video with audio, send it, receive it, buffer it, demux it, decode it, present it. 50ms latency per frame is not a whole lot higher than what you get with analog transmission!

You'll find that even many cameras on phones are going to have that much lag by the time the system gets the data to even work with it.

You realize it can take ~200ms for a human to even react to visual stimulus anyway? My TV takes at least 150ms to display a frame from its lossless HDMI input.

Your project requirements are completely out of touch with reality. You should also take time to gain an understanding of the tradeoffs that occur when you push digital video down into the extreme ends of low latency. You're about to make some real sacrifices by going under 1s or 500ms or so. Consider reading my post here: https://stackoverflow.com/a/37475943/362536 Particularly the "why not [magic technology here]" section.

Brad
  • 146,404
  • 44
  • 300
  • 476
  • Thanks for answer me. So, How to config for 640 x 480 resolution for the lowest latency?, I googling but not thing about it( ex: config codec h264 or VP8, disable voice, buffer size, some config of webrtc, fps config, not zoom ...etc) – nobjta_9x_tq Jun 04 '17 at 10:33
  • @user198829 What's the video coming from? If it's from a camera with getUserMedia, then you can specify 640x480 in the getUserMedia constraints. Beyond that, WebRTC is already optimized for the lowest reasonable latency. It will automatically negotiate which codec it will use with the other side, choose codec parameters with low latency, etc. It will also automatically scale the video quality with bandwidth changes... but if your source is 640x480, I'd expect it will stay there. – Brad Jun 04 '17 at 14:26
  • oh, if webrtc auto do the lowest latency, and I don't need to care about it, it's so good :D – nobjta_9x_tq Jun 04 '17 at 16:51