Skip to main content
PyTrickle is a Python framework for real-time video and audio streaming over the trickle protocol. It is the canonical way to implement BYOC containers on Livepeer. PyTrickle reached production use in Phase 4 (January 2026) and is maintained at https://github.com/livepeer/pytrickle.
PyTrickle is early-stage software (3 stars, 20 open issues as of April 2026). The API is stable enough for production use (Embody SPE and Streamplace use it) but the project is under active development. Check the GitHub repository for the latest API changes before building against it.

Installation

Requirements:
  • Python 3.8 or later
  • PyTorch (for GPU tensor support)
  • FFmpeg (for encoding/decoding)
  • NVIDIA GPU recommended for inference workloads

FrameProcessor

FrameProcessor is the base class you subclass to implement your AI model. Override the async methods for the workload types your container handles.

VideoFrame

VideoFrame wraps a decoded video frame as a PyTorch tensor with metadata. Key methods:

AudioFrame

StreamServer

StreamServer wraps your FrameProcessor with the REST API contract required by the Livepeer gateway. You do not implement the endpoints manually.
StreamServer automatically exposes four endpoints on the configured port:

TrickleClient

For direct trickle protocol connections without the REST API layer:

Built-in monitoring

FrameProcessor exposes metrics via get_metrics():
These metrics are also exposed on the /api/stream/status endpoint when running via StreamServer.

BYOC Guide

Full BYOC walkthrough: implementing FrameProcessor, building a container, and deploying to the network.

Build with ComfyStream

ComfyStream uses PyTrickle internally — use it if your model is a ComfyUI workflow.
Last modified on May 22, 2026