tonhowtf/omniget · error

a janela de corte ficou vazia — o vídeo tem

Error message

a janela de corte ficou vazia — o vídeo tem {:.1}s

What it means

run() computes the cut window as opts.duration if positive, otherwise remaining video time (probe.duration_seconds - start). If the resulting window is <= 0 the clip would be empty, so it throws 'a janela de corte ficou vazia — o vídeo tem <D>s'. This protects FFmpeg from a nonsensical zero/negative duration.

Solutions

  1. Clamp start to be strictly less than the probed duration before calling run
  2. Verify the video file is complete (its ffprobe duration should match the expected length)
  3. If passing opts.duration explicitly, ensure start + duration stays within the video

Example fix

// before
let opts = BurnOptions { start: 120.0, ..base_opts }; // video is 90s
// after
let dur = ffprobe_duration(&video)?;
anyhow::ensure!(opts.start < dur, "início {:.1}s além da duração {:.1}s", opts.start, dur);
let opts = BurnOptions { start: opts.start.min(dur - 1.0), ..base_opts };
Defensive patterns

Strategy: validation

Validate before calling

fn window_ok(start: f64, duration: f64, probe: f64) -> bool {
    let w = if duration > 0.0 { duration } else { probe - start };
    w > 0.0 && start < probe
}

Try / catch

match burn::run(&opts, &progress).await {
    Err(e) if e.to_string().contains("janela de corte ficou vazia") => clamp_start_and_retry(&opts),
    Err(e) => propagate(e)?,
    Ok(res) => use_result(res),
}

Prevention

When it happens

Trigger: opts.start (or the resolved seek point) is >= the probed video duration; a video shorter than the requested trim offset; a bogus probe report with duration_seconds near 0 combined with a non-zero start.

Common situations: User asks for a clip from a timestamp beyond the end of a short video; corrupted or partially downloaded file whose ffprobe duration is wrong; duration passed as 0 while start >= real duration.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/347673764d3c8790. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/bilibili/danmaku/burn.rs:102

    report(
        progress,
        ID,
        "progress",
        0,
        Some(3),
        Some("lendo o vídeo".into()),
    );
    let probe = omniget_core::core::ffmpeg::probe(&video).await?;
    let has_audio = probe.streams.iter().any(|s| s.codec_type == "audio");
    let start = opts.start.max(0.0);
    let window = if opts.duration > 0.0 {
        opts.duration
    } else {
        (probe.duration_seconds - start).max(0.0)
    };
    if window <= 0.0 {
        return Err(anyhow!(
            "a janela de corte ficou vazia — o vídeo tem {:.1}s",
            probe.duration_seconds
        ));
    }

    let text = read_text(&sub)?;
    let (body, dialogues) = if is_ass(&sub) {
        shift_ass(&text, start, window)
    } else {
        shift_other(&text, start, window)?
    };
    if dialogues == 0 {
        return Err(anyhow!(
            "nenhum comentário cai entre {:.1}s e {:.1}s",
            start,
            start + window
        ));
    }

View on GitHub (pinned to 8600b91f42)