Skip to main content

Wormhole: Realtime Streaming Engine

Wormhole is a simple and hackable realtime video streaming engine for prototypes and projects alike! Stream amera feeds, video files, or machine learning output from anything like a Raspberry Pi to a fully fledged development environment!

wormhole_screenshot_spring

Try Out A Live Demo Here: https://demo.wormhole.hydranet.dev/

Features:

  • Multithreaded Flask & SocketIO backend
  • Camera and Video File Streaming!
  • Fast and scalable Motion JPEG and PNG streaming
  • Dynamic protocol negotiation between Wormhole servers and clients
  • Dynamic video modification through callbacks and views

What is Wormhole?

Wormhole is not meant to overtake established battle-tested libraries such as WebRTC or alike. Instead, Wholehole aims to be an extremely simple-to-use library wherever you need to share video (Pre-recorded or live from a camera) between two or more servers. The original design goal was so that Wormhole could be utilized during fast-paced development environments such as hackathons and other competitions, yet flexible and modular enough to be a one-stop-shop for your next AI video processing project, webcam streaming project, or simple video sharing project. From a Raspberry Pi camera server to annotated output from a Machine Learning pipeline, Wormhole can fit all your needs!

Installing Wormhole

To get started with Wormhole, you can just clone the project by running git clone git@github.com:RadioactiveHydra/Wormhole.git to your local machine. Once downloaded, run pip install -r wormhole/requirements.txt to install all the required dependencies.

NOTE: It is recommended that you install Wormhole in a virtual env! More instructions can be found here

Getting Started with Wormhole

NOTE: This is still WIP! API may change and/or be removed in future releases.

To start streaming from your camera, all you need to write is:

from wormhole import Wormhole
server = Wormhole()
server.stream(0)
server.join()

Thats It! Wormhole then handles setting up the server, launching the camera, and streaming the video frames! To stream from a video file instead, you can write the following:

from wormhole import Wormhole
server = Wormhole()
server.stream("path/to/video.mp4")
server.join()

As easy as that! To view the video stream in another python project, you can just run:

from wormhole import Wormhole
video = Wormhole().view("your.ip.address.here")

Again, thats it! Wormhole then handles setting up the client, negotiating the best streaming protocol to use, and viewing the video stream! To render the video to your screen, you can then run:

from wormhole.utils import render_video
render_video(video)

The video stream is also available online if you go to http://localhost:5000/wormhole/stream/default/mjpeg in your browser.

Of course, you may want to do more than what Wormhole offers by default. For that, you can check out some examples in the examples folder or in the Official Wormhole Example Server

Why develop Wormhole?

After rewriting the same video streaming codebase for the 5th hackathon/project in a row (Ref.1) (Ref.2) (Reg.3) (& More!), I thought it was time to sit down and write a universal streaming library for all my needs. Shopping around online did not yield any projects that fit my requirements, so I decided to build my own. Wormhole is designed so that it can not only be deployed in minutes seconds, but it is also flexible enough to do everything I need in a fully-fledged data streaming library.

Contributing to Wormhole

Wormhole's source code follows all PEP8 guidelines (except E501 for long lines). Also, most function arguments are typed so that the API is coherent and easy-to-use. Finally, Wormhole aims to keep compatibility for Python versions 3.8 and beyond. To contribute to Wormhole, you can either fork the project on GitHub or submit a pull request. If you have any questions or suggestions, feel free to join the discord server here: https://discord.gg/9QF2bPc.

Metadata

Release files for wormhole-streaming 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wormhole-streaming 1.0.0
File Size Uploaded
wormhole-streaming-1.0.0.tar.gz 227.8 kB Details

Release files / wormhole-streaming-1.0.0.tar.gz

Download URL wormhole-streaming-1.0.0.tar.gz
Size 227.8 kB
Tags Source
SHA-256 checksum
How to use checksums
928b7be2e833431b1692a758ae300a978abd5ea2b631954ea832fcb29ceb1eee
BLAKE2b-256 checksum
How to use checksums
436f5f607d7e5c25c9387e668be3b722f4bee5057bf7ffe4671588d21e35697d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page