improve ffprobe error

This commit is contained in:
phiresky 2023-06-04 15:05:00 +02:00
parent 30837dbca2
commit 5b91a37318
2 changed files with 13 additions and 6 deletions

View File

@ -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()

View File

@ -198,16 +198,19 @@ pub async fn loop_adapt_inner(
ai: AdaptInfo,
) -> anyhow::Result<AdaptedFilesIterBox> {
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? {