Skip to content

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

chore: add more ffmpeg check

Louis Beaumont64ffb32c112e
diff --git a/examples/apps/screenpipe-app-dioxus/Info.plist b/examples/apps/screenpipe-app-dioxus/Info.plist
new file mode 100644
index 000000000..018d396d8
--- /dev/null
+++ b/examples/apps/screenpipe-app-dioxus/Info.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>This app requires microphone access to record audio.</string>
+ <key>NSScreenCaptureUsageDescription</key>
+ <string>This app requires screen capture access to record the screen.</string>
+</dict>
+</plist>
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-dioxus/entitlements.plist b/examples/apps/screenpipe-app-dioxus/entitlements.plist
new file mode 100644
index 000000000..e8e1471d4
--- /dev/null
+++ b/examples/apps/screenpipe-app-dioxus/entitlements.plist
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.security.device.audio-input</key>
+ <true/>
+ <key>com.apple.security.device.camera</key>
+ <true/>
+ <key>com.apple.security.device.microphone</key>
+ <true/>
+ <key>com.apple.security.files.user-selected.read-write</key>
+ <true/>
+ <key>com.apple.security.screen-capture</key>
+ <true/>
+ <key>com.apple.developer.persistent-content-capture</key>
+ <true/>
+</dict>
+</plist>
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/entitlements.plist b/examples/apps/screenpipe-app-tauri/src-tauri/entitlements.plist
index 3fbc1df3d..e8e1471d4 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/entitlements.plist
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/entitlements.plist
@@ -14,6 +14,5 @@
<true/>
<key>com.apple.developer.persistent-content-capture</key>
<true/>
-
</dict>
</plist>
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 017a64b61..433e73a32 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -10,7 +10,13 @@
"active": true,
"category": "DeveloperTool",
"copyright": "",
- "targets": "all",
+ "targets": [
+ "nsis",
+ "deb",
+ "rpm",
+ "dmg",
+ "app"
+ ],
"externalBin": [],
"icon": [
"icons/generated/Assets.xcassets/AppIcon.appiconset/32.png",
diff --git a/screenpipe-core/Cargo.toml b/screenpipe-core/Cargo.toml
index ac22c7184..b0b9c7aa5 100644
--- a/screenpipe-core/Cargo.toml
+++ b/screenpipe-core/Cargo.toml
@@ -9,5 +9,5 @@ edition = { workspace = true }
[dependencies]
which = "6.0.1"
-
+log = "0.4.17"
diff --git a/screenpipe-core/src/ffmpeg.rs b/screenpipe-core/src/ffmpeg.rs
index 447662f33..a308237d9 100644
--- a/screenpipe-core/src/ffmpeg.rs
+++ b/screenpipe-core/src/ffmpeg.rs
@@ -1,3 +1,4 @@
+use log::{debug, error};
use std::path::PathBuf;
use which::which;
@@ -14,35 +15,63 @@ const EXECUTABLE_NAME: &str = "ffmpeg.exe";
const CREATE_NO_WINDOW: u32 = 0x08000000;
pub fn find_ffmpeg_path() -> Option<PathBuf> {
+ debug!("Starting search for ffmpeg executable");
+
// Check if `ffmpeg` is in the PATH environment variable using the `which` crate
if let Ok(path) = which(EXECUTABLE_NAME) {
+ debug!("Found ffmpeg in PATH: {:?}", path);
return Some(path);
+ } else {
+ debug!("ffmpeg not found in PATH");
}
// Check in current working directory
let cwd = std::env::current_dir().ok()?;
+ debug!("Current working directory: {:?}", cwd);
let ffmpeg_in_cwd = cwd.join(EXECUTABLE_NAME);
if ffmpeg_in_cwd.is_file() && ffmpeg_in_cwd.exists() {
+ debug!(
+ "Found ffmpeg in current working directory: {:?}",
+ ffmpeg_in_cwd
+ );
return Some(ffmpeg_in_cwd);
+ } else {
+ debug!("ffmpeg not found in current working directory");
}
// Check in the same folder as the executable
if let Ok(exe_path) = std::env::current_exe() {
let exe_folder = exe_path.parent()?;
+ debug!("Executable folder: {:?}", exe_folder);
let ffmpeg_in_exe_folder = exe_folder.join(EXECUTABLE_NAME);
if ffmpeg_in_exe_folder.exists() {
+ debug!(
+ "Found ffmpeg in executable folder: {:?}",
+ ffmpeg_in_exe_folder
+ );
return Some(ffmpeg_in_exe_folder);
+ } else {
+ debug!("ffmpeg not found in executable folder");
}
// For macOS, check in the Resources folder next to the executable
#[cfg(target_os = "macos")]
{
let resources_folder = exe_folder.join("../Resources");
+ debug!("Resources folder: {:?}", resources_folder);
let ffmpeg_in_resources = resources_folder.join(EXECUTABLE_NAME);
if ffmpeg_in_resources.exists() {
+ debug!(
+ "Found ffmpeg in Resources folder: {:?}",
+ ffmpeg_in_resources
+ );
return Some(ffmpeg_in_resources);
+ } else {
+ debug!("ffmpeg not found in Resources folder");
}
}
}
- None
+ error!("ffmpeg not found");
+ // crash
+ panic!("ffmpeg not found");
}
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 1451ade2f..ca57a5116 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -16,6 +16,7 @@ use screenpipe_audio::{
DeviceControl,
};
+use screenpipe_core::find_ffmpeg_path;
use screenpipe_server::{start_continuous_recording, DatabaseManager, ResourceMonitor, Server};
use tokio::sync::mpsc::channel;
@@ -87,6 +88,11 @@ struct Cli {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
+ if find_ffmpeg_path().is_none() {
+ eprintln!("ffmpeg not found. Please install ffmpeg and ensure it is in your PATH.");
+ std::process::exit(1);
+ }
+
// Initialize logging
let cli = Cli::parse();