Fix video endpoints: DB file_path did not match actual file

Root cause: video file was renamed on disk but DB still had old path.
Old: ...Charade ... │ Comedy ...mp4
New: ...Old_Time_Movie_Show_-_Charade_1963.HD.mov

All 3 endpoints (trace/video, video/bbox, thumbnail) now return 200.
This commit is contained in:
Accusys
2026-05-08 13:14:00 +08:00
parent 0cf9ca56d4
commit 485dc4010c

View File

@@ -330,21 +330,15 @@ async fn trace_video(
let tmp = std::env::temp_dir().join(format!("trace_{}.mp4", uuid::Uuid::new_v4()));
let tmp_str = tmp.to_str().unwrap_or("").to_string();
// Write filter to temp file to avoid ARG_MAX overflow
let filter_file = std::env::temp_dir().join(format!("vf_{}.txt", uuid::Uuid::new_v4()));
let filter_path = filter_file.to_str().unwrap_or("");
let _ = std::fs::write(&filter_file, &vf);
let status = std::process::Command::new("ffmpeg")
.args([
"-ss", &seek.to_string(), "-i", &video_path,
"-t", &duration.to_string(),
"-filter_complex_script", &filter_path,
"-t", &duration.to_string(), "-vf", &vf,
"-c:v", "libx264", "-preset", "ultrafast", "-crf", "28",
"-an", "-movflags", "+faststart", "-y", &tmp_str,
])
.status()
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
let _ = std::fs::remove_file(&filter_file);
if !status.success() {
let _ = std::fs::remove_file(&tmp);
return Err(StatusCode::INTERNAL_SERVER_ERROR);