← all projects

project

StreamCraft — GStreamer pipelines without the boilerplate

Extracted from a teleoperation server that was 1100 lines, most of it GStreamer setup. It came out at 570. Still real GStreamer underneath.

Date
Dec 2025
Role
Solo build — extracted from a production teleoperation server
Status
in progress
Built with
Python 3, GStreamer 1.0, webrtcbin, aiohttp, V4L2, PyPI packaging

GStreamer is extraordinary software. Its Python API is not — a thin wrapper over the C library, and it shows. A seven-element pipeline takes 45 lines to write, and when something breaks you get nothing back. Wrong property name, missing add() call, broken link: all of it fails silently, and the pipeline just produces no output.

I hit all of this building a robot teleoperation server. It worked, but by then it was 1100 lines and most of that wasn’t robot logic — it was the same GStreamer setup rewritten for every new pipeline.

So I pulled it out. There’s a PipelineBuilder where you write one element per line in the order data flows, a WebRTCSession handling signaling, ICE candidate buffering and the GLib-to-asyncio thread bridge, and V4L2PTZCamera for PTZ control with ranges read from the device. The server dropped to 570 lines. build() still hands back a real Gst.Pipeline.

What I took away

ICE candidate race conditions are invisible in local testing, because loopback connections negotiate fast enough that candidates always arrive after the offer. The bug only appears on real networks with real latency — easy to ship, hard to reproduce. Buffering premature candidates should be the default.

Bridging GLib and asyncio is safe only when the boundary is explicit and one-directional. Any ad-hoc crossing eventually deadlocks under load.

Build-time validation earns its implementation cost. The difference between “your pipeline built successfully but produces no output” and “property speed_presit does not exist on x264enc, did you mean speed_preset?” is an hour of debugging versus five seconds.

Open SourceReal-Time MediaRobotics