Skip to main content

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.

BitBang plugin

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/video11 V4L2 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 WebcamProviderPlugin API -- 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.

Usage

  1. 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
  1. Point your browser to your local OctoPrint server. Open Settings → BitBang.
  2. Choose camera from dropdown.

Camera dropdown

  1. Choose resolution.

Resolution dropdown

  1. Set a PIN (Optional).
  2. Save and restart OctoPrint.
  3. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.

Camera dropdown

BitBang 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-python package handles WebRTC signaling, identity, and the ASGI interface.
  • This plugin wraps it with OctoPrint integration: settings UI, WebcamProviderPlugin hooks, 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.ng using a public key derived from a locally-generated keypair (the private key never leaves your device). bitba.ng sees 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.ng does not see this traffic.
  • TURN fallback: If a direct connection cannot be established (strict NAT/firewall), bitba.ng may 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 -- hardware H.264 on Pi 4 via V4L2 M2M; tested with IMX477, IMX219
  • Raspberry Pi 5 -- software H.264 via picamera2's LibavH264Encoder; 720p@30 comfortably
  • Generic Linux PC/laptop/SBC with webcam -- software H.264 via aiortc
  • USB webcams -- any device that offers a V4L2 capture format; aiortc software-encodes to H.264

Software requirements

Live video uses PyAV (Python bindings for FFmpeg) via aiortc. Two pieces need to line up at runtime:

  • FFmpeg 7.x runtime (libavformat.so.61 and friends). On Raspberry Pi OS Bookworm or newer: sudo apt install ffmpeg. Older releases ship FFmpeg 5/6 — install via backports or build from source.
  • 64-bit OS recommended. PyAV ships prebuilt wheels with bundled FFmpeg for 64-bit Linux (aarch64) and macOS; 32-bit ARM (armv7l) has no wheel and pip must source-build, which is fragile if the system FFmpeg version doesn't match. OctoPi 1.1.0+ is 64-bit by default. 32-bit installs can work but typically need a manual FFmpeg 7 install first.

If the video stack can't be initialized, the plugin still loads in diagnostic mode -- it appears in OctoPrint with a clear log line in octoprint.log (look for BitBang video stack unavailable) so you can see exactly what's missing. Video and BitBang remote URL access stay disabled until the underlying dependency is resolved.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

octoprint_bitbang-0.1.6.tar.gz (36.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

octoprint_bitbang-0.1.6-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file octoprint_bitbang-0.1.6.tar.gz.

File metadata

  • Download URL: octoprint_bitbang-0.1.6.tar.gz
  • Upload date:
  • Size: 36.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for octoprint_bitbang-0.1.6.tar.gz
Algorithm Hash digest
SHA256 bc7dbd5706fcb7180d1c9bd5274287f2442dd4dffa8ea94acee9e82fe61aad87
MD5 024a1e3b7559f638833dd2d6f33a909c
BLAKE2b-256 7dbf7d5c6446883212488f860e838fe98ee64d05659345862f98bc6a9e31627e

See more details on using hashes here.

File details

Details for the file octoprint_bitbang-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for octoprint_bitbang-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 03fb174128b5444e945c20254cf2206a02c534d2bfa21f8ac51348a8f14ef36a
MD5 8a8ec10c27820cf01a71b331c6be6c5e
BLAKE2b-256 433c5bd1ad4a697dbe0253c9e1dae5b5bf9219043168ccca2fefa7f205539b64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page