tighten export and capture handling

This commit is contained in:
2026-06-04 23:09:13 +03:00
parent a48d82ddc9
commit 4ca802ef71
14 changed files with 736 additions and 456 deletions
+9
View File
@@ -329,6 +329,10 @@ impl CaptureSession {
/// Re-encode the intermediate file with correct timestamps.
/// The capture declares -framerate N and applies fps=M filter.
/// This scales PTS to match real-time duration.
///
/// Idempotent: if `input` has already been consumed (e.g. a previous
/// pause/resume cycle ran this to completion and removed it), and
/// `output` exists, returns Ok without re-running ffmpeg.
pub fn fix_intermediate_fps(
ffmpeg: &std::path::Path,
input: &std::path::Path,
@@ -339,6 +343,11 @@ pub fn fix_intermediate_fps(
) -> Result<()> {
use std::process::Command;
if !input.is_file() && output.is_file() {
tracing::debug!("capture fix: input already consumed, output exists, skipping");
return Ok(());
}
if frame_count == 0 || elapsed_secs <= 0.0 {
tracing::warn!("capture fix: no frames counted, keeping original");
let _ = std::fs::rename(input, output);