Welcome to the Low-Latency Video Streaming project! π This repository showcases a sleek, efficient, and ultra-smooth streaming solution, powered by FastAPI on the backend and WebCodecs API on the frontend. It's fast β‘, efficient π¦, and perfect for those craving real-time streaming magic.
β¨ Lightning-Fast Performance: Leverages H.264 encoding and WebCodecs API to reduce delays dramatically.
β¨ Backend Powered by FastAPI: A robust and scalable backend to handle video streaming via WebSockets.
β¨ Minimal Bandwidth Usage: Achieves significant savings with delta frames as small as 0.01 KB.
β¨ Web Worker Magic: Offloads decoding tasks to web workers to keep the UI buttery smooth.
β¨ Scalable Design: Works seamlessly across different network conditions.
- H.264 Encoding: Frames are encoded using the H.264 codec, ensuring high compression and low latency.
- WebSocket Stream: The backend streams the encoded frames (Key + Delta frames) via WebSockets for real-time delivery.
- Optimized Performance: Includes
-tune zerolatencyto minimize buffering for live streaming scenarios.
- Web Workers: Decoding tasks are offloaded to a dedicated web worker, ensuring a smooth user experience.
- Canvas Rendering: Decoded frames are rendered directly onto a
<canvas>element for real-time updates.
Letβs crunch the numbers π₯:
| Method | Bandwidth @ 30 FPS π‘ |
|---|---|
| Naive Approach | ~7.2 MBps (JPEG multipart) π¨ |
| This Project π | ~250 KB (Key) + 20 Γ 0.01 KB (Delta) β 250.2 KBps π€― |
π‘ Result: Our approach uses only 3.5% of the bandwidth required by the naive method. That's like sipping a peanut smoothie instead of guzzling down a whole barrel! π₯π
If you've read this far, itβs either because:
- Youβre building the next big streaming app.
- You're avoiding something important at work.
- You really, really love peanuts. π₯
Whatever the reason, this project is here to make your life easier (and more entertaining).
If this project helped you, or if you just enjoyed the peanut jokes, give this repo a β! And remember, if youβre still reading, maybe itβs time to start building that streaming app youβve been dreaming about? π
If you want to read more about this project, follow this link
Happy Streaming! π