Expand description
§waycap-rs
waycap-rs
is a high-level Wayland screen capture library with hardware-accelerated encoding.
It provides an easy-to-use API for capturing screen content on Wayland-based Linux systems,
using PipeWire for screen capture and hardware accelerated encoding for both video and audio.
§Features
- Hardware-accelerated encoding (VAAPI and NVENC)
- No Copy approach to encoding video frames utilizing DMA Buffers
- Audio capture support
- Multiple quality presets
- Cursor visibility control
- Fine-grained control over capture (start, pause, resume)
§Platform Support
This library currently supports Linux with Wayland display server and requires the XDG Desktop Portal and PipeWire for screen capture.
§Example
use waycap_rs::pipeline::builder::CaptureBuilder;
use waycap_rs::types::config::{AudioEncoder, QualityPreset, VideoEncoder};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a capture instance
let mut capture = CaptureBuilder::new()
.with_audio()
.with_quality_preset(QualityPreset::Medium)
.with_cursor_shown()
.with_video_encoder(VideoEncoder::H264Vaapi)
.with_audio_encoder(AudioEncoder::Opus)
.build()?;
// Start capturing
capture.start()?;
// Get receivers for encoded frames
let video_receiver = capture.get_video_receiver();
let audio_receiver = capture.get_audio_receiver()?;
// Process frames as needed...
// Stop capturing when done
capture.close()?;
Ok(())
}
Modules§
Structs§
- Capture
- Main capture instance for recording screen content and audio.
- Capture
Controls - Controls for the capture, allows you to pause/resume processing
- DmaBuf
Encoder - “Encoder” which provides the raw DMA-Buf pointers directly.
- Nvenc
Encoder - Encoder which provides frames encoded using Nvenc
- Ready
State - State of audio/video readiness, used internally
- Resolution
- Target Screen Resolution
- Rgba
Image Encoder - “Encoder” which outputs image::RgbaImage
- Vaapi
Encoder - Encoder which encodes frames using Vaapi
Enums§
Constants§
Traits§
- Video
Encoder - Base trait for video encoders. defines the output type of an encoder.