diff --git a/src-tauri/src/capture.rs b/src-tauri/src/capture.rs index da3efc8..b0c9022 100644 --- a/src-tauri/src/capture.rs +++ b/src-tauri/src/capture.rs @@ -68,6 +68,7 @@ impl GraphicsCaptureApiHandler for CaptureHandler { // user's chosen FPS. We must tell ffmpeg the actual rate so timestamps are // correct. The fps filter in the export pipeline handles the conversion. let capture_fps = detect_monitor_refresh_rate().max(setup.fps); + tracing::info!("capture: ffmpeg framerate={}, size={}x{}", capture_fps, setup.width, setup.height); let mut cmd = Command::new(&setup.ffmpeg_path); cmd.arg("-y") @@ -87,13 +88,25 @@ impl GraphicsCaptureApiHandler for CaptureHandler { .arg(&setup.output_path) .stdin(Stdio::piped()) .stdout(Stdio::null()) - .stderr(Stdio::null()); + .stderr(Stdio::piped()); let mut child = cmd.spawn().map_err(|e| anyhow!("spawning ffmpeg: {e}"))?; let stdin = child .stdin .take() .ok_or_else(|| anyhow!("ffmpeg stdin not captured"))?; + // Read stderr in background to capture ffmpeg errors + let stderr = child.stderr.take(); + if let Some(serr) = stderr { + let output_path = setup.output_path.clone(); + std::thread::spawn(move || { + use std::io::{BufRead, BufReader}; + let reader = BufReader::new(serr); + for line in reader.lines().map_while(Result::ok) { + tracing::error!("ffmpeg: {line}"); + } + }); + } let frame_size = (setup.width as usize) * (setup.height as usize) * 4; Ok(Self {