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

fix: windows + tesseract

Louis Beaumontd334eceb594b
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 5a94dfa08..730c641fe 100755
--- a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -127,6 +127,17 @@ async fn main() {
.manage(sidecar_state)
.invoke_handler(tauri::generate_handler![use_cli])
.setup(move |app| {
+ // run this on windows only
+ if cfg!(windows) {
+ let app_dir = app
+ .path_resolver()
+ .app_dir()
+ .expect("Failed to get app dir");
+ let tessdata_path = app_dir.join("tessdata");
+ env::set_var("TESSDATA_PREFIX", tessdata_path);
+ // ! hopefully it passes to CLI too
+ }
+
// let cli = app.cli().matches().expect("Failed to get CLI matches");
// Get the autostart manager
diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rs
index 4a054b095..4aad941e7 100644
--- a/screenpipe-server/src/video.rs
+++ b/screenpipe-server/src/video.rs
@@ -289,6 +289,8 @@ async fn save_frames_as_video(
}
}
+use std::env;
+
async fn start_ffmpeg_process(output_file: &str, fps: f64) -> Result<Child, anyhow::Error> {
// Overriding fps with max fps if over the max and warning user
let fps = if fps > MAX_FPS {
@@ -299,27 +301,36 @@ async fn start_ffmpeg_process(output_file: &str, fps: f64) -> Result<Child, anyh
};
info!("Starting FFmpeg process for file: {}", output_file);
+ let fps_str = fps.to_string();
let mut command = Command::new(find_ffmpeg_path().unwrap());
+ let mut args = vec![
+ "-f",
+ "image2pipe",
+ "-vcodec",
+ "png",
+ "-r",
+ &fps_str,
+ "-i",
+ "-",
+ "-vcodec",
+ "libx264",
+ "-preset",
+ "ultrafast",
+ "-pix_fmt",
+ "yuv420p",
+ ];
+
+ // Only add CRF option if not on Windows
+ // ! HACK this is temporary due to our windows prebuild system not having a complete enough ffmpeg (lot of ci infra to tweak)
+ // ! basically sacrificing some tiny video encoding quality on windows
+ if env::consts::OS != "windows" {
+ args.extend_from_slice(&["-crf", "25"]);
+ }
+
+ args.push(output_file);
+
command
- .args(&[
- "-f",
- "image2pipe",
- "-vcodec",
- "png",
- "-r",
- &fps.to_string(),
- "-i",
- "-",
- "-vcodec",
- "libx264",
- "-preset",
- "ultrafast",
- "-pix_fmt",
- "yuv420p",
- "-crf",
- "25",
- output_file,
- ])
+ .args(&args)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
@@ -330,4 +341,4 @@ async fn start_ffmpeg_process(output_file: &str, fps: f64) -> Result<Child, anyh
debug!("FFmpeg process spawned");
Ok(child)
-}
\ No newline at end of file
+}