Caution
It is not part of the final solution and should not be used in production.
This repository contains a Python-based solution for real-time video processing using WebSockets. It enables you to stream video from an RTSP source or a video file, process each frame on the server, and display the processed frames on the client side using OpenCV. The system is designed to automatically reconnect if the connection is lost.
-
Activate your Python environment (if you have one).
-
Install the required dependencies using the following command:
pip install -r requirements.txt
There is more than one solution here since iit's simple server mock code snippets to help use debug and test functionnalities related to sending video to the oculus quest 2 via websocket.
Allowed Max to test video playback on the oculus quest 2 while developping the interface on it.
-
WebSocket-based API: The code uses WebSockets to establish communication between the server and client, allowing real-time video streaming and processing.
-
Easy Setup: Simply run the server and client scripts to start processing video frames. You can easily replace the RTSP link with your own source.
-
Customizable Image Processing: The server processes video frames frame by frame, allowing you to implement various image processing techniques. In the provided code, frames are converted to grayscale, but you can customize this to fit your needs.
Tip
In the rtsp-test-server/client.py, there is a filde link to a video that will play on the oculus quest 2. You will most likely need to find a video yourself and modify the path in that file.
-
Go to the
rtsp-test-serverfolder.cd rtsp-test-server -
Run the server script:
Note
This script runs the server that receives the video link from the client, processes each frame, and sends the processed frames back to the client.
python3 server.py- Run the client script:
Note
This script connects to the server, sends the video link to the server, receives the processed frames, and displays them using OpenCV.
python3 client.pyNote
These python scripts were helpful in testing the video display functionnality on the oculus quest 2 standalone via websocket. It's very similar to RTSP Test Server solution presented earlier.
- Go to the
websocket-video-test-serverfolder.websocket-video-test-server
Tip
To test the streaming with webcam onto the oculus quest, run the dummy_webcam_home_server.py script.
To test the streaming with a static video that loops non-stop, run the dummy_home_server.py script. It's mostly helpful to test that the video doesn't lag without having to be in front of the camera and moving.
- Either run the first one:
python3 dummy_webcam_home_server.pyor, the second one:
python3 dummy_home_server.py- Then, simply connect to it on port
8765via localhost.
Made with care by @Funnyadd, @ImprovUser, @cjayneb and @RaphaelCamara ❤️