YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(core,audio): prevent panic if ffmpeg is not found or path is invalid UTF-8 (#3724)
Divanshuc6b2ff3a8033
diff --git a/crates/screenpipe-audio/src/utils/ffmpeg.rs b/crates/screenpipe-audio/src/utils/ffmpeg.rsindex b05e9a424..e9f3e82de 100644--- a/crates/screenpipe-audio/src/utils/ffmpeg.rs+++ b/crates/screenpipe-audio/src/utils/ffmpeg.rs@@ -132,11 +132,16 @@ pub fn get_new_file_path_with_timestamp(pub fn read_audio_from_file(path: &Path) -> Result<(Vec<f32>, u32)> {let sample_rate: u32 = 16000;- let mut command = screenpipe_core::ffmpeg_cmd(find_ffmpeg_path().unwrap());+ let ffmpeg_path = find_ffmpeg_path()+ .ok_or_else(|| anyhow::anyhow!("ffmpeg not found in PATH or bundled binaries"))?;+ let path_str = path.to_str()+ .ok_or_else(|| anyhow::anyhow!("path is not valid UTF-8: {}", path.display()))?;++ let mut command = screenpipe_core::ffmpeg_cmd(ffmpeg_path);command.args(["-i",- path.to_str().unwrap(),+ path_str,"-f","f32le","-ar",diff --git a/crates/screenpipe-core/src/video.rs b/crates/screenpipe-core/src/video.rsindex e1e78974c..87521b657 100644--- a/crates/screenpipe-core/src/video.rs+++ b/crates/screenpipe-core/src/video.rs@@ -100,7 +100,8 @@ pub async fn start_ffmpeg_process(info!("Starting FFmpeg process for file: {}", output_file);let fps_str = fps.to_string();- let mut command = crate::ffmpeg_cmd_async(find_ffmpeg_path().unwrap());+ let ffmpeg_path = find_ffmpeg_path().ok_or_else(|| anyhow::anyhow!("ffmpeg not found"))?;+ let mut command = crate::ffmpeg_cmd_async(ffmpeg_path);let mut args = vec!["-f","image2pipe",