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 <noreply@anthropic.com>
This commit is contained in:
+29
-5
@@ -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<String> = 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]"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user