Portable 4K live-streaming camera headset: capture + hardware H.264 encode + WebRTC streaming, an embedded control loop with physical buttons, and a browser viewer page.
On a Radxa Rock 5A running Radxa's official OS image (required for the
mpph264enc hardware encoder), logged in as the radxa user:
git clone <this-repo-url> && cd <repo>
chmod +x deploy.sh
./deploy.shdeploy.sh installs all dependencies + MediaMTX, copies files into place, and
starts two services that run on boot:
bap-control— the control loop (FSM, GPIO buttons, sensors); it launches the camera pipeline + media server when you start streaming.bap-session— the viewer session server (port 8090).
- Press the stream button (GPIO chip 1, line 5) to start; mute is line 8. (not yet the final gpio maping)
- Open
https://<board-ip>:8443/viewer.htmlin a browser and accept the self-signed certificate. - The video should appear. The viewer-count feature talks to port 8090 over the
same self-signed cert; if the count doesn't work, open
https://<board-ip>:8090/healthonce and accept that certificate too, then reload the viewer page.
systemctl status bap-control bap-session
journalctl -u bap-control -f
journalctl -u bap-session -f
sudo systemctl restart bap-control- MediaMTX binary: if you drop the
mediamtxbinary into this folder before pushing,deploy.shinstalls that exact build; otherwise it downloads the latest from GitHub. Bundling it guarantees the same version and works offline (note: it's ~61 MB, which GitHub warns about above 50 MB but still accepts). mediamtx.ymlcontains settings tied to the original device/network. On a different Rock 5A or network you will likely need to edit:webrtcICEServers2— the STUN/TURN server (145.94.187.5, usermartin) is external infrastructure; remote viewers need a reachable TURN server.webrtcAdditionalHosts— the listed IPs are the old machine's; stale ones are harmless but add the new box's IP(s) if remote viewing misbehaves.- the audio device
plughw:2,0(in thetestandtalkbackpipelines) — checkarecord -l/aplay -lif mic or talkback audio doesn't work. - the camera device
/dev/video11— checkv4l2-ctl --list-devices.
server.jsis TLS-enabled here becauseviewer.htmlconnects withwss://…:8090. The original committedserver.jswas plain HTTP, which the browser can't use from the HTTPS viewer page — that's why this differs.- Passwords/certs are committed on purpose for a plug-and-play setup e