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 .await
.map_err(spawn_fail)?; .map_err(spawn_fail)?;
if !probe.status.success() { 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)?; let p: FFprobeOutput = serde_json::from_slice(&probe.stdout)?;
!p.streams.is_empty() !p.streams.is_empty()

View File

@ -198,16 +198,19 @@ pub async fn loop_adapt_inner(
ai: AdaptInfo, ai: AdaptInfo,
) -> anyhow::Result<AdaptedFilesIterBox> { ) -> anyhow::Result<AdaptedFilesIterBox> {
let fph = ai.filepath_hint.clone(); let fph = ai.filepath_hint.clone();
let inp = adapter let inp = adapter.adapt(ai, &detection_reason).await;
.adapt(ai, &detection_reason) let inp = if adapter.metadata().name == "postprocprefix" {
.await // don't add confusing error context
.with_context(|| { inp?
} else {
inp.with_context(|| {
format!( format!(
"adapting {} via {} failed", "adapting {} via {} failed",
fph.to_string_lossy(), fph.to_string_lossy(),
adapter.metadata().name adapter.metadata().name
) )
})?; })?
};
let s = stream! { let s = stream! {
for await file in inp { for await file in inp {
match buf_choose_adapter(file?).await? { match buf_choose_adapter(file?).await? {