From 5b91a373182a14a943246eefe6034274edb9a6ae Mon Sep 17 00:00:00 2001 From: phiresky Date: Sun, 4 Jun 2023 15:05:00 +0200 Subject: [PATCH] improve ffprobe error --- src/adapters/ffmpeg.rs | 6 +++++- src/preproc.rs | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/adapters/ffmpeg.rs b/src/adapters/ffmpeg.rs index 080f891..a32e6f9 100644 --- a/src/adapters/ffmpeg.rs +++ b/src/adapters/ffmpeg.rs @@ -98,7 +98,11 @@ impl WritingFileAdapter for FFmpegAdapter { .await .map_err(spawn_fail)?; if !probe.status.success() { - return Err(format_err!("ffprobe failed: {:?}", probe.status)); + return Err(format_err!( + "ffprobe failed: {:?}\n{}", + probe.status, + String::from_utf8_lossy(&probe.stderr) + )); } let p: FFprobeOutput = serde_json::from_slice(&probe.stdout)?; !p.streams.is_empty() diff --git a/src/preproc.rs b/src/preproc.rs index e65e741..d073856 100644 --- a/src/preproc.rs +++ b/src/preproc.rs @@ -198,16 +198,19 @@ pub async fn loop_adapt_inner( ai: AdaptInfo, ) -> anyhow::Result { let fph = ai.filepath_hint.clone(); - let inp = adapter - .adapt(ai, &detection_reason) - .await - .with_context(|| { + let inp = adapter.adapt(ai, &detection_reason).await; + let inp = if adapter.metadata().name == "postprocprefix" { + // don't add confusing error context + inp? + } else { + inp.with_context(|| { format!( "adapting {} via {} failed", fph.to_string_lossy(), adapter.metadata().name ) - })?; + })? + }; let s = stream! { for await file in inp { match buf_choose_adapter(file?).await? {