RealTimeStream is a real-time video streaming application that captures video from a camera, serves it via a Flask server, and allows clients to view the live stream. The project is structured to support both host and slave functionalities, enabling efficient video processing and streaming.
📦RealTimeStream
┣ 📂model
┃ ┣ 📜lane_seg.pt
┃ ┗ 📜yolov8s.pt
┣ 📂src
┃ ┣ 📂host
┃ ┃ ┣ 📜flask_video_stream.py
┃ ┃ ┗ 📜slave.py
┃ ┗ 📂slave
┃ ┃ ┣ 📂yolo
┃ ┃ ┃ ┗ 📜yolo.py
┃ ┃ ┗ 📜video_stream_client.py
┣ 📂test
┃ ┣ 📜install_gstreamer.sh
┃ ┣ 📜test_csi_camera.py
┃ ┣ 📜test_usb_camera.py
┃ ┗ 📜test_usb_media_dev.py
┗ 📜README.md
- Real-Time Video Streaming: Capture video from a camera and stream it over the network.
- Flask Server: Serve the video stream using a Flask-based server.
- Client Viewer: View the live video stream on a client machine.
- Model Integration: Incorporate pre-trained models for tasks like lane segmentation and object detection using YOLOv8.
- Python 3.8 or higher
- Pip package manager
- Git (optional, for cloning the repository)
- A camera connected to the host machine
- Network connectivity between host and client machines
-
Clone the Repository
git clone https://github.com/Ashington258/RealTimeStream cd RealTimeStream
-
Set Up a Virtual Environment (Optional but Recommended)
conda activate -n realtimestream python=3.10 # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Install GStreamer (For Testing)
The
test/install_gstreamer.sh
script is provided to install GStreamer dependencies required for testing.cd test chmod +x install_gstreamer.sh ./install_gstreamer.sh cd ..
-
Navigate to the Host Directory
cd src/host
-
Run the Slave Server
The
slave.py
script starts the Flask server that captures video from the camera and serves it.python slave.py
The server will start on
http://192.168.2.225:5000/video_feed
.
-
Navigate to the Slave Directory
cd src/slave
-
Run the Video Stream Client
The
video_stream_client.py
script connects to the Flask server and displays the live video stream.python video_stream_client.py
A window titled "Received Video Stream" will appear, displaying the live video. Press
q
to quit. -
go to the web to see the video stream http://192.168.2.225:5000/video_feed
-
run the yolo to see
The test
directory contains scripts to test various camera inputs and media devices.
-
Test CSI Camera
python test_csi_camera.py
-
Test USB Camera
python test_usb_camera.py
-
Test USB Media Device
python test_usb_media_dev.py
The model
directory contains pre-trained models used for video processing:
lane_seg.pt
: Pre-trained model for lane segmentation.yolov8s.pt
: Pre-trained YOLOv8 small model for object detection.
Ensure these models are correctly referenced in your source code for proper functionality.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
- 修改网络模式,网卡改AP模式,不依赖于路由器
- 笔记本端部署工程
- 训练集获取