diff --git a/av1an-core/src/ffmpeg.rs b/av1an-core/src/ffmpeg.rs index b3709a0..5674fa1 100644 --- a/av1an-core/src/ffmpeg.rs +++ b/av1an-core/src/ffmpeg.rs @@ -32,9 +32,8 @@ pub fn get_frame_count(source: impl AsRef) -> usize { let re = Regex::new(r".*frame=\s*([0-9]+)\s").unwrap(); let output = String::from_utf8(out.stderr).unwrap(); - let cap = re.captures(&output).unwrap(); - - cap[cap.len() - 1].parse::().unwrap() + let cap = re.captures_iter(&output).last().unwrap(); + cap[1].parse::().unwrap() } /// Returns vec of all keyframes