tonhowtf/omniget · error · anyhow

ffmpeg falhou

Error message

ffmpeg falhou: {}{}

What it means

When the spawned ffmpeg process exits with a non-zero status, download inspects the tail of ffmpeg's stderr for known patterns (auth/Referer issues, DRM markers like 'drm'/'cenc') and attaches a human-readable hint, then raises this error. The raw ffmpeg output tail is embedded so the real cause is visible.

Solutions

  1. Read the tail in the message: if it mentions 403/refusal, re-copy a fresh manifest URL and pass the needed Referer/headers
  2. If the hint says DRM, the content is not downloadable — use an official download/offline option instead
  3. Re-fetch the manifest URL (signed links expire quickly) and retry immediately
  4. Verify ffmpeg works standalone (ffmpeg -version) and try the URL manually to see full output
  5. Check dest_dir permissions and free disk space

Example fix

// before
let url = "https://cdn.example.com/manifest.mpd?token=OLD"; // expired
// after
let url = "https://cdn.example.com/manifest.mpd?token=FRESH"; // re-copied just before download
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: fail fast on DRM before invoking the tool
let body = reqwest::get(&opts.url).await?.text().await?;
if body.contains("cenc:") || body.contains("ContentProtection") {
    return Err("DRM-protected content is not supported");
}

Try / catch

if let Err(e) = manifest_dl::download(&opts, &progress).await {
    let msg = e.to_string();
    if msg.contains("recusou") {
        // re-fetch fresh signed URL / add Referer+cookies, then retry once
    } else if msg.contains("DRM") {
        // tell user DRM content can't be downloaded
    } else {
        // log full ffmpeg tail and surface it
    }
}

Prevention

When it happens

Trigger: ffmpeg fails for any reason while downloading/remuxing the manifest: 403 from the CDN (missing Referer/cookies or expired link), DRM-protected DASH content (cenc), bad manifest URL, missing codecs, disk/permission errors in dest_dir, or ffmpeg crashing mid-download.

Common situations: HLS/DASH link that expired between copying and downloading; geo-blocked or token-signed URLs; Widevine/PlayReady-protected MPD (ffmpeg cannot decrypt DRM); corporate proxy blocking segment downloads; corrupted ffmpeg install.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/manifest_dl.rs:158

                if !line.trim().is_empty() {
                    tail = line;
                }
            }
        }
        tail
    });
    let st = child.wait().await?;
    let secs = t1.await.unwrap_or(0.0);
    let tail = t2.await.unwrap_or_default();
    if !st.success() {
        let hint = if tail.contains("403") || tail.contains("401") {
            " (o servidor recusou: falta Referer/cookie ou o link expirou)"
        } else if tail.to_lowercase().contains("drm") || tail.contains("cenc") {
            " (conteudo com DRM nao e suportado)"
        } else {
            ""
        };
        return Err(anyhow!("ffmpeg falhou: {}{}", tail, hint));
    }
    super::report(&progress, &id, "done", secs as u64, Some(secs as u64), None);
    Ok(ManifestResult {
        path: out.to_string_lossy().to_string(),
        seconds: secs,
    })
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn builds_headers() {
        let o = ManifestOptions {
            url: "".into(),
            dest_dir: "".into(),
            file_name: "".into(),

View on GitHub (pinned to 8600b91f42)