A complete ML framework for upstream GStreamer. Object detection, pose estimation, depth, captioning, transcription, LLMs, and more — all as native GStreamer elements.
ML Engines
GStreamer Elements
Platforms
Same GStreamer elements, same pipelines. Pick the engine that matches your hardware via the engine-name property.
Default engine with full GPU and CPU support. TorchVision model zoo, HuggingFace Transformers, and Ultralytics YOLO — all battle-tested.
CPU and GPU inference via ONNX Runtime. Set engine-name=onnx and point to any .onnx model. Automatic YOLO anchor-free NMS decoding built in.
Intel-optimized inference on CPUs, iGPUs, and dGPUs. Set engine-name=openvino and point to an OpenVINO IR .xml model file.
Lightweight inference for edge and mobile. Set engine-name=tflite and point to a .tflite model. NHWC input by default — no format flags needed.
SavedModel format for TensorFlow ecosystem compatibility. Set engine-name=tensorflow and point to a TensorFlow SavedModel directory.
Compiler-optimized inference via Apache TVM. Set engine-name=tvm and point to a compiled TVM .so module.
Minimal-dependency inference with tinygrad. Set engine-name=tinygrad for lightweight GPU/CPU execution with automatic kernel optimization.
Apple Silicon native inference via MLX. Set engine-name=mlx for unified memory GPU/CPU execution on M-series chips. Supports mlx-lm text generation.
Meta’s ExecuTorch runtime for on-device inference. Set engine-name=executorch and point to a .pte model.
GGUF model inference via llama-cpp-python. Set engine-name=llamacpp for efficient quantized LLM inference on CPU or GPU.
HuggingFace Candle Rust-based inference via Python bindings. Set engine-name=candle for minimal-overhead safetensors model execution.
Google JAX with XLA compilation. Set engine-name=jax for JIT-compiled inference with automatic hardware acceleration on GPU, TPU, or CPU.
AMD’s graph inference engine for ROCm GPUs. Set engine-name=migraphx and point to an .onnx model. Optimized compilation with fp16 quantization support.
Compiler-based ML runtime (AMD/Google). Set engine-name=iree for optimized inference on ROCm, Vulkan, CUDA, or CPU via ahead-of-time compilation.
Lightweight inference with Vulkan GPU support. Set engine-name=ncnn for GPU inference on AMD, NVIDIA, or Intel — no ROCm or CUDA required.
Drop-in GStreamer elements for every ML task. Use them in any pyml-launch pipeline or Python app.
pyml_objectdetector
All TorchVision detection models plus ONNX, OpenVINO, TFLite, and TensorFlow engines. Faster R-CNN, SSD, and more.
Visionpyml_yolo
YOLO11 object detection with built-in multi-object tracking. Real-time bounding boxes with track IDs.
Visionpyml_maskrcnn
Mask R-CNN pixel-level instance segmentation with per-object masks and bounding boxes.
Visionpyml_yolo_pose
COCO 17-keypoint skeleton detection with YOLO pose models. Optional in-element skeleton visualization.
Visionpyml_depth
DepthAnything V2 monocular depth estimation. Multiple colormaps (inferno, jet, viridis, plasma, magma) and frame-stride support.
Visionpyml_clip
CLIP and SigLIP zero-shot classification with user-defined labels. No fixed label set — set labels at pipeline launch.
Visionpyml_classifier
All TorchVision classifiers including ResNet, EfficientNet, and more. GPU or CPU inference.
Visionpyml_caption_qwen
Qwen2.5-VL vision-language model for video captioning and visual understanding. Supports caption history, LLM summarization, and AWQ quantization.
Visionpyml_whispertranscribe
OpenAI Whisper-based transcription with language detection, translation to English, and initial prompt support.
Audiopyml_whisperlive
Combined live transcription with LLM integration. Transcribe, translate, and generate speech in one pipeline.
Audiopyml_vad
Silero VAD with configurable threshold. Standalone metadata mode or gating mode to mute silent audio.
Audiopyml_coquitts
Coqui TTS engine for high-quality speech synthesis from transcribed or translated text.
Audiopyml_whisperspeechtts
WhisperSpeech-based TTS for natural-sounding speech generation from text input.
Audiopyml_demucs
Demucs source separation for isolating vocals from background audio. Clean input for downstream transcription.
Audiopyml_mariantranslate
Helsinki-NLP Marian machine translation. Hundreds of language pairs from HuggingFace model hub.
Languagepyml_llm
Run HuggingFace LLMs (Phi-2, Qwen3, etc.) as GStreamer elements. Text-in, text-out with system prompts.
Languagepyml_llm_remote
Send text to a remote LLM via HTTP. Works with Ollama, OpenAI-compatible APIs. No local GPU required.
Languagepyml_stablediffusion
Stable Diffusion image generation from text prompts. Outputs PNG frames as GStreamer buffers.
Languagepyml_overlay
Render detection metadata as bounding boxes, labels, and tracking IDs directly on video frames.
Utilitypyml_kafkasink
Serialize model inference metadata to Apache Kafka with JSON schema validation.
Utilitypyml_streammux
Multiplex multiple video streams into a single batched stream for efficient multi-stream inference.
Utilitypyml_streamdemux
Split a batched stream back into individual streams for per-stream display or processing.
Utilitypyml_inference
Run any model through any engine and inspect raw output. Useful for testing and debugging new models.
Utilitypyml_video_transform
Pre/post-processing transforms for video frames within ML pipelines.
Utilitypyml_sepformer
SpeechBrain SepFormer model for separating overlapping speakers. Clean single-speaker audio from mixed recordings.
Audiopyml_sam
Meta SAM2 zero-shot segmentation. Point, box, or auto prompts. Outputs per-object masks as GstAnalytics metadata.
Visionpyml_ocr
EasyOCR and TrOCR text detection and recognition. Outputs bounding boxes and recognized text in GstAnalytics metadata.
Visionpyml_face
RetinaFace detection with ArcFace embedding-based recognition. Configurable face gallery for identification.
Visionpyml_optical_flow
RAFT dense optical flow estimation. Outputs per-pixel motion vectors as color-coded visualization or raw flow fields.
Visionpyml_superres
Real-ESRGAN image upscaling (2×/4×). Tile-based processing for arbitrary input sizes with configurable overlap.
Visionpyml_action
SlowFast and X3D temporal action recognition over sliding windows. Classifies activities across configurable frame clips.
Visionpyml_anomaly
PatchCore visual anomaly detection for manufacturing QA. Generates anomaly score heatmaps with configurable thresholds.
Visionpyml_clap
LAION CLAP zero-shot audio classification. User-defined text labels matched against audio — no fixed label set.
Audiopyml_vlm
Generic VLM element supporting LLaVA, InternVL, and more. Visual question answering with configurable prompts.
Visionpyml_embedding
Extract dense vector embeddings from video frames using CLIP, DINOv2, or any vision backbone. Outputs to buffer metadata or file.
Visionpyml_tracker
Standalone SORT/ByteTrack tracker. Reads upstream detection metadata and assigns persistent track IDs — works with any detector.
Utilitypyml_alert
Rule-based alerting triggered by upstream detections. Webhook, MQTT, and metadata output with per-rule cooldowns.
UtilityProduction features that make GStreamer Python ML more than a demo — it’s a framework.
Built-in tracking with pyml_yolo. Set track=True and get persistent track IDs across frames with no extra elements.
Switch engines with a single property: engine-name=onnx, engine-name=openvino, engine-name=tflite, engine-name=tensorflow. Same pipeline, different hardware.
Use pyml_streammux and pyml_streamdemux to batch multiple video streams through a single model for GPU-efficient multi-camera inference.
Voice Activity Detection with gate=true silences non-speech audio before transcription, reducing Whisper latency and false positives.
Chain pyml_caption_qwen (Qwen2.5-VL-3B-Instruct-AWQ) with coalescehistory and pyml_llm (Qwen3-0.6B) for real-time video narration with caption history summarization.
Demucs vocal isolation (pyml_demucs) cleans audio before transcription for dramatically better accuracy in noisy environments.
Chain pyml_whispertranscribe → pyml_mariantranslate → pyml_coquitts for end-to-end speech-to-speech translation in one pipeline.
Stream inference metadata to Kafka topics with pyml_kafkasink. JSON schema validation, configurable broker and topic, Docker-ready setup.
Reduce compute with frame-stride=N on heavy elements like depth estimation. Process every Nth frame and pass others through unchanged.
Set batch-size=4 on detection elements to batch multiple frames into a single GPU call for higher throughput.
Set device=cuda or device=cuda:0 on any element. Automatic GPU memory management and model caching.
Automatic YOLO anchor-free NMS decoding with post-process=anchor_free. No manual post-processing code required.
GStreamer Python ML spans vision, audio, and language — all composable in standard GStreamer pipelines.
Faster R-CNN, SSD, YOLO11 with tracking. Five inference engines. GPU batch processing.
See elements →COCO 17-keypoint human pose with YOLO. Skeleton visualization or metadata-only mode.
See elements →DepthAnything V2 monocular depth. Side-by-side with original, multiple colormaps, frame stride.
See elements →CLIP and SigLIP for open-vocabulary classification. Custom labels, top-k, confidence thresholds.
See elements →Whisper transcription, live transcription, VAD gating, audio separation, and multi-language support.
See elements →Text generation with LLMs, image generation with Stable Diffusion, text-to-speech with multiple engines.
See elements →Real pipelines you can run right now. Every example works with pyml-launch.
YOLO11 detection with multi-object tracking and overlay.
python pyml-launch.py filesrc location=video.mp4 \
! decodebin ! videoconvertscale \
! video/x-raw,width=640,height=480 \
! pyml_yolo model-name=yolo11m \
device=cuda:0 track=True \
! pyml_overlay ! videoconvert \
! autovideosink
Object detection with torch.compile for optimized steady-state throughput.
python pyml-launch.py filesrc location=video.mp4 \
! decodebin ! videoconvert ! videoscale \
! video/x-raw,width=640,height=480 \
! pyml_objectdetector \
model-name=fasterrcnn_resnet50_fpn \
device=cuda compile=True \
! pyml_overlay ! videoconvert \
! autovideosink
YOLO pose with skeleton visualization on frame.
python pyml-launch.py filesrc location=video.mp4 \
! decodebin ! videoconvert \
! videoscale ! video/x-raw,width=640,height=480 \
! pyml_yolo_pose model-name=yolo11n-pose \
device=cuda \
! videoconvert ! autovideosink
DepthAnything V2 monocular depth with colormap.
python pyml-launch.py filesrc location=video.mp4 \
! decodebin ! videoconvert \
! videoscale ! video/x-raw,width=640,height=480 \
! pyml_depth device=cuda \
model-name=depth-anything/\
Depth-Anything-V2-Small-hf \
! videoconvert ! autovideosink
Classify video frames with custom text labels.
python pyml-launch.py filesrc location=video.mp4 \
! decodebin ! videoconvert \
! videoscale ! video/x-raw,width=640,height=480 \
! pyml_clip device=cuda \
labels="person, car, dog, cat" \
top-k=3 \
! pyml_overlay ! videoconvert \
! autovideosink
Korean audio to English text transcription.
python pyml-launch.py filesrc location=audio.wav \
! decodebin ! audioconvert \
! pyml_whispertranscribe \
device=cuda language=ko \
translate=yes \
! fakesink
Voice activity gating before Whisper for lower latency.
python pyml-launch.py filesrc location=audio.wav \
! decodebin ! audioconvert \
! audioresample \
! audio/x-raw,format=S16LE,\
rate=16000,channels=1 \
! pyml_vad threshold=0.6 gate=true \
! pyml_whispertranscribe device=cuda \
! fakesink
Run a HuggingFace LLM as a GStreamer element.
python pyml-launch.py filesrc location=prompt.txt \
! pyml_llm device=cuda \
model-name="microsoft/phi-2" \
! fakesink
Text prompt to PNG image generation.
python pyml-launch.py filesrc location=prompt.txt \ ! pyml_stablediffusion device=cuda \ ! pngenc \ ! filesink location=output.png
Batch two video streams through one model.
python pyml-launch.py \ filesrc location=cam1.mp4 ! decodebin \ ! videoconvertscale \ ! video/x-raw,width=640,height=480 \ ! pyml_streammux name=mux \ filesrc location=cam2.mp4 ! decodebin \ ! videoconvertscale \ ! video/x-raw,width=640,height=480 \ ! mux. \ mux. ! pyml_yolo device=cuda \ ! pyml_streamdemux name=demux \ demux. ! autovideosink \ demux. ! autovideosink
Pick your platform and start building ML pipelines.
# Ubuntu 24.04 (Python 3.12) or Ubuntu 26.04+ (Python 3.14) # Install system packages sudo apt update && sudo apt -y upgrade sudo apt install -y python3-pip python3-venv \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad python3-gst-1.0 \ gstreamer1.0-python3-plugin-loader libcairo2 libcairo2-dev git # Clone and set up git clone https://github.com/collabora/gst-python-ml.git cd gst-python-ml # Create venv (must use system Python to match GStreamer) python3 -m venv --system-site-packages .venv source .venv/bin/activate # Install PyTorch with CUDA support pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 # Install gst-python-ml pip install -e . # Optional: flash-attention (must match python/torch/cuda versions) # pip install ./flash_attn-*.whl # Set plugin path and run export GST_PLUGIN_PATH=$PWD/plugins:$GST_PLUGIN_PATH python pyml-launch.py filesrc location=data/people.mp4 ! decodebin \ ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 \ ! pyml_yolo model-name=yolo11m device=cuda ! pyml_overlay \ ! videoconvert ! autovideosink
# Fedora 42+ (ships Python 3.14) # Install RPM Fusion (for NVIDIA) sudo dnf install https://download1.rpmfusion.org/free/fedora/\ rpmfusion-free-release-42.noarch.rpm \ https://download1.rpmfusion.org/nonfree/fedora/\ rpmfusion-nonfree-release-42.noarch.rpm sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y # Install system packages sudo dnf install -y python3-pip python3-devel \ cairo cairo-devel cairo-gobject-devel pkgconfig git \ gstreamer1-plugins-base gstreamer1-plugins-good \ gstreamer1-plugins-bad-free python3-gstreamer1 # Clone and set up git clone https://github.com/collabora/gst-python-ml.git cd gst-python-ml # Create venv (must use system Python to match GStreamer) python3 -m venv --system-site-packages .venv source .venv/bin/activate # Install PyTorch with CUDA support pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 # Install gst-python-ml pip install -e . # Optional: flash-attention (must match python/torch/cuda versions) # pip install ./flash_attn-*.whl # Set plugin path and run export GST_PLUGIN_PATH=$PWD/plugins:$GST_PLUGIN_PATH
# Build Docker container (Fedora 42 — recommended, has Python 3.14) docker build -f ./Dockerfile_fedora42 -t fedora42:latest . # Or Ubuntu 26.04 (Python 3.14) docker build -f ./Dockerfile_ubuntu26 -t ubuntu26:latest . # Or Ubuntu 24.04 (Python 3.12) docker build -f ./Dockerfile_ubuntu24 -t ubuntu24:latest . # Run with GPU docker run -v ~/src/gst-python-ml/:/root/gst-python-ml \ -it --rm --gpus all --name fedora42 fedora42:latest /bin/bash # Run without GPU docker run -v ~/src/gst-python-ml/:/root/gst-python-ml \ -it --rm --name fedora42 fedora42:latest /bin/bash # Inside container: set up venv and install python3 -m venv --system-site-packages .venv source .venv/bin/activate pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 pip install -e .
# 1. Install GStreamer MSVC x86_64 (runtime + development) # https://gstreamer.freedesktop.org/download/#windows # 2. Set environment variables [Environment]::SetEnvironmentVariable("PATH", "C:\gstreamer\1.0\msvc_x86_64\bin;" + $env:PATH, "User") [Environment]::SetEnvironmentVariable("GST_PLUGIN_PATH", "D:\gst-python-ml\plugins", "User") # 3. Install Python 3.12+ and PyGObject pip install gstreamer-python # 4. Install CUDA PyTorch (optional) pip install torch torchvision torchaudio \ --index-url https://download.pytorch.org/whl/cu128
Create custom GStreamer elements that inherit from gst-python-ml base classes. Full access to the engine abstraction, model loading, and pipeline integration.
from base_objectdetector import BaseObjectDetector from gi.repository import GObject, Gst class MyDetector(BaseObjectDetector): __gstmetadata__ = ( "My Custom Detector", "Video/Filter", "A custom object detector", "Your Name", ) GObject.type_register(MyDetector) __gstelementfactory__ = ("my_detector", Gst.Rank.NONE, MyDetector)
# Framework first (provides base classes on sys.path), custom second export GST_PLUGIN_PATH=$HOME/src/gst-python-ml/plugins:$HOME/my_plugins:$GST_PLUGIN_PATH export PYTHONPATH=$HOME/my_plugins/python:$PYTHONPATH # Verify your element gst-inspect-1.0 my_detector
BaseObjectDetector · BaseTransform · BaseClassifier · BaseCaption · BaseLLM · BaseTranscribe · BaseTranslate · BaseTTS · BaseSeparate
Engine selection · model loading · device management · buffer handling · metadata propagation · all GObject properties
From your laptop to a GPU server — GStreamer Python ML works wherever GStreamer runs.
Native host installation with distribution GStreamer packages. Full GPU support with NVIDIA CUDA. Tested on Ubuntu 24.04, Ubuntu 26.04, and Fedora 42.
Pre-built Dockerfiles for Ubuntu 24.04, Ubuntu 26.04, and Fedora 42. NVIDIA Container Toolkit for GPU pass-through. CPU-only mode available.
GStreamer MSVC runtime with Python 3.12+. CUDA GPU support via PyTorch. PowerShell setup scripts included.
Read about the technology behind GStreamer Python ML.
A deep dive into how gst-python-ml enables ML-powered analytics in GStreamer pipelines — from object detection to video captioning.
Read more →See gst-python-ml in action — real-time YOLO object tracking on a live soccer match.
GStreamer Python ML is free, open source (LGPLv3), and ready for production. Build ML-powered video and audio pipelines today.
Supported by Collabora · Open to contributions from everyone