feat: trace video shows frame number overlay

This commit is contained in:
Accusys
2026-05-14 02:30:40 +08:00
parent 3a7facdc10
commit 605d02a674

View File

@@ -310,6 +310,13 @@ async fn trace_video(
// Build filters: bbox+drawtext (1 filter + 1 drawtext per detection)
let mut parts: Vec<String> = Vec::new();
// Global frame number overlay (top-left corner, always visible)
let global_frame_text = format!(
"drawtext=text='Frame\\: %{{n}}+{}':fontsize=16:fontcolor=white:box=1:boxcolor=black@0.6:x=10:y=10",
first_frame as i64 - (padding * fps) as i64
);
parts.push(global_frame_text);
for (i, (frame, x, y, w, h)) in rows.iter().enumerate() {
let start_off = frame - first_frame + pad_frames;
// End at next detection, or at the last frame of the video (not beyond)