Open Source › Lamco Wayland › PipeWire

lamco-pipewire

High-performance PipeWire integration for Wayland screen capture, with DMA-BUF zero-copy

v0.10.3 · MIT/Apache-2.0

Hardware-accelerated frame transport

Once lamco-portal hands you a PipeWire file descriptor, lamco-pipewire turns it into a stream of frames. DMA-BUF zero-copy where the hardware supports it, software fallback where it doesn’t. Multi-monitor, multi-stream, with damage tracking and cursor extraction so downstream consumers only process what changed.

On PipeWire 0.10, on the 0.10.x line, now the maintained head. Older lines are superseded and 0.5.x stays frozen. Since 0.8.0 a consumer can await a frame (PipeWireThreadManager::frame_notify()) instead of polling, and cursor position and shape arrive on both Mutter and KWin. 0.9.0 adds opt-in frame buffer reuse (set_frame_buffer_reuse), and 0.10.0 targets each stream by its PipeWire serial, which PipeWire never reuses, where node ids can be. 0.10.0 changes public structs, so move it together with lamco-video 0.6.

Versions & compatibility

One maintained line, on the PipeWire 0.10 bindings. Older lines build on the same bindings and libpipewire floor, so moving up is a dependency bump plus the API changes noted below.

Line Use when System libpipewire
0.10.x · maintainedNew code. Streams target their node by PipeWire serial, which is never reused, when the portal gives one (0.10.0; adds a field to StreamConfig, StreamInfo and MonitorInfo, which breaks struct literals). Opt-in frame buffer reuse, so steady-state capture allocates nothing per frame (0.9.0). The frame callback runs on the main loop, so a capture from a systemd user service isn't killed by the real-time thread's time limit (0.10.3).≥ 0.3.62
0.9.x, 0.8.x · supersededNo longer maintained. Move to 0.10.x. 0.8.6 is the last release that builds on Rust 1.87.≥ 0.3.62

MSRV Rust 1.95 (edition 2024) from 0.10.2, which parking_lot 0.13 requires. 0.10.1 is the last release that builds on Rust 1.89.

What’s inside

Zero-copy DMA-BUF

Hardware-accelerated frame transfer when available

Multi-monitor streams

Concurrent handling of multiple monitor streams

Format negotiation

Automatic format selection with fallbacks

YUV conversion

Built-in NV12, I420, YUY2 → BGRA

Cursor extraction

Real cursor image (pixels), not just position, since the 0.8.x line, for remote desktop fidelity

Damage tracking

Region-based change detection for efficient encoding

Adaptive bitrate

Network-aware bitrate control for streaming

Error recovery

Automatic reconnection and stream recovery

Quick start

capture loop
use lamco_pipewire::{PipeWireManager, PipeWireConfig, StreamInfo, SourceType};

// Create manager with default configuration
let mut manager = PipeWireManager::with_default()?;

// Connect using the portal-provided file descriptor (from lamco-portal)
manager.connect(fd).await?;

// Create a stream for a monitor
let stream_info = StreamInfo {
    node_id: 42,
    position: (0, 0),
    size: (1920, 1080),
    source_type: SourceType::Monitor,
};

let handle = manager.create_stream(&stream_info).await?;

// Receive frames
if let Some(mut rx) = manager.frame_receiver(handle.id).await {
    while let Some(frame) = rx.recv().await {
        println!("Frame: {}x{}", frame.width, frame.height);
    }
}

manager.shutdown().await?;

Feature flags

Feature Default Description
dmabufyesDMA-BUF zero-copy support
yuvnoYUV format conversion utilities
cursornoHardware cursor extraction
damagenoRegion damage tracking
adaptivenoAdaptive bitrate control
fullnoAll features enabled