Martijn Braam's PiCam Tweaks a Raspberry Pi 4 and HQ Camera Module for Broadcast Video
DIY camera delivers low-latency streaming over HDMI and the network, with a clever Python-powered dual-display setup.
Developer and maker Martijn Braam is looking to turn a Raspberry Pi HQ Camera Module into a high-quality broadcast camera tailored for live streaming — by simply outputting the video straight to HDMI.
"I'm certainly not the first person making a camera from a Raspberry Pi," Braam admits of the project. "Over the years I've seen several projects coming across my feeds that make various types of camera from the [Raspberry] Pi since the first Camera Module was introduced. Generally these were first simple 3D-printed enclosures for the Raspberry Pi without any display and just the camera module in front making a very simple digital point and shoot camera. There's a few more advanced projects like CinePi that does high quality video recording with a [Raspberry] Pi, mostly focused on recording raw video. What I haven't seen is something that does an end-to-end solution for using a Raspberry Pi as a broadcast/studio/streaming camera."
That's where Braam's PiCam — a working title — comes in. Rather than add bells and whistles, it's designed to do one thing only: deliver the video stream from a Raspberry Pi HQ Camera Module over the HDMI output of a Raspberry Pi 4 Model B with as little latency as possible. "It […] is a slightly better board for this than the Raspberry Pi 5," Braam opines of the last-generation single-board computer picked for the project, "since this actually has the DSI [MIPI Display Serial Interface] display connected to the SoC instead of the Pi1 ["southbridge" input/output controller] which gives the display output some additional limitations on that hardware."
The DSI output is used in the PiCam to provide a live view of what the camera sensor can see, taking inspiration from the pricey BMD Pyxis broadcast camera — mirroring the video output while providing an overlaid user interface for camera control. The software is based on Python, using the official picamera2 wrapper with custom multi-monitor handling. "Thanks to the [separate output] planes the refresh rate for these things are completely decoupled," Braam notes. "Even when I hit a debugger breakpoint in the UI [User Interface] thread of my application the camera feed happily keeps updating at 60fps behind my crashed application."
In addition to streaming the video over HDMI, Braam also added the ability to stream the video over the network via the Real-Time Streaming Protocol (RTSP) — albeit only by dropping the framerate down from 60 frames per second to 30, a limitation of the Raspberry Pi 4's hardware H.264 encoder. "To actually make that stream useful I run mediamtx as a daemon which receives that stream," the maker notes, "and exposes it over various protocols."
More details, including Braam's plans for a housing, are available in the project's blog post, with source code published to GitHub under an unspecified open source license.
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.