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::{CaptureBuilder, QualityPreset, VideoEncoder, AudioEncoder};
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::Vaapi)
.with_audio_encoder(AudioEncoder::Opus)
.build()?;
// Start capturing
capture.start()?;
// Get receivers for encoded frames
let video_receiver = capture.take_video_receiver();
let audio_receiver = capture.take_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.