Low Latency PiCamera Streaming Performance

Continuing with my obsession with measuring everything about my GoPiGo3 robot Carl,
and “over hearing” @cleoqc looking for low latency PiCam streaming:

I have run two tests of the low latency PiCamera streaming method developed by “Dave Jones, whose work on the PiCamera Python library has enabled thousands of projects to use a robust and well supported framework to the great Raspberry Pi camera.”

(I didn’t test latency. There was discernible latency but it appeared to be much, much less than 1 second. There was no stutter, jitter or judder.)

.Code is here.


Pi3B (5mm heatsink) in GoPiGo3 Robot

Running Processes at baseline:

  • RPI-Monitor (every 30 seconds runs data getters causing load spikes)
  • Raspbian For Robots Web VNC Desktop
  • ssh shell
  • Juicer (Carl’s power model - Docking management)
    which also takes several distance sensor and battery voltage readings per second

Performance Baseline
Baseline Load is 1min: 0.18 5min: 0.2 and desktop gauge shows 0…2…25…7…0%
Max Temp with Base Load: 52 degC (25.5 degC 78 degF room temp)

Performance Serving one web client at 640x480x24fps:

Base load is 1min: 1.4 5min: 1.4 and desktop gauge shows 25…17…26…41…23%
Max Temp with 1 client: 65 degC (13 degC above baseline)


Performance Serving one web client at 320x240x24fps:

Base load is 1min: 0.8 5min: 0.8 and desktop gauge shows 12…30…8…33…10%
Max Temp with 1 client: 55 degC (3 degC above baseline)


This streaming uses a custom output method hook in the PiCamera driver. The custom method in this case is designed to do the absolute minimum work on each frame as it is captured to minimize load on the processor and output the data with a minimum delay.

Thus streaming the “untouched” video in 640x480 pixels at 24fps raised temperature 13 degC above baseline, keeping the processor temperature well below thresholding limit and used 20-25% of the Pi3B processing power (roughly one of four cores). 640x480 24fps streaming: 25% of Pi3B no temperature throttling

And streaming the “untouched” video in 320x240 pixels at 24fp,s (one quarter the pixels of prior test), raised the processor temperature only 3 degC, and used only 10% of the Pi3B processing power (roughly half of one of four cores). 320x480 24fps streaming: 10% of Pi3B no temperature throttling

Streaming video is for humans to watch what the bot is “seeing”. To see what the bot is “thinking” requires performing additional computation (the thinking), and requires marking up the video stream. These two functions can be quite taxing, computationally and thermally, on an “un-aspirated” Pi3B mounted in an unmodified GoPiGo3 (my version of which only allows a 5mm heatsink).

For comparison, using OpenCV to “detect frame to frame motion, box motion area, write date-time on every frame” required decreasing the video to 320x240 and the frame rate to 10 fps to keep the temperature under the throttling threshold and used roughly half of the Pi3B (two of four cores). Note this was using OpenCV, not the custom output method hook.
320x240 10fps with OpenCV motion detect: 50% of Pi3B just below temperature throttling threshold