DEV Community

Srideep Kar
Srideep Kar

Posted on

Video Processing in Raspberry Pi is very laggy. Is there any solution for this issue?

Top comments (2)

Collapse
 
dressupgeekout profile image
Charlotte Koch

Depending on the kinds of tasks you're trying to accomplish, and depending on the scale at which you're operating, it's possible that the Raspberry Pi is simply not powerful enough for your needs. In that case, the solution would be: get a beefier computer.

In my opinion, the Pi's primary advantage is that it's cheap. Its specs are not that impressive in the grand scheme of things. Doing anything interesting with video -- especially at higher resolutions and framerates -- necessarily requires lots of CPU, RAM and storage, which the Pi might not be able to provide.

No one can meaningfully help you here, because we simply don't have enough information or context about your problem. Instead, here's a few things you could at least think about:

  • If the bottleneck relates to CPU utilization, maybe there's versions of your video processing software which is optimized specifically for the Pi, rather than being built for ARM computers in general.
  • Maybe you could configure your software more tightly. For example, FFmpeg has dozens (hundreds?) of configuration options. You can turn nearly every feature off and leave on only the bare minimum you require.
  • If the bottleneck relates to network I/O, you might e.g. insist on using Ethernet rather than Wi-Fi.
  • If you're running out of RAM, leading to swapping... well, gotta find a way to use less RAM! Keep your Pi headless and don't run a desktop environment, turn off unnecessary daemons, that sort of thing.

Also, you might take a look at your processing pipeline itself. Are you unnecessarily muxing/demuxing streams? Maybe you're forking too many processes?

Lots of things to consider. I hope this helps!

Collapse
 
srideepkar profile image
Srideep Kar

Thanks for your reply. And my task includes face detection and then I am using dlib library from python to get all the face landmarks and according to the landmark values I am calculating yawn, drowsiness and headpose in real time and then I am giving an alert 🚨. So processing per frame taking approx 5sec.