diff --git a/src/core/processor/face.rs b/src/core/processor/face.rs index 98d9ac52..935a3dc8 100644 --- a/src/core/processor/face.rs +++ b/src/core/processor/face.rs @@ -358,11 +358,17 @@ async fn run_face_with_config( let swift_path = &tool.path; tracing::info!("[FACE] Using Swift processor from config: {:?}", swift_path); - let mut args = vec![video_path.to_string(), output_path.to_string()]; - if let Some(u) = uuid { - args.push("--uuid".to_string()); - args.push(u.to_string()); - } + let args = if !tool.args.is_empty() { + tracing::info!("[FACE] Using args from config: {:?}", tool.args); + tool.args.clone() + } else { + let mut args = vec![video_path.to_string(), output_path.to_string()]; + if let Some(u) = uuid { + args.push("--uuid".to_string()); + args.push(u.to_string()); + } + args + }; let output = tokio::process::Command::new(swift_path) .args(&args) diff --git a/src/core/processor/pose.rs b/src/core/processor/pose.rs index cb36c0c5..6e46e22c 100644 --- a/src/core/processor/pose.rs +++ b/src/core/processor/pose.rs @@ -524,11 +524,17 @@ async fn run_pose_with_config( let swift_path = &tool.path; tracing::info!("[POSE] Using Swift processor from config: {:?}", swift_path); - let mut args = vec![video_path.to_string(), output_path.to_string()]; - if let Some(u) = uuid { - args.push("--uuid".to_string()); - args.push(u.to_string()); - } + let args = if !tool.args.is_empty() { + tracing::info!("[POSE] Using args from config: {:?}", tool.args); + tool.args.clone() + } else { + let mut args = vec![video_path.to_string(), output_path.to_string()]; + if let Some(u) = uuid { + args.push("--uuid".to_string()); + args.push(u.to_string()); + } + args + }; let output = tokio::process::Command::new(swift_path) .args(&args) @@ -553,18 +559,34 @@ async fn run_pose_with_config( let rust_path = &tool.path; tracing::info!("[POSE] Using Rust processor from config: {:?}", rust_path); - executor - .run_rust_with_output_idx_and_frames( - rust_path, - &[video_path, output_path, output_path], - Some(2), - uuid, - None, - "POSE", - Some(POSE_TIMEOUT), - ) - .await - .with_context(|| format!("Failed to run Rust binary {:?}", rust_path))?; + if !tool.args.is_empty() { + tracing::info!("[POSE] Using args from config: {:?}", tool.args); + + let output = tokio::process::Command::new(rust_path) + .args(&tool.args) + .output() + .await + .context("Failed to execute rust_pose")?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + tracing::error!("[POSE] Rust processor failed: {}", stderr); + anyhow::bail!("Rust pose processor failed"); + } + } else { + executor + .run_rust_with_output_idx_and_frames( + rust_path, + &[video_path, output_path, output_path], + Some(2), + uuid, + None, + "POSE", + Some(POSE_TIMEOUT), + ) + .await + .with_context(|| format!("Failed to run Rust binary {:?}", rust_path))?; + } let json_str = std::fs::read_to_string(output_path) .context("Failed to read POSE output")?;