Package: wormhole-streaming
Wormhole: Realtime Streaming EngineWormhole 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!Try Out A Live Demo Here:https://demo.wormhole.hydranet.dev/Features:Multithreaded Flask & SocketIO backendCamera and Video File Streaming!Fast and scalable Motion JPEG and PNG streamingDynamic protocol negotiation between Wormhole servers and clientsDynamic video modification through callbacks and viewsWhat 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 WormholeTo get started with Wormhole, you can just clone the project by runninggit clone git@github.com:RadioactiveHydra/Wormhole.gitto your local machine.
Once downloaded, runpip install -r wormhole/requirements.txtto install all the required dependencies.NOTE: It is recommended that you install Wormhole in a virtual env! More instructions can be foundhereGetting Started with WormholeNOTE: 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:fromwormholeimportWormholeserver=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:fromwormholeimportWormholeserver=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:fromwormholeimportWormholevideo=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:fromwormhole.utilsimportrender_videorender_video(video)The video stream is also available online if you go tohttp://localhost:5000/wormhole/stream/default/mjpegin 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 theexamplesfolder or in theOfficial Wormhole Example ServerWhy 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 inminutesseconds, but it is also flexible enough to do everything I need in a fully-fledged data streaming library.Contributing to WormholeWormhole's source code follows allPEP8guidelines (except E501 for long lines). Also, most function arguments aretypedso that the API is coherent and easy-to-use. Finally, Wormhole aims to keep compatibility forPython 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.