Skip to content

Commit

Permalink
🧪 Fix get_video_fps/1 because it fails for -c:v hevc_videotoolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
tgotwig committed Jul 23, 2024
1 parent a7e17ac commit 5650556
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ mod integration {
);

assert!(!res.contains("Non-monotonous DTS"));
assert!(get_video_info(&format!("data/{}/output.mp4", test_name)).contains("28 fps"));
assert_eq!(
get_video_fps(&format!("data/{}/output.mp4", test_name)),
"28/1"
);
check_for_merged_file(test_name, "output.mp4");
}

Expand All @@ -185,7 +188,10 @@ mod integration {
);

assert!(!res.contains("Non-monotonous DTS"));
assert!(get_video_info(&format!("data/{}/output.mp4", test_name)).contains("25 fps"));
assert_eq!(
get_video_fps(&format!("data/{}/output.mp4", test_name)),
"25/1"
);
check_for_merged_file(test_name, "output.mp4");
}

Expand All @@ -207,7 +213,10 @@ mod integration {
.success(),
);

assert!(get_video_info(&format!("data/{}/output.mp4", test_name)).contains("60 fps"));
assert_eq!(
get_video_fps(&format!("data/{}/output.mp4", test_name)),
"60/1"
);
check_for_merged_file(test_name, "output.mp4");
}

Expand Down Expand Up @@ -265,8 +274,22 @@ mod integration {
.unwrap();
}

fn get_video_info(file_path: &str) -> String {
let output = Command::new("ffmpeg").arg("-i").arg(file_path).output();
String::from_utf8_lossy(&output.unwrap().stderr).to_string()
fn get_video_fps(file_path: &str) -> String {
let output = Command::new("ffprobe")
.args(&[
"-v",
"error",
"-select_streams",
"v:0",
"-show_entries",
"stream=r_frame_rate",
"-of",
"default=noprint_wrappers=1:nokey=1",
file_path,
])
.output()
.unwrap();

String::from_utf8(output.stdout).unwrap().trim().to_string()
}
}

0 comments on commit 5650556

Please sign in to comment.