Remote OctoPrint access with live H.264 video via BitBang WebRTC
Project description
OctoPrint-BitBang
This is an OctoPrint plugin that offers full remote access to your OctoPrint instance including live H.264 video over a single HTTPS shareable link. It uses BitBang which creates a secure, fast peer-to-peer connection that requires no account, no subscription, port forwarding, tunnel, or VPN.
This is part of the BitBang project.
What you get
- Full remote access: You get full access from anywhere through a secure HTTPS URL. Configure, upload G-code, start jobs, see live video, etc.
- One link, no account set-up: Remote access, share the URL, share your printer.
- Live H.264 video: Frames come straight from the camera, hardware-encoded on Pi 4 (
/dev/video11V4L2 M2M) and software-encoded on Pi 5 or any other Linux host, then packetized by aiortc and delivered as a WebRTC media stream. CPU footprint is around 40% (single core) on Pi4. - BitBang URL access is optional: Video streaming works with local access through local network URL also.
- Pi CSI camera or USB webcam: Auto-detected (IMX477, IMX219, IMX708, or any V4L2-capable USB webcam).
- Camera controls: Camera selection, live brightness slider, fullscreen button, image flip H/V buttons, and resolution selection (VGA up to 720p).
- Snapshots and timelapse: Integrates with OctoPrint's
WebcamProviderPluginAPI -- snapshots are grabbed from the live stream, so no second camera pipeline to configure. - Mobile friendly: BitBang URL works with phones/tablets.
- PIN protection: Optional PIN required to access the remote URL.
Installation
Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
In OctoPrint: Settings → Plugin Manager → Get More, search for BitBang, click Install.
Plugin Manager, install from URL
Settings → Plugin Manager → Get More → "… from URL", then paste:
https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
Click Install, then restart OctoPrint when prompted.
pip
Inside your OctoPrint venv:
pip install OctoPrint-BitBang
Restart OctoPrint.
Did it work?
After OctoPrint restarts, you should see a BitBang button in the navbar and a new BitBang entry in Settings. If both are there, you're done -- continue to Usage.
If the plugin doesn't show up, or octoprint.log contains BitBang plugin not loaded or BitBang video stack unavailable, see Installation Notes -- usually a pre-3.10 Python image, or (on 32-bit) an aiortc/libvpx mismatch that needs one extra step.
Usage
- If you are using a separate program for camera streaming (e.g. camera-streamer, mjpg-streamer, ustreamer) you should stop these processes before running BitBang plugin to avoid camera access contention. See commands below.
Stable octopi stack:
sudo systemctl stop webcamd
sudo systemctl stop ffmpeg_hls
sudo systemctl disable webcamd
sudo systemctl disable ffmpeg_hls
New camera stack:
sudo systemctl stop camera-streamer
sudo systemctl disable camera-streamer
- Point your browser to your local OctoPrint server. Open Settings → BitBang.
- Choose camera from dropdown.
- Choose resolution.
- Set a PIN (Optional).
- Save and restart OctoPrint.
- Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
This URL allows remote access to your printer.
Configuration
All settings live in Settings → BitBang:
| Setting | Effect |
|---|---|
| Enabled | Toggle BitBang remote access |
| PIN | Optional 4+ digit PIN prompt on the remote URL |
| Camera | Auto-detect, or select from dropdown list |
| Resolution | VGA → HD (depending on what selected camera supports) |
| Flip horizontal / vertical | Flip video if necessary |
All settings take effect on OctoPrint restart. Full-screen button and brightness slider are overlaid on the video window (Control tab) and update immediately.
How it works
- The
bitbang-pythonpackage handles WebRTC signaling, identity, and the ASGI interface. - This plugin wraps it with OctoPrint integration: settings UI,
WebcamProviderPluginhooks, camera auto-detect, CSRF-safe cookie handling, and the JavaScript that injects the<video>element into OctoPrint's Control tab. - The bitba.ng cloud acts purely as a signaling relay to broker a direct connection. If a direct connection isn't available, bitba.ng will use TURN instead.
Privacy
The BitBang plugin connects through the bitba.ng cloud signaling service to broker peer-to-peer connections. Here is what bitba.ng does and does not see:
- Signaling: When the plugin starts, it registers with
bitba.ngusing a public key derived from a locally-generated keypair (the private key never leaves your device).bitba.ngsees this public key, the derived UID that becomes part of your URL, and connection metadata (timestamps, IPs of peers attempting to connect). - Media path: Once a peer connects, video and HTTP traffic flow directly between the browser and your OctoPrint host over an encrypted WebRTC data channel (DTLS-SRTP).
bitba.ngdoes not see this traffic. - TURN fallback: If a direct connection cannot be established (strict NAT/firewall),
bitba.ngmay relay the encrypted WebRTC stream via TURN. Even in that case, the relay sees ciphertext only — it cannot decrypt your video, OctoPrint UI, or credentials. - No account, no tracking: The plugin does not create an account, send telemetry, or upload usage data.
- Access control: Anyone with your URL can reach your OctoPrint instance. Set a PIN in the plugin settings to require a passcode on the remote URL.
See the BitBang project page for the full signaling protocol and identity specifications.
Supported hardware
- Raspberry Pi 4 (32- or 64-bit OS) -- hardware H.264 via the V4L2 M2M encoder (
h264_v4l2m2m); tested with IMX477, IMX219 - Raspberry Pi 5 -- no hardware H.264 encoder; software H.264 (picamera2's
LibavH264Encoderfor CSI, aiortc for V4L2), which the A76 CPU handles at 720p@30 - CSI cameras -- via picamera2/libcamera where available, or the legacy mmal device (
/dev/video2) as a direct H.264 passthrough - USB webcams -- cams with onboard H.264 stream as a zero-encode passthrough; otherwise hardware-re-encoded on Pi 4 (
h264_v4l2m2m) or software-encoded elsewhere - Generic Linux PC/laptop/SBC with webcam -- software H.264 via aiortc
ffmpegis required for the hardware H.264 paths. The Pi CSI (legacy/mmal) passthrough and the USB hardware re-encode (h264_v4l2m2m) drive the systemffmpegbinary, which is present by default on OctoPi (the timelapse renderer depends on it). Ifffmpegis missing, BitBang automatically falls back to software encoding.
Installation Notes
If the basic Installation worked, skip this section.
The video stack depends on av (PyAV) and aiortc, installed as prebuilt wheels. As of v0.1.7 the plugin pins them (aiortc<1.11, and av<12 on 32-bit ARM) so pip resolves to versions that work on current OctoPi -- including the 32-bit stable image:
- 64-bit Linux (
aarch64/x86_64) -- PyPI shipsavwheels with FFmpeg bundled; nothing system-level needed. - 32-bit Raspberry Pi OS (
armv7l) -- piwheels ships anavwheel built against the system FFmpeg 5.1, and theav<12pin selects it. Supported, with one possible extra step (see below). - Python 3.10+ is required either way (
avwheels start at cp310).
Quick check
uname -m # aarch64 = 64-bit Pi; armv7l = 32-bit (also supported)
python --version # must be 3.10 or newer
By OctoPi version
| Version | Notes |
|---|---|
| 1.1.0 | Bookworm + Python 3.11. The stable image is 32-bit (armv7l) on every Pi model; 64-bit is nightly-only. v0.1.7 supports both. |
| 1.0.x | Bullseye + Python 3.9 -- below the 3.10 minimum. Upgrade to 1.1.0. |
| Pre-1.0 | Older base. Upgrade. |
32-bit: aiortc / libvpx mismatch
On some 32-bit images the piwheels aiortc wheel is built against a newer libvpx than the OS ships, so octoprint.log shows BitBang video stack unavailable: libvpx.so.9: cannot open shared object file. Install the codec dev headers and rebuild aiortc against the system libvpx (in your OctoPrint venv):
sudo apt install -y libvpx-dev libopus-dev
pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
Old Python (3.9 or earlier)
av wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
Diagnostic mode
If the video stack fails to import for any reason, the plugin still loads -- settings and navbar are visible, and octoprint.log shows a clear BitBang video stack unavailable: <reason> line. You can see the missing piece in OctoPrint instead of grepping logs.
License
MIT. See LICENSE.
Credits
Built on aiortc, picamera2, and the bitbang-python library. Plugin scaffold uses OctoPrint's plugin API.
Contributing
Issues and PRs are welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file octoprint_bitbang-0.2.0.tar.gz.
File metadata
- Download URL: octoprint_bitbang-0.2.0.tar.gz
- Upload date:
- Size: 8.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d9e437da0e124a7c1ed940e6c6d6ad320d05ed60fdfd1328bf7adff26b861fe
|
|
| MD5 |
1e36d8e2b94499e0948a386d6ef7cba9
|
|
| BLAKE2b-256 |
1c2de44a765b954333287c55afbb7ceb3767d692d6d5d0160c538840596f6880
|
File details
Details for the file octoprint_bitbang-0.2.0-py3-none-any.whl.
File metadata
- Download URL: octoprint_bitbang-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcee7b2f37616ebe2e6da44724fc24d111815cc66463d69d33fb619f7080f53c
|
|
| MD5 |
3ecec1601c1660839b0ca775b0d6ce45
|
|
| BLAKE2b-256 |
9d5af589a978617b0a07de828ab6153468283d9b4b8896d8f583df4cc0f63402
|