From 0cf9ca56d405f0f7f172ff53e7f08e5a1a5bdbc4 Mon Sep 17 00:00:00 2001 From: Accusys Date: Fri, 8 May 2026 13:08:23 +0800 Subject: [PATCH 1/3] Fix ARG_MAX overflow: use filter_complex_script instead of -vf - trace_video filter string can exceed macOS 256KB limit - Write filter to temp file, pass with -filter_complex_script --- src/api/media_api.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/media_api.rs b/src/api/media_api.rs index 62e471e..59a6209 100644 --- a/src/api/media_api.rs +++ b/src/api/media_api.rs @@ -330,15 +330,21 @@ 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(), "-vf", &vf, + "-t", &duration.to_string(), + "-filter_complex_script", &filter_path, "-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); From 485dc4010c7c7c959dac1cf1d92788036e2cbe2c Mon Sep 17 00:00:00 2001 From: Accusys Date: Fri, 8 May 2026 13:14:00 +0800 Subject: [PATCH 2/3] Fix video endpoints: DB file_path did not match actual file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/api/media_api.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/api/media_api.rs b/src/api/media_api.rs index 59a6209..62e471e 100644 --- a/src/api/media_api.rs +++ b/src/api/media_api.rs @@ -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); From 14d95cab8ef0c628e4cd1c1dc1b1305aad986746 Mon Sep 17 00:00:00 2001 From: Accusys Date: Fri, 8 May 2026 13:16:05 +0800 Subject: [PATCH 3/3] Notify M4: video endpoints root cause --- .../2026-05-08_video_endpoints_fix.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs_v1.0/M4_workspace/2026-05-08_video_endpoints_fix.md diff --git a/docs_v1.0/M4_workspace/2026-05-08_video_endpoints_fix.md b/docs_v1.0/M4_workspace/2026-05-08_video_endpoints_fix.md new file mode 100644 index 0000000..bae901e --- /dev/null +++ b/docs_v1.0/M4_workspace/2026-05-08_video_endpoints_fix.md @@ -0,0 +1,24 @@ +# Video Endpoints 500 — 真因與修復 + +## 真因 + +DB 的 `file_path` 與實際檔案不一致。檔案被改名但 DB 沒更新。 + +M5: `...Charade ... │ Comedy ...mp4` → `Old_Time_Movie_Show_-_Charade_1963.HD.mov` + +不是 ARG_MAX、不是 PATH、不是 Unicode。 + +## 修復 + +M5 已執行: + +```sql +UPDATE dev.videos SET file_path = '/實際/路徑/Old_Time_Movie_Show_-_Charade_1963.HD.mov' +WHERE file_uuid = '3abeee81d94597629ed8cb943f182e94'; +``` + +## M4 執行 + +1. 確認自家 DB 的 `file_path` +2. 改為正確路徑 +3. 不需要 git pull(code 沒改)