Don't panic if ffmpeg fails to count frames (#634)
* Don't panic if ffmpeg fails to count frames * Fix formatting
This commit is contained in:
parent
fe585ac24c
commit
b8272ae22d
|
@ -427,20 +427,28 @@ impl EncodeArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
if current_pass == passes {
|
if current_pass == passes {
|
||||||
let encoded_frames = num_frames(chunk.output().as_ref()).unwrap();
|
let encoded_frames = num_frames(chunk.output().as_ref());
|
||||||
|
|
||||||
if encoded_frames != chunk.frames {
|
let err_str = match encoded_frames {
|
||||||
|
Ok(encoded_frames) if encoded_frames != chunk.frames => Some(format!(
|
||||||
|
"FRAME MISMATCH: chunk {}: {}/{} (actual/expected frames)",
|
||||||
|
chunk.index, encoded_frames, chunk.frames
|
||||||
|
)),
|
||||||
|
Err(error) => Some(format!(
|
||||||
|
"FAILED TO COUNT FRAMES: chunk {}: {}",
|
||||||
|
chunk.index, error
|
||||||
|
)),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(err_str) = err_str {
|
||||||
return Err((
|
return Err((
|
||||||
EncoderCrash {
|
EncoderCrash {
|
||||||
exit_status: enc_output.status,
|
exit_status: enc_output.status,
|
||||||
source_pipe_stderr: source_pipe_stderr.into(),
|
source_pipe_stderr: source_pipe_stderr.into(),
|
||||||
ffmpeg_pipe_stderr: ffmpeg_pipe_stderr.map(Into::into),
|
ffmpeg_pipe_stderr: ffmpeg_pipe_stderr.map(Into::into),
|
||||||
stderr: enc_stderr.into(),
|
stderr: enc_stderr.into(),
|
||||||
stdout: format!(
|
stdout: err_str.into(),
|
||||||
"FRAME MISMATCH: chunk {}: {}/{} (actual/expected frames)",
|
|
||||||
chunk.index, encoded_frames, chunk.frames
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
},
|
},
|
||||||
frame,
|
frame,
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue