google-mediapipe-gst-python-implementation is a high-performance, real-time video processing pipeline that:
- Streams frames from a GStreamer pipeline
- Batches frames efficiently into shared memory
- Distributes batches across multiple processes using multiprocessing queues
- Supports scalable, parallel feature extraction (e.g. using Mediapipe)
This project is designed for low-latency, high-throughput computer vision pipelines.
.
├── gaze_tracker.py # gaze tracking function
├── utils.py # Shared utilities (e.g., batch handling, frame reshaping)
├── requirements.txt # Python package dependencies
└── README.md # Project documentation
- ✅ Real-time GStreamer frame ingestion
- ✅ Batch processing for improved memory and CPU efficiency
- ✅ Shared memory transport (zero-copy frame passing)
- ✅ Multi-process consumer architecture (supports parallel Mediapipe tasks)
- ✅ Easily configurable batch size and frame resolution
- ✅ Scalable for multi-camera or high-frame-rate pipelines
- Python 3.8+
- GStreamer 1.18+
Install Python dependencies:
pip install -r requirements.txt
Example requirements.txt
:
numpy
opencv-python
matplotlib
-
Producer:
- Reads frames from the GStreamer pipeline using appsink
- Writes frames into a shared memory batch buffer
- Signals when batches are ready via a lightweight queue
-
Consumers:
- Listen for batch-ready signals
- Read batches directly from shared memory (zero-copy)
- Process each frame independently (e.g. using Mediapipe feature extraction)
Run the pipeline:
python manage.py runserver
Customize:
- Adjust
BATCH_SIZE
andFRAME_SHAPE
inutils.py
- Integrate your own Mediapipe feature extraction functions in
consumer.py
pipeline = Gst.parse_launch('videotestsrc ! video/x-raw,format=BGR,width=1280,height=720 ! appsink name=sink')
You can easily replace this with your own GStreamer input (webcam, video file, live stream, etc.)
- Support for double-buffering to enable full parallel read/write cycles
- Multi-camera ingestion
- GPU-accelerated processing support
- Optional Kafka or distributed queue integration
This project is licensed under the MIT License.
Pull requests and improvements are welcome! Please open an issue first to discuss major changes.
Built by http://github.com/KarthikMgk for scalable, real-time vision pipelines.