{"record":{"id":"6de0437238a9f7b8","repo":"screenpipe/screenpipe","slug":"failed-to-find-ffmpeg-path","errorCode":null,"errorMessage":"failed to find ffmpeg path","messagePattern":"failed to find ffmpeg path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/screenpipe-engine/src/video_utils.rs","lineNumber":296,"sourceCode":"            warn!(\n                \"could not read video metadata for {}, falling back to decoded-ordinal selection: {}\",\n                file_path, error\n            );\n            Ok(None)\n        }\n    }\n}\n\npub async fn extract_frame(file_path: &str, offset_index: i64) -> Result<String> {\n    ensure_regular_media_file(file_path).await?;\n    if offset_index < 0 {\n        return Err(anyhow::anyhow!(\n            \"invalid negative frame index: {}\",\n            offset_index\n        ));\n    }\n    let ffmpeg_path =\n        find_ffmpeg_path().ok_or_else(|| anyhow::anyhow!(\"failed to find ffmpeg path\"))?;\n\n    // Frames may be stored either as video chunks or as individual still\n    // images. `offset_index` is a zero-based decode ordinal, not milliseconds\n    // and not a presentation timestamp; a still image has exactly one frame, so\n    // no selection applies to it at all.\n    let is_image = std::path::Path::new(file_path)\n        .extension()\n        .and_then(|e| e.to_str())\n        .map(|e| {\n            matches!(\n                e.to_ascii_lowercase().as_str(),\n                \"jpg\" | \"jpeg\" | \"png\" | \"webp\" | \"bmp\" | \"gif\" | \"tiff\"\n            )\n        })\n        .unwrap_or(false);\n\n    let locator = if is_image {\n        None","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/screenpipe/screenpipe/blob/4ebf712990fee17eeaf904dacf749b6e96ac9bf3/crates/screenpipe-engine/src/video_utils.rs#L278-L314","documentation":"extract_frame resolves the ffmpeg executable with find_ffmpeg_path() from screenpipe-core. When it returns None, the call fails with 'failed to find ffmpeg path' before any process is spawned. The library relies on a bundled or PATH-discoverable ffmpeg.","triggerScenarios":"Calling extract_frame on a machine where the ffmpeg sidecar is missing and ffmpeg is not on PATH; broken bundle layout; overridden search paths pointing at a nonexistent directory.","commonSituations":"Running tests in CI containers without ffmpeg; packaging the app without sidecar binaries; PATH stripped under systemd/services; macOS Gatekeeper quarantine removing binaries.","solutions":["Install ffmpeg system-wide (brew/apt) or place it on PATH","Ship the screenpipe ffmpeg sidecar next to the binary as the bundler expects","Verify find_ffmpeg_path() returns Some in your environment before calling","Pin ffmpeg in your Dockerfile/CI image so the dependency is explicit"],"exampleFix":"// CI before\n- run: cargo test -p screenpipe-engine\n// after\n- run: sudo apt-get update && sudo apt-get install -y ffmpeg\n- run: cargo test -p screenpipe-engine","handlingStrategy":"fallback","validationCode":"fn ffmpeg_available() -> bool {\n    std::process::Command::new(\"ffmpeg\").arg(\"-version\").output()\n        .map(|o| o.status.success()).unwrap_or(false)\n}\n// or directly: screenpipe_core::find_ffmpeg_path().is_some()","typeGuard":null,"tryCatchPattern":"match extract_frame(path, idx).await {\n    Ok(f) => f,\n    Err(e) if e.to_string() == \"failed to find ffmpeg path\" => {\n        eprintln!(\"install ffmpeg (brew install ffmpeg / apt install ffmpeg)\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Install ffmpeg in every environment (dev, CI, prod containers)","Keep the bundled sidecar next to the application binary","Check find_ffmpeg_path() once at app startup and fail fast","Export PATH explicitly in service units and cron environments"],"tags":["ffmpeg","missing-binary","environment"],"backgroundTag":"missing-ffmpeg-binary","analyzedSha":"4ebf712990fee17eeaf904dacf749b6e96ac9bf3","analyzedAt":"2026-09-01T23:33:43.065Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}