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: share feedback video upload, ffmpeg warning and noise,
Louis Beaumont2b45d26a6b35
diff --git a/pipes/obsidian/package.json b/pipes/obsidian/package.jsonindex 902136d36..34a892ea5 100644--- a/pipes/obsidian/package.json+++ b/pipes/obsidian/package.json@@ -1,6 +1,6 @@{"name": "obsidian",- "version": "0.1.19",+ "version": "0.1.20","private": true,"scripts": {"dev": "next dev --turbopack",diff --git a/pipes/obsidian/src/components/obsidian-settings.tsx b/pipes/obsidian/src/components/obsidian-settings.tsxindex 61be13726..ba8266a92 100644--- a/pipes/obsidian/src/components/obsidian-settings.tsx+++ b/pipes/obsidian/src/components/obsidian-settings.tsx@@ -551,6 +551,7 @@ export function ObsidianSettings() {}onChange={(value) => {updateSettings({+ ...settings,aiModel: value,});}}diff --git a/pipes/obsidian/src/lib/hooks/use-pipe-settings.tsx b/pipes/obsidian/src/lib/hooks/use-pipe-settings.tsxindex 7102ef58d..c535b844f 100644--- a/pipes/obsidian/src/lib/hooks/use-pipe-settings.tsx+++ b/pipes/obsidian/src/lib/hooks/use-pipe-settings.tsx@@ -77,14 +77,17 @@ export function usePipeSettings() {...obsidianSettings,};- // Update screenpipe settings if provided- await updateScreenpipeAppSettings({+ const appSettings = {...screenpipeAppSettings,customSettings: {...screenpipeAppSettings?.customSettings,- obsidian: mergedObsidianSettings,+ obsidian: obsidianSettings,},- });+ };+ console.log("updating store settings", appSettings);++ // Update screenpipe settings if provided+ await updateScreenpipeAppSettings(appSettings);// Update notion settings in localStoragelocalStorage.setItem(STORAGE_KEY, JSON.stringify(mergedObsidianSettings));diff --git a/screenpipe-app-tauri/components/log-file-button.tsx b/screenpipe-app-tauri/components/log-file-button.tsxindex e885204d5..f41189d2a 100644--- a/screenpipe-app-tauri/components/log-file-button.tsx+++ b/screenpipe-app-tauri/components/log-file-button.tsx@@ -99,7 +99,6 @@ export const LogFileButton = ({}) => {const { toast } = useToast();const { copyToClipboard } = useCopyToClipboard({ timeout: 3000 });- const { settings } = useSettings();const [isOpen, setIsOpen] = useState(false);const [logPath, setLogPath] = useState("");diff --git a/screenpipe-app-tauri/components/share-logs-button.tsx b/screenpipe-app-tauri/components/share-logs-button.tsxindex f928ae253..a71035682 100644--- a/screenpipe-app-tauri/components/share-logs-button.tsx+++ b/screenpipe-app-tauri/components/share-logs-button.tsx@@ -121,7 +121,7 @@ export const ShareLogsButton = ({query: `SELECT * FROM video_chunksORDER BY id DESC- LIMIT 7+ LIMIT 6`,}),});@@ -180,7 +180,7 @@ export const ShareLogsButton = ({setIsSending(true);try {- const BASE_URL = 'https://screenpi.pe'+ const BASE_URL = "https://screenpi.pe";const identifier = settings.user?.id || machineId;const type = settings.user?.id ? "user" : "machine";diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex a89a1c6a0..54d988195 100755--- a/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -5289,7 +5289,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "0.32.9"+version = "0.32.12"dependencies = ["anyhow","async-stream",diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex 1e80024ba..87fa661c7 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -446,37 +446,63 @@ fn get_data_dir(app: &tauri::AppHandle) -> anyhow::Result<PathBuf> {}}+use tokio::time::{sleep, Duration};+#[tauri::command]async fn upload_file_to_s3(file_path: &str, signed_url: &str) -> Result<bool, String> {- // Read file contents+ debug!("Starting upload for file: {}", file_path);++ // Read file contents - do this outside retry loop to avoid multiple readslet file_contents = match tokio::fs::read(file_path).await {- Ok(contents) => contents,- Err(e) => return Err(e.to_string())+ Ok(contents) => {+ debug!("Successfully read file of size: {} bytes", contents.len());+ contents+ },+ Err(e) => {+ error!("Failed to read file: {}", e);+ return Err(e.to_string())+ }};- // Create client and send PUT requestlet client = reqwest::Client::new();- let response = match client- .put(signed_url)- .body(file_contents)- .send()- .await {- Ok(r) => r,- Err(e) => return Err(e.to_string())- };+ let max_retries = 3;+ let mut attempt = 0;+ let mut last_error = String::new();++ while attempt < max_retries {+ attempt += 1;+ debug!("Upload attempt {} of {}", attempt, max_retries);++ match client+ .put(signed_url)+ .body(file_contents.clone())+ .send()+ .await+ {+ Ok(response) => {+ if response.status().is_success() {+ debug!("Successfully uploaded file on attempt {}", attempt);+ return Ok(true);+ }+ last_error = format!("Upload failed with status: {}", response.status());+ error!("{} (attempt {}/{})", last_error, attempt, max_retries);+ },+ Err(e) => {+ last_error = format!("Request failed: {}", e);+ error!("{} (attempt {}/{})", last_error, attempt, max_retries);+ }+ }- if !response.status().is_success() {- return Err(format!(- "Failed to upload file: {}",- response.status()- ));+ if attempt < max_retries {+ let delay = Duration::from_secs(2u64.pow(attempt as u32 - 1)); // Exponential backoff+ debug!("Waiting {}s before retry...", delay.as_secs());+ sleep(delay).await;+ }}- Ok(true)+ Err(format!("Upload failed after {} attempts. Last error: {}", max_retries, last_error))}--// Helper function to parse shortcut stringfn parse_shortcut(shortcut_str: &str) -> Result<Shortcut, String> {let parts: Vec<&str> = shortcut_str.split('+').collect();diff --git a/screenpipe-core/src/devices.rs b/screenpipe-core/src/devices.rsindex c351f7b28..febb06257 100644--- a/screenpipe-core/src/devices.rs+++ b/screenpipe-core/src/devices.rs@@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt, str::FromStr};use anyhow::anyhow;use serde::{Deserialize, Serialize};use tokio_stream::Stream;-use tracing::{debug, info};+use tracing::debug;#[derive(Clone, Debug)]pub enum DeviceType {@@ -192,7 +192,7 @@ impl DeviceManager {!watcher.is_closed()});- info!(+ debug!("received device_state_request: {:?} watches length: {}",req,watchers.len()diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rsindex c2701c3d0..4f68f7fcc 100644--- a/screenpipe-server/src/bin/screenpipe-server.rs+++ b/screenpipe-server/src/bin/screenpipe-server.rs@@ -809,7 +809,7 @@ async fn main() -> anyhow::Result<()> {if cli.disable_audio && change.control.device.is_audio() {continue;}- info!("received device update: {:?}", change);+ debug!("received device update: {:?}", change);if let Err(e) = handle_device_update(&change.control.device,change.control.clone(),diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rsindex a81b9e01c..8d75e540b 100644--- a/screenpipe-server/src/video.rs+++ b/screenpipe-server/src/video.rs@@ -13,7 +13,7 @@ use std::time::Duration;use tokio::io::AsyncBufReadExt;use tokio::io::AsyncWriteExt;use tokio::io::BufReader;-use tokio::process::{Child, ChildStderr, ChildStdin, ChildStdout, Command};+use tokio::process::{Child, ChildStderr, ChildStdin, Command};use tokio::sync::mpsc::channel;use tokio::sync::watch;use tokio::task::JoinHandle;@@ -206,53 +206,45 @@ impl VideoCapture {}pub async fn start_ffmpeg_process(output_file: &str, fps: f64) -> Result<Child, anyhow::Error> {- let fps = if fps > MAX_FPS {- warn!("Overriding FPS from {} to {}", fps, MAX_FPS);- MAX_FPS- } else {- fps- };-- info!("starting FFmpeg process for file: {}", output_file);+ let fps = fps.min(MAX_FPS);++ debug!("starting ffmpeg process for: {}", output_file);let fps_str = fps.to_string();let mut command = Command::new(find_ffmpeg_path().unwrap());- let mut args = vec![++ // Updated FFmpeg arguments for better performance and quality+ let args = vec!["-f","image2pipe","-vcodec",- "mjpeg", // consider using mjpeg and change to encode to jpeg below too+ "mjpeg","-r",&fps_str,"-i","-","-vf",- "pad=width=ceil(iw/2)*2:height=ceil(ih/2)*2",- ];-- args.extend_from_slice(&[- "-vcodec",+ "format=yuv420p,pad=width=ceil(iw/2)*2:height=ceil(ih/2)*2",+ "-c:v","libx265","-tag:v","hvc1","-preset",- "ultrafast",+ "medium", // Changed from ultrafast for better compression"-crf",- "23",- ]);-- args.extend_from_slice(&["-pix_fmt", "yuv420p", output_file]);+ "28", // Slightly higher CRF for smaller file size+ "-x265-params",+ "log-level=error", // Reduce x265 logging noise+ output_file,+ ];command.args(&args).stdin(Stdio::piped())- .stdout(Stdio::piped())+ .stdout(Stdio::null()) // Changed to null since we don't need stdout.stderr(Stdio::piped());- debug!("FFmpeg command: {:?}", command);-+ debug!("ffmpeg command: {:?}", command);let child = command.spawn()?;- debug!("FFmpeg process spawned");-Ok(child)}@@ -264,14 +256,6 @@ pub async fn write_frame_to_ffmpeg(Ok(())}-async fn log_ffmpeg_output(stream: impl AsyncBufReadExt + Unpin, stream_name: &str) {- let reader = BufReader::new(stream);- let mut lines = reader.lines();- while let Ok(Some(line)) = lines.next_line().await {- debug!("FFmpeg {}: {}", stream_name, line);- }-}-async fn save_frames_as_video_with_shutdown(frame_queue: &Arc<ArrayQueue<Arc<CaptureResult>>>,output_path: &str,@@ -311,7 +295,7 @@ async fn save_frames_as_video_with_shutdown(match start_ffmpeg_process(&output_file, fps).await {Ok(mut child) => {let mut stdin = child.stdin.take().expect("Failed to open stdin");- spawn_ffmpeg_loggers(child.stderr.take(), child.stdout.take());+ spawn_ffmpeg_loggers(child.stderr.take());if let Err(e) = write_frame_to_ffmpeg(&mut stdin, &buffer).await {error!("failed to write first frame to ffmpeg: {}", e);@@ -390,12 +374,22 @@ fn create_output_file(output_path: &str, monitor_id: u32) -> String {.to_string()}-fn spawn_ffmpeg_loggers(stderr: Option<ChildStderr>, stdout: Option<ChildStdout>) {+fn spawn_ffmpeg_loggers(stderr: Option<ChildStderr>) {if let Some(stderr) = stderr {- tokio::spawn(log_ffmpeg_output(BufReader::new(stderr), "stderr"));- }- if let Some(stdout) = stdout {- tokio::spawn(log_ffmpeg_output(BufReader::new(stdout), "stdout"));+ tokio::spawn(async move {+ let reader = BufReader::new(stderr);+ let mut lines = reader.lines();+ while let Ok(Some(line)) = lines.next_line().await {+ // Only log important messages+ if line.contains("error") || line.contains("fatal") {+ error!("ffmpeg: {}", line);+ } else if line.contains("warning") {+ warn!("ffmpeg: {}", line);+ } else {+ debug!("ffmpeg: {}", line);+ }+ }+ });}}