longpipe 0.0.3 → 0.0.4

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 (2) hide show
  1. package/README.md +30 -33
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,11 @@
1
- # Longpipe 🐲
1
+ # Longpipe 🐉
2
+
3
+ Fast, high quality virtual effects in the browser
4
+
5
+
6
+ <img width="640" height="360" alt="0087" src="https://github.com/user-attachments/assets/525f983c-6b3d-43ff-aedf-b1203e2955c1" />
7
+
2
8
 
3
- Hardware-accelerated real-time AI media processing in the browser.
4
9
 
5
10
  Try the live demo: [longpipe.dev/demo](https://longpipe.dev/demo)
6
11
 
@@ -8,15 +13,10 @@ Try the live demo: [longpipe.dev/demo](https://longpipe.dev/demo)
8
13
 
9
14
  ## Features
10
15
 
11
- - Real-time portrait matting / virtual backgrounds in the browser
12
- - WebGPU compute shaders with a WebGL2 fragment-shader fallback
13
- - Worker-by-default — all model and render work runs off the main thread
14
- - Background options: blur, image, video, solid color, or none (passthrough)
15
- - Six trained model presets covering hardware from MacBook Pro down to Chromebook
16
- - Auto-tuned at init: picks the best preset for the current device, plus the optimal frame transport for the current browser
17
- - Adaptive at runtime: swaps to a smaller preset when FPS drops, larger when there's headroom
18
- - Single-call API: `new EffectsPipeline(inputStream, { background })` returns a `MediaStream`
19
- - Audio passthrough by default
16
+ - **Support across browsers:** Works on every browser, simplifying dozens of browser inconsistencies in one simple API.
17
+ - **Performance:** Longpipe was built from the ground up to work as well on 10-year-old netbooks as it does on the latest MacBook Pro.
18
+ - **Adaptivity:** Longpipe has several model variants (xl to xs), auto-selecting to provide the best quality while maintaining 30 fps.
19
+ - Built by the founder of [Vectorly](https://www.crunchbase.com/organization/vectorly), a commercial effects SDK acquired in 2021. A ground-up redesign for the WebGPU era, with years of production lessons baked in.
20
20
 
21
21
  ## Install
22
22
 
@@ -41,6 +41,25 @@ await pipeline.ready // optional — resolves once the effect i
41
41
 
42
42
  `pipeline.stream` is wired synchronously and emits the unprocessed input until the model is ready (~1–3s on cold start, depending on hardware), so the consumer sees live video the whole time.
43
43
 
44
+
45
+ ## Models
46
+
47
+ Longpipe uses custom-trained models built with an EfficientNetLite encoder, and a UNet style decoder, breaking it down into 7 different variations/performance presets, which vary number of channels, encoder size as well as input size. Even at 0.0.1, the first version of Longpipe (across all variants) have much higher segmentation accuracy than alternative open source models like Mediapipe and Bodypix, while also having much better real-world performance due to implmenting the model as pure WebGPU/WebGL shaders and using a zero-copy fully GPU pipeline.
48
+
49
+ ### Quality
50
+ Using average alpha pixel error on the P3M-10K valdation dataset (499 landscape images), all variants of Longpipe surpassed mediapipe in both MAE and IoU.
51
+
52
+ <img width="640" alt="lp-quality" src="https://github.com/user-attachments/assets/c7044937-95af-496f-893a-a05a50d7c914" />
53
+
54
+ ### Performance
55
+ With the pure GPU zero copy pipeline, Longpipe achieves better real world performance than mediapipe using much larger models.
56
+
57
+ <img width="640" alt="lp-speed" src="https://github.com/user-attachments/assets/ce658b8d-dc62-4d6b-90f8-cd62dfef2a59" />
58
+
59
+
60
+
61
+
62
+
44
63
  ## Backgrounds
45
64
 
46
65
  The `background` option takes a wide set of inputs and normalizes them internally:
@@ -132,23 +151,7 @@ new EffectsPipeline(stream, {
132
151
 
133
152
  Works on Chromium (Chrome, Edge), Firefox, and Safari (desktop and iOS). WebGPU is used when available; WebGL2 is the fallback. Longpipe picks the optimal video frame transport for each browser internally — `MediaStreamTrackProcessor`, `transferControlToOffscreen` + `captureStream`, or an `ImageBitmap` shuttle as universal fallback — all invisible to the caller.
134
153
 
135
- ## Problem
136
-
137
- If you want real-time AI media processing in the browser — virtual backgrounds, background noise removal, face filters — one of the few open-source options is [MediaPipe](https://github.com/google-ai-edge/mediapipe). MediaPipe ships some great open-source models, but they all run in WebAssembly, and using them effectively still requires a fair amount of hardware-accelerated pre- and post-processing on top.
138
-
139
- ![MediaPipe pipeline diagram](https://github.com/user-attachments/assets/62932072-c5b2-445e-b5d8-a2bd5bb72920)
140
-
141
- In 2021, I built an SDK to implement [hardware-accelerated neural networks directly in WebGL](https://medium.com/vectorly/building-a-more-efficient-background-segmentation-model-than-google-74ecd17392d5) that proved much more efficient than the MediaPipe implementation. It was popular, but it was a commercial SDK — the company was acquired and the technology was never opened up.
142
154
 
143
- In 2022, Google Meet adopted a similar approach with their own [hardware-accelerated networks](https://research.google/blog/high-definition-segmentation-in-google-meet/), but that was never open-sourced either.
144
-
145
- As of late 2025, MediaPipe is still the state of the art for open-source real-time browser ML, and nothing better has come along.
146
-
147
- ## Solution
148
-
149
- With WebGPU shipping and WebNN on the way, it is now possible to build efficient implementations of popular real-time media-processing features — background segmentation, audio filtering — by combining hardware-accelerated neural networks in WebGPU/WebNN with efficient pre- and post-processing, so developers can plug in features like virtual backgrounds and noise removal without worrying about the details.
150
-
151
- Longpipe is that SDK.
152
155
 
153
156
  ## How it works
154
157
 
@@ -174,12 +177,6 @@ Six trained presets cover the hardware range:
174
177
 
175
178
  Training scripts, fixture generation, and the weight export pipeline are not yet documented here — coming soon.
176
179
 
177
- ## Acknowledgements
178
-
179
- - [EfficientNet-Lite](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite) for the backbone architecture.
180
- - [Google Meet HD Segmentation research](https://research.google/blog/high-definition-segmentation-in-google-meet/) for the architectural choices that hold up on accelerators.
181
- - [WebGPU](https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API) for making compute-heavy work in the browser realistic.
182
- - [Mediabunny](https://mediabunny.dev/) — a colleague's project and a model for what an open-source media SDK with sponsorship-backed development can look like.
183
180
 
184
181
  ## Roadmap
185
182
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "longpipe",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Open-source WebGPU/WebGL2 video effects SDK — virtual backgrounds, background blur, portrait matting in real time in the browser.",
5
5
  "type": "module",
6
6
  "sideEffects": false,