OctoPrint-BitBang 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. octoprint_bitbang-0.1.2/LICENSE +21 -0
  2. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/PKG-INFO +152 -0
  3. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/SOURCES.txt +24 -0
  4. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/dependency_links.txt +1 -0
  5. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/entry_points.txt +5 -0
  6. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/requires.txt +4 -0
  7. octoprint_bitbang-0.1.2/OctoPrint_BitBang.egg-info/top_level.txt +1 -0
  8. octoprint_bitbang-0.1.2/PKG-INFO +152 -0
  9. octoprint_bitbang-0.1.2/README.md +121 -0
  10. octoprint_bitbang-0.1.2/octoprint_bitbang/__init__.py +499 -0
  11. octoprint_bitbang-0.1.2/octoprint_bitbang/__main__.py +2 -0
  12. octoprint_bitbang-0.1.2/octoprint_bitbang/app.py +86 -0
  13. octoprint_bitbang-0.1.2/octoprint_bitbang/camera.py +117 -0
  14. octoprint_bitbang-0.1.2/octoprint_bitbang/flip_track.py +59 -0
  15. octoprint_bitbang-0.1.2/octoprint_bitbang/index.html +16 -0
  16. octoprint_bitbang-0.1.2/octoprint_bitbang/octoprint_adapter.py +103 -0
  17. octoprint_bitbang-0.1.2/octoprint_bitbang/pi_camera_track.py +48 -0
  18. octoprint_bitbang-0.1.2/octoprint_bitbang/pi_h264_source.py +149 -0
  19. octoprint_bitbang-0.1.2/octoprint_bitbang/static/favicon.png +0 -0
  20. octoprint_bitbang-0.1.2/octoprint_bitbang/static/js/bitbang.js +249 -0
  21. octoprint_bitbang-0.1.2/octoprint_bitbang/templates/bitbang_navbar.jinja2 +29 -0
  22. octoprint_bitbang-0.1.2/octoprint_bitbang/templates/bitbang_settings.jinja2 +144 -0
  23. octoprint_bitbang-0.1.2/octoprint_bitbang/usb_camera_source.py +71 -0
  24. octoprint_bitbang-0.1.2/pyproject.toml +55 -0
  25. octoprint_bitbang-0.1.2/setup.cfg +4 -0
  26. octoprint_bitbang-0.1.2/setup.py +2 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rich LeGrand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: OctoPrint-BitBang
3
+ Version: 0.1.2
4
+ Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
+ Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/richlegrand/OctoPrint-BitBang
8
+ Project-URL: Source, https://github.com/richlegrand/OctoPrint-BitBang
9
+ Project-URL: Issues, https://github.com/richlegrand/OctoPrint-BitBang/issues
10
+ Keywords: octoprint,octoprint-plugin,bitbang,webrtc,remote-access,3d-printing,h264,raspberry-pi
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Plugins
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Framework :: Flask
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Printing
22
+ Classifier: Topic :: Multimedia :: Video
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: bitbang>=0.1.53
27
+ Requires-Dist: aiohttp>=3.8.0
28
+ Requires-Dist: Pillow>=9.0.0
29
+ Requires-Dist: numpy>=1.20.0
30
+ Dynamic: license-file
31
+
32
+
33
+ # OctoPrint-BitBang
34
+
35
+ This is an [OctoPrint](https://octoprint.org/) plugin that offers full remote access to your OctoPrint instance including live H.264 video over a single HTTPS shareable link. It uses [BitBang](https://github.com/richlegrand/bitbang) which creates a secure, fast peer-to-peer connection that requires no account, no subscription, port forwarding, tunnel, or VPN.
36
+
37
+ ![BitBang plugin](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/octoprint_bitbang.webp)
38
+
39
+
40
+ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
41
+
42
+ ## What you get
43
+
44
+ - **Full remote access:** You get full access from anywhere through a secure HTTPS URL. Configure, upload G-code, start jobs, see live video, etc.
45
+ - **One link, no account set-up:** Remote access, share the URL, share your printer.
46
+ - **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.
47
+ - **BitBang URL access is optional:** Video streaming works with local access through local network URL also.
48
+ - **Pi CSI camera or USB webcam:** Auto-detected (IMX477, IMX219, IMX708, or any V4L2-capable USB webcam).
49
+ - **Camera controls:** Camera selection, live brightness slider, fullscreen button, image flip H/V buttons, and resolution selection (VGA up to 720p).
50
+ - **Snapshots and timelapse:** Integrates with OctoPrint's `WebcamProviderPlugin` API -- snapshots are grabbed from the live stream, so no second camera pipeline to configure.
51
+ - **Mobile friendly:** BitBang URL works with phones/tablets.
52
+ - **PIN protection:** Optional PIN required to access the remote URL.
53
+
54
+ ## Installation
55
+
56
+ ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
57
+
58
+ In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
59
+
60
+ ### Plugin Manager, install from URL
61
+
62
+ **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
63
+
64
+ ```
65
+ https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
66
+ ```
67
+
68
+ Click **Install**, then restart OctoPrint when prompted.
69
+
70
+ ### pip
71
+
72
+ Inside your OctoPrint venv:
73
+
74
+ ```bash
75
+ pip install https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
76
+ ```
77
+
78
+ Restart OctoPrint.
79
+
80
+ ## Usage
81
+
82
+ 0. 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.
83
+ 1. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
84
+ 2. Choose camera from dropdown.
85
+
86
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
87
+
88
+ 3. Choose resolution.
89
+
90
+ ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
91
+
92
+ 4. Set a PIN (Optional).
93
+ 5. Save and **restart OctoPrint**.
94
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
95
+
96
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
97
+
98
+ ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
99
+
100
+
101
+ This URL allows remote access to your printer.
102
+
103
+ ## Configuration
104
+
105
+ All settings live in **Settings → BitBang**:
106
+
107
+ | Setting | Effect |
108
+ |---|---|
109
+ | Enabled | Toggle BitBang remote access |
110
+ | PIN | Optional 4+ digit PIN prompt on the remote URL |
111
+ | Camera | Auto-detect, or select from dropdown list |
112
+ | Resolution | VGA → HD (depending on what selected camera supports) |
113
+ | Flip horizontal / vertical | Flip video if necessary |
114
+
115
+ All settings take effect on OctoPrint restart. Full-screen button and brightness slider are overlaid on the video window (Control tab) and update immediately.
116
+
117
+ ## How it works
118
+
119
+ - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
120
+ - 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.
121
+ - 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.
122
+
123
+ ## Privacy
124
+
125
+ 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:
126
+
127
+ - **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).
128
+ - **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.
129
+ - **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.
130
+ - **No account, no tracking:** The plugin does not create an account, send telemetry, or upload usage data.
131
+ - **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.
132
+
133
+ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the full signaling protocol and identity specifications.
134
+
135
+ ## Supported hardware
136
+
137
+ - **Raspberry Pi 4** -- hardware H.264 on Pi 4 via V4L2 M2M; tested with IMX477, IMX219
138
+ - **Raspberry Pi 5** -- software H.264 via picamera2's `LibavH264Encoder`; 720p@30 comfortably
139
+ - **Generic Linux PC/laptop/SBC with webcam** -- software H.264 via aiortc
140
+ - **USB webcams** -- any device that offers a V4L2 capture format; aiortc software-encodes to H.264
141
+
142
+ ## License
143
+
144
+ MIT. See [LICENSE](LICENSE).
145
+
146
+ ## Credits
147
+
148
+ Built on [aiortc](https://github.com/aiortc/aiortc), [picamera2](https://github.com/raspberrypi/picamera2), and the [bitbang-python](https://github.com/richlegrand/bitbang-python) library. Plugin scaffold uses OctoPrint's [plugin API](https://docs.octoprint.org/en/master/plugins/).
149
+
150
+ ## Contributing
151
+
152
+ Issues and PRs are welcome.
@@ -0,0 +1,24 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ OctoPrint_BitBang.egg-info/PKG-INFO
6
+ OctoPrint_BitBang.egg-info/SOURCES.txt
7
+ OctoPrint_BitBang.egg-info/dependency_links.txt
8
+ OctoPrint_BitBang.egg-info/entry_points.txt
9
+ OctoPrint_BitBang.egg-info/requires.txt
10
+ OctoPrint_BitBang.egg-info/top_level.txt
11
+ octoprint_bitbang/__init__.py
12
+ octoprint_bitbang/__main__.py
13
+ octoprint_bitbang/app.py
14
+ octoprint_bitbang/camera.py
15
+ octoprint_bitbang/flip_track.py
16
+ octoprint_bitbang/index.html
17
+ octoprint_bitbang/octoprint_adapter.py
18
+ octoprint_bitbang/pi_camera_track.py
19
+ octoprint_bitbang/pi_h264_source.py
20
+ octoprint_bitbang/usb_camera_source.py
21
+ octoprint_bitbang/static/favicon.png
22
+ octoprint_bitbang/static/js/bitbang.js
23
+ octoprint_bitbang/templates/bitbang_navbar.jinja2
24
+ octoprint_bitbang/templates/bitbang_settings.jinja2
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ octoprint-bitbang = octoprint_bitbang.app:main
3
+
4
+ [octoprint.plugin]
5
+ bitbang = octoprint_bitbang
@@ -0,0 +1,4 @@
1
+ bitbang>=0.1.53
2
+ aiohttp>=3.8.0
3
+ Pillow>=9.0.0
4
+ numpy>=1.20.0
@@ -0,0 +1 @@
1
+ octoprint_bitbang
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: OctoPrint-BitBang
3
+ Version: 0.1.2
4
+ Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
+ Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/richlegrand/OctoPrint-BitBang
8
+ Project-URL: Source, https://github.com/richlegrand/OctoPrint-BitBang
9
+ Project-URL: Issues, https://github.com/richlegrand/OctoPrint-BitBang/issues
10
+ Keywords: octoprint,octoprint-plugin,bitbang,webrtc,remote-access,3d-printing,h264,raspberry-pi
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Plugins
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Framework :: Flask
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Printing
22
+ Classifier: Topic :: Multimedia :: Video
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: bitbang>=0.1.53
27
+ Requires-Dist: aiohttp>=3.8.0
28
+ Requires-Dist: Pillow>=9.0.0
29
+ Requires-Dist: numpy>=1.20.0
30
+ Dynamic: license-file
31
+
32
+
33
+ # OctoPrint-BitBang
34
+
35
+ This is an [OctoPrint](https://octoprint.org/) plugin that offers full remote access to your OctoPrint instance including live H.264 video over a single HTTPS shareable link. It uses [BitBang](https://github.com/richlegrand/bitbang) which creates a secure, fast peer-to-peer connection that requires no account, no subscription, port forwarding, tunnel, or VPN.
36
+
37
+ ![BitBang plugin](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/octoprint_bitbang.webp)
38
+
39
+
40
+ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
41
+
42
+ ## What you get
43
+
44
+ - **Full remote access:** You get full access from anywhere through a secure HTTPS URL. Configure, upload G-code, start jobs, see live video, etc.
45
+ - **One link, no account set-up:** Remote access, share the URL, share your printer.
46
+ - **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.
47
+ - **BitBang URL access is optional:** Video streaming works with local access through local network URL also.
48
+ - **Pi CSI camera or USB webcam:** Auto-detected (IMX477, IMX219, IMX708, or any V4L2-capable USB webcam).
49
+ - **Camera controls:** Camera selection, live brightness slider, fullscreen button, image flip H/V buttons, and resolution selection (VGA up to 720p).
50
+ - **Snapshots and timelapse:** Integrates with OctoPrint's `WebcamProviderPlugin` API -- snapshots are grabbed from the live stream, so no second camera pipeline to configure.
51
+ - **Mobile friendly:** BitBang URL works with phones/tablets.
52
+ - **PIN protection:** Optional PIN required to access the remote URL.
53
+
54
+ ## Installation
55
+
56
+ ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
57
+
58
+ In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
59
+
60
+ ### Plugin Manager, install from URL
61
+
62
+ **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
63
+
64
+ ```
65
+ https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
66
+ ```
67
+
68
+ Click **Install**, then restart OctoPrint when prompted.
69
+
70
+ ### pip
71
+
72
+ Inside your OctoPrint venv:
73
+
74
+ ```bash
75
+ pip install https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
76
+ ```
77
+
78
+ Restart OctoPrint.
79
+
80
+ ## Usage
81
+
82
+ 0. 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.
83
+ 1. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
84
+ 2. Choose camera from dropdown.
85
+
86
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
87
+
88
+ 3. Choose resolution.
89
+
90
+ ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
91
+
92
+ 4. Set a PIN (Optional).
93
+ 5. Save and **restart OctoPrint**.
94
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
95
+
96
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
97
+
98
+ ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
99
+
100
+
101
+ This URL allows remote access to your printer.
102
+
103
+ ## Configuration
104
+
105
+ All settings live in **Settings → BitBang**:
106
+
107
+ | Setting | Effect |
108
+ |---|---|
109
+ | Enabled | Toggle BitBang remote access |
110
+ | PIN | Optional 4+ digit PIN prompt on the remote URL |
111
+ | Camera | Auto-detect, or select from dropdown list |
112
+ | Resolution | VGA → HD (depending on what selected camera supports) |
113
+ | Flip horizontal / vertical | Flip video if necessary |
114
+
115
+ All settings take effect on OctoPrint restart. Full-screen button and brightness slider are overlaid on the video window (Control tab) and update immediately.
116
+
117
+ ## How it works
118
+
119
+ - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
120
+ - 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.
121
+ - 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.
122
+
123
+ ## Privacy
124
+
125
+ 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:
126
+
127
+ - **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).
128
+ - **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.
129
+ - **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.
130
+ - **No account, no tracking:** The plugin does not create an account, send telemetry, or upload usage data.
131
+ - **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.
132
+
133
+ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the full signaling protocol and identity specifications.
134
+
135
+ ## Supported hardware
136
+
137
+ - **Raspberry Pi 4** -- hardware H.264 on Pi 4 via V4L2 M2M; tested with IMX477, IMX219
138
+ - **Raspberry Pi 5** -- software H.264 via picamera2's `LibavH264Encoder`; 720p@30 comfortably
139
+ - **Generic Linux PC/laptop/SBC with webcam** -- software H.264 via aiortc
140
+ - **USB webcams** -- any device that offers a V4L2 capture format; aiortc software-encodes to H.264
141
+
142
+ ## License
143
+
144
+ MIT. See [LICENSE](LICENSE).
145
+
146
+ ## Credits
147
+
148
+ Built on [aiortc](https://github.com/aiortc/aiortc), [picamera2](https://github.com/raspberrypi/picamera2), and the [bitbang-python](https://github.com/richlegrand/bitbang-python) library. Plugin scaffold uses OctoPrint's [plugin API](https://docs.octoprint.org/en/master/plugins/).
149
+
150
+ ## Contributing
151
+
152
+ Issues and PRs are welcome.
@@ -0,0 +1,121 @@
1
+
2
+ # OctoPrint-BitBang
3
+
4
+ This is an [OctoPrint](https://octoprint.org/) plugin that offers full remote access to your OctoPrint instance including live H.264 video over a single HTTPS shareable link. It uses [BitBang](https://github.com/richlegrand/bitbang) which creates a secure, fast peer-to-peer connection that requires no account, no subscription, port forwarding, tunnel, or VPN.
5
+
6
+ ![BitBang plugin](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/octoprint_bitbang.webp)
7
+
8
+
9
+ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
10
+
11
+ ## What you get
12
+
13
+ - **Full remote access:** You get full access from anywhere through a secure HTTPS URL. Configure, upload G-code, start jobs, see live video, etc.
14
+ - **One link, no account set-up:** Remote access, share the URL, share your printer.
15
+ - **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.
16
+ - **BitBang URL access is optional:** Video streaming works with local access through local network URL also.
17
+ - **Pi CSI camera or USB webcam:** Auto-detected (IMX477, IMX219, IMX708, or any V4L2-capable USB webcam).
18
+ - **Camera controls:** Camera selection, live brightness slider, fullscreen button, image flip H/V buttons, and resolution selection (VGA up to 720p).
19
+ - **Snapshots and timelapse:** Integrates with OctoPrint's `WebcamProviderPlugin` API -- snapshots are grabbed from the live stream, so no second camera pipeline to configure.
20
+ - **Mobile friendly:** BitBang URL works with phones/tablets.
21
+ - **PIN protection:** Optional PIN required to access the remote URL.
22
+
23
+ ## Installation
24
+
25
+ ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
26
+
27
+ In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
28
+
29
+ ### Plugin Manager, install from URL
30
+
31
+ **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
32
+
33
+ ```
34
+ https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
35
+ ```
36
+
37
+ Click **Install**, then restart OctoPrint when prompted.
38
+
39
+ ### pip
40
+
41
+ Inside your OctoPrint venv:
42
+
43
+ ```bash
44
+ pip install https://github.com/richlegrand/OctoPrint-BitBang/archive/refs/tags/v0.1.1.zip
45
+ ```
46
+
47
+ Restart OctoPrint.
48
+
49
+ ## Usage
50
+
51
+ 0. 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.
52
+ 1. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
53
+ 2. Choose camera from dropdown.
54
+
55
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
56
+
57
+ 3. Choose resolution.
58
+
59
+ ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
60
+
61
+ 4. Set a PIN (Optional).
62
+ 5. Save and **restart OctoPrint**.
63
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
64
+
65
+ ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
66
+
67
+ ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
68
+
69
+
70
+ This URL allows remote access to your printer.
71
+
72
+ ## Configuration
73
+
74
+ All settings live in **Settings → BitBang**:
75
+
76
+ | Setting | Effect |
77
+ |---|---|
78
+ | Enabled | Toggle BitBang remote access |
79
+ | PIN | Optional 4+ digit PIN prompt on the remote URL |
80
+ | Camera | Auto-detect, or select from dropdown list |
81
+ | Resolution | VGA → HD (depending on what selected camera supports) |
82
+ | Flip horizontal / vertical | Flip video if necessary |
83
+
84
+ All settings take effect on OctoPrint restart. Full-screen button and brightness slider are overlaid on the video window (Control tab) and update immediately.
85
+
86
+ ## How it works
87
+
88
+ - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
89
+ - 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.
90
+ - 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.
91
+
92
+ ## Privacy
93
+
94
+ 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:
95
+
96
+ - **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).
97
+ - **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.
98
+ - **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.
99
+ - **No account, no tracking:** The plugin does not create an account, send telemetry, or upload usage data.
100
+ - **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.
101
+
102
+ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the full signaling protocol and identity specifications.
103
+
104
+ ## Supported hardware
105
+
106
+ - **Raspberry Pi 4** -- hardware H.264 on Pi 4 via V4L2 M2M; tested with IMX477, IMX219
107
+ - **Raspberry Pi 5** -- software H.264 via picamera2's `LibavH264Encoder`; 720p@30 comfortably
108
+ - **Generic Linux PC/laptop/SBC with webcam** -- software H.264 via aiortc
109
+ - **USB webcams** -- any device that offers a V4L2 capture format; aiortc software-encodes to H.264
110
+
111
+ ## License
112
+
113
+ MIT. See [LICENSE](LICENSE).
114
+
115
+ ## Credits
116
+
117
+ Built on [aiortc](https://github.com/aiortc/aiortc), [picamera2](https://github.com/raspberrypi/picamera2), and the [bitbang-python](https://github.com/richlegrand/bitbang-python) library. Plugin scaffold uses OctoPrint's [plugin API](https://docs.octoprint.org/en/master/plugins/).
118
+
119
+ ## Contributing
120
+
121
+ Issues and PRs are welcome.