From 29d8850bc5feeb809d54fcd35e4789e276514eb9 Mon Sep 17 00:00:00 2001 From: Mollusk Date: Sun, 24 May 2026 15:34:36 -0400 Subject: [PATCH] feat(quality): log the actual encode resolution at capture spawn Window size in the viewer is an unreliable proxy for the encoded resolution (mpv clamps/scales to the screen), making it hard to tell whether a preset's downscale actually took effect. Log the concrete decision host-side when capture spawns: - "downscaling video from=1920x1080 to=1280x720" when scaling, - "encoding at native resolution" for Source, - "source already at/below preset height" when no upscale is needed, - the unknown-dims fallback case too. Co-Authored-By: Claude Opus 4.7 --- src/host/pipeline.rs | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/host/pipeline.rs b/src/host/pipeline.rs index 829ab0c..723f0ef 100644 --- a/src/host/pipeline.rs +++ b/src/host/pipeline.rs @@ -202,19 +202,43 @@ fn build_args( // X11 geometry-read failure) we fall back to height-only + square pixels + // an even-stepped width range and let videoscale negotiate. let scale_caps: Option = match quality.max_height { - None => None, + None => { + tracing::info!(preset = %quality.label, "encoding at native resolution (no downscale)"); + None + } Some(max_h) => { let h = (max_h & !1).max(2); match source_dims { Some((sw, sh)) if sh > h => { let w = ((sw as u64 * h as u64 + sh as u64 / 2) / sh as u64) as u32; let w = (w & !1).max(2); + tracing::info!( + preset = %quality.label, + from = %format!("{sw}x{sh}"), + to = %format!("{w}x{h}"), + "downscaling video" + ); Some(format!("{raw_format},width={w},height={h}")) } - Some(_) => None, // source already <= target height - None => Some(format!( - "{raw_format},height={h},pixel-aspect-ratio=1/1,width=[2,8192,2]" - )), + Some((sw, sh)) => { + tracing::info!( + preset = %quality.label, + source = %format!("{sw}x{sh}"), + max_height = h, + "source already at/below preset height — encoding native (no upscale)" + ); + None + } + None => { + tracing::info!( + preset = %quality.label, + max_height = h, + "downscaling to max height (source size unknown — width follows negotiation)" + ); + Some(format!( + "{raw_format},height={h},pixel-aspect-ratio=1/1,width=[2,8192,2]" + )) + } } } };