Wayland: keep capturing without output power management; x264 ABR for bitrate presets (#15)

* Wayland: keep capturing when output power management is unavailable

keep_display_awake() runs on the desktop video start path, so a compositor\nwithout wlr-output-power-management made uu_wl_wake() return -1 and aborted\nthe whole desktop stream. Treat the missing protocol as nothing to wake.

* x264: average bitrate for the bitrate presets so 4K keyframes fit

Capped CRF plus VBV cannot fit a large IDR frame at 4K and a low cap, so\nkeyframes came out near-grey. NVENC and VAAPI already carry a target bitrate;\ngive x264 the same and keep CRF only for automatic quality.
This commit is contained in:
wenmou authored and GitHub committed 2026-10-16 01:30:00 +08:00
1 parent 708c770b19
commit 9c1ae123db
4 files changed
+16 -3

No files matched your search

+6 -3
View File
@@ -157,10 +157,13 @@ fn encoder_options(settings: &VideoSettings, encoder: Encoder, gop: &str) -> Vec
}
if settings.codec == VideoCodec::H265 { return cpu_hevc_options(settings, gop); }
let params = format!("aud=1:repeat-headers=1:scenecut=0:keyint={gop}:min-keyint={gop}");
["-c:v", "libx264", "-preset", "superfast", "-tune", "zerolatency",
let mut options = vec!["-c:v", "libx264", "-preset", "superfast", "-tune", "zerolatency",
"-profile:v", profile, "-pix_fmt", pix_fmt, "-g", gop, "-threads", "4",
"-crf", &cq, "-maxrate", &maxrate, "-bufsize", &bufsize, "-x264-params", &params]
.into_iter().map(str::to_owned).collect()
"-maxrate", &maxrate, "-bufsize", &bufsize, "-x264-params", &params];
// Capped CRF starves repeated 4K keyframes; use ABR for bitrate presets.
if settings.max_kbps().is_some() { options.extend(["-b:v", &target]); }
else { options.extend(["-crf", &cq]); }
options.into_iter().map(str::to_owned).collect()
}
fn ffmpeg_command() -> Command {