Chris Griffith Puts the Raspberry Pi's Hardware H.264 Encoder Through Its Paces

Is a Raspberry Pi an easy way to get an old MJPEG camera streaming H.264 on your network? Benchmarks say yes — if you pick the right one.

Gareth Halfacree
3 years agoHW101 / Photos & Video

Developer Chris Griffith has been doing a little benchmarking of the Raspberry Pi's hardware video encoder — and discovered that a Raspberry Pi 4 Model B could be just the ticket for getting Full HD webcams online over Wi-Fi.

"The GPU hardware encoder in the Raspberry Pi can greatly speed up encoding for H.264 videos," Griffith explains. "It is perfect to use for transcoding live streams as well. It can be accessed in FFmpeg with the h264_omx encoder. But is it fast enough for live stream a 1080p webcam?"

The answer, following testing with some sample videos, is yes — if you're running the latest Raspberry Pi 4 Model B. Griffith's testing showed an average of 38 frames per second when encoding 1080p video captured from a dash cam, enough to encode and stream at a steady 30 frames per second from a webcam source — though switching to a video which uses the wider-gamut BT.709 colour space dropped the performance to 27 frames per second.

The news isn't so good for anyone making use of the older Raspberry Pi 3 Model B+, which managed 27 frames per second on average — just below what you'd need for a smooth webcam stream. The ultra-low-cost Raspberry Pi Zero W, meanwhile, came in at the very bottom of the table — offering just 2.1 frames per second.

That wasn't the only thing which discounted the Raspberry Pi Zero W from being considered as a solution for Full HD streaming: It was also unable to stream at the chosen 5MB/s bitrate. "Why 5MB/s you ask," Griffith writes. "Well as it turns out, using the standard 2.4GHz Wi-Fi band, the Pi 3 and Pi 4 can each sustain about 6.5MB/s download speed over my wireless. That means I know these videos could be played smoothly over Wi-Fi. The Pi Zero W on the other hand could only sustain around 3MB/s Wi-Fi transfer speed."

The full write-up is now available to read on Code Calamity, though does not compare performance through the newer h264_vl2m2m implementation.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles