Phase 1 MVP implementation of wl-webrtc: Wayland screen capture tool with hardware-accelerated VAAPI H.264 encoding and WebTransport output. Includes all 9 runtime bug fixes from code audit (fix-audit-issues plan): CRITICAL: - C2: h264_metadata BSF with repeat_sps/repeat_pps in encode pipeline - C4: FpsLimit wired as timing gate in on_copy_complete HIGH: - C3+A2: DRM device discovery via dmabuf feedback MainDevice event, unified resolve_drm_path() helper (CLI > compositor > auto > fallback) - H2: Separate physical_size (mm) from mode_size (pixels) in wl_output - H1+A3: Multi-output warning + named-output-not-found error MEDIUM: - M5: tv_sec u32->u64 to avoid Y2106 timestamp truncation - M4: Guard against SHM Buffer event (DMA-BUF only) Key components: - src/avhw.rs: FFmpeg VAAPI encoder + filter graph + BSF pipeline - src/state.rs: Wayland event loop + output negotiation + screencopy - src/cap_wlr_screencopy.rs: wlr-screencopy capture source - src/fps_limit.rs: Frame rate limiting with configurable target - src/transform.rs: Frame format conversion utilities
57 lines
1.6 KiB
Markdown
57 lines
1.6 KiB
Markdown
# wl-webrtc
|
|
|
|
Wayland screen capture and encoding tool.
|
|
|
|
## Prerequisites
|
|
|
|
- **Rust toolchain** (1.70+): `rustup default stable`
|
|
- **FFmpeg 6.0+** dev libraries with VAAPI support:
|
|
- Arch: `pacman -S ffmpeg`
|
|
- Ubuntu/Debian: `apt install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libva-dev`
|
|
- Fedora: `dnf install ffmpeg-devel libva-devel`
|
|
- **Wayland** dev libraries:
|
|
- Arch: `pacman -S wayland-protocols`
|
|
- Ubuntu/Debian: `apt install libwayland-dev wayland-protocols`
|
|
- Fedora: `dnf install wayland-devel wayland-protocols-devel`
|
|
- **DRM** dev libraries:
|
|
- Arch: `pacman -S libdrm`
|
|
- Ubuntu/Debian: `apt install libdrm-dev`
|
|
- Fedora: `dnf install libdrm-devel`
|
|
|
|
## Build
|
|
|
|
```bash
|
|
cargo build --release
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
# Basic capture to file
|
|
wl-webrtc --output output.mp4
|
|
|
|
# With custom FPS and bitrate
|
|
wl-webrtc --output output.mp4 --fps 60 --bitrate 8000000
|
|
|
|
# Specify DRM device for hardware encoding
|
|
wl-webrtc --output output.mp4 --drm-device /dev/dri/renderD128
|
|
|
|
# Verbose mode
|
|
wl-webrtc --output output.mp4 -v
|
|
```
|
|
|
|
## CLI Arguments
|
|
|
|
| Argument | Default | Description |
|
|
|---|---|---|
|
|
| `-o`, `--output` | (required) | Output file path (e.g., output.mp4) |
|
|
| `--output-name` | auto | Wayland output name to capture |
|
|
| `--fps` | 30 | Target frames per second |
|
|
| `--codec` | h264 | Video codec (h264 only for MVP) |
|
|
| `--hw-accel` | vaapi | Hardware acceleration method |
|
|
| `--drm-device` | auto | DRM render device path |
|
|
| `--bitrate` | auto | Target bitrate in bps |
|
|
| `--gop-size` | auto | Group of Pictures size |
|
|
| `-v`, `--verbose` | false | Enable verbose logging |
|
|
| `--port` | 0 | WebTransport server port (unused in MVP) |
|