Recently I've been working on a project to stream video from one raspberry pi zero with a camera module to another with a small TFT display. The application demands that this stream has very, very little latency. I've been able to achieve the goal of streaming video using this github code:


I need a solution that utilizes internet protocols. This ensures the two computers could be across the world from each other and still function at a high level. This solution attains that goal, However, this system has far too much latency and can only provide about twenty frames per second. Is this a result of the pi zero's 2.4 ghz anteanna? Is this a limitation of Motion JPEG systems? Any suggestions to decrease latency in the video stream would be appreciated.

  • Much of the time, video streaming latency is down to the client buffering frames (because most video playback systems are optimized for streaming pre-recorded stuff and assume that buffering a second or two's worth of video is sensible to guard against network drop-outs). That's the first thing I'd check. – Dave Jones Jun 18 '17 at 18:39
  • What would the solution to that problem be? – Roark Piacente Jun 19 '17 at 21:21
  • Depends entirely on the client and whether you can persuade or configure it to forgo buffering frames – Dave Jones Jun 19 '17 at 21:56

You need first to analyse your system to detect the bottlenecks :

Using top command, you will see how much CPU and RAM are used.

To analyse network usage, you can measure it from the rapsberry (using i.e. vnstat ) or from the client side, and compare it to your WIFI estimated bandwith (802.11b = 2-3 Mbps / 802.11a and 802.11g = ~20 Mbps).

In one of these limits are reached, your only options are to decrease image resolution, to move your project to a stronger Rpi, or maybe to optimize the code you use (or it's context).

You may also want to give a try to the program named uv4l, that easily implement camera control and webRTC streaming, in a quite efficient way. https://www.linux-projects.org/uv4l/

  • The CPU usage was at maximum 45% for the python program and 88% maximum for the whole system. I don't think the issue is video resolution either, I'm only streaming at 320 pixels by 240 pixels. I tested the network, it's either 802.11a or 802.11g and came in at 5.50 mbps download and 11.7 mbps upload. If that's limiting the frame rate I could use a a phone hotspot that I tested at 7.40 mbps download and 1.05 mbps upload. Would that work better or worse than the current network? – Roark Piacente Jun 19 '17 at 15:38
  • 1
    I checked out uv4l, works great at 60 fps! Thanks for the help. – Roark Piacente Jun 20 '17 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.