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: increase batch transcription limits to match actual MP3 upload sizes
Louis Beaumont45500f8099a7
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsxindex ba42dd9a8..732fe53ad 100644--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx@@ -1614,7 +1614,7 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre<div className="flex items-center justify-between mb-1.5"><span className="text-xs text-muted-foreground flex items-center gap-1.5">Max batch duration- <HelpTooltip text="Maximum duration of audio to batch before transcribing. Longer batches give better context. 0 = auto (recommended). Audio is compressed to MP3 before upload." />+ <HelpTooltip text="Maximum duration of audio to batch before transcribing. Longer batches give better context for full meetings. 0 = auto (Deepgram ~83min, OpenAI ~50min, Whisper ~10min). Audio is compressed to MP3 before upload." /></span><span className="text-xs font-mono text-foreground">{(settings.batchMaxDurationSecs ?? 0) === 0@@ -1628,13 +1628,13 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. ScrehandleSettingsChange({ batchMaxDurationSecs: value ?? 0 } as any, true)}min={0}- max={1800}- step={30}+ max={5400}+ step={60}className="w-full"/><div className="flex justify-between text-[10px] text-muted-foreground mt-0.5"><span>auto</span>- <span>30min</span>+ <span>90min</span></div></div>)}diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex 10b141eae..7fb49aee8 100644--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -141,7 +141,7 @@ export type Settings = SettingsStore & {openaiCompatibleRawAudio?: boolean;/** Filter music-dominant audio before transcription (reduces Spotify/YouTube music noise) */filterMusic?: boolean;- /** Maximum batch transcription duration in seconds (0 = engine default: Deepgram 3600s, Whisper 600s) */+ /** Maximum batch transcription duration in seconds (0 = engine default: Deepgram 5000s, OpenAI 3000s, Whisper 600s) */batchMaxDurationSecs?: number;/** Show periodic notifications suggesting pipe ideas based on user's data (default: true) */pipeSuggestionsEnabled?: boolean;diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rsindex 0f57530ab..b0ee86405 100644--- a/crates/screenpipe-audio/src/audio_manager/manager.rs+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs@@ -453,11 +453,14 @@ impl AudioManager {// (i.e. the 45s output-speech window expires between deliveries).let mut had_deferred_segments = false;- // Max deferral cap: force reconciliation after this duration even if the- // session is still active. Prevents infinite deferral during long calls- // or perpetual output-audio sessions (the meeting detector's 45s window- // can keep the session alive indefinitely).- const MAX_DEFERRAL_SECS: u64 = 600; // 10 minutes+ // Max deferral cap: use the user's batch duration setting (or the+ // engine default). This lets meetings accumulate audio up to the+ // engine's actual capacity before force-transcribing.+ let max_deferral_secs = batch_max_duration_secs.unwrap_or_else(|| {+ super::reconciliation::default_max_batch_duration_secs(+ &audio_transcription_engine,+ )+ });let mut deferral_started: Option<std::time::Instant> = None;while let Ok(audio) = whisper_receiver.recv() {@@ -562,13 +565,12 @@ impl AudioManager {let session_just_ended =!now_in_session && (was_in_session || had_deferred_segments);- // Max deferral cap: force reconciliation if we've been- // deferring longer than MAX_DEFERRAL_SECS, even during an- // active session. Prevents infinite deferral during long- // calls or perpetual output-audio activity.+ // Force reconciliation if we've been deferring longer+ // than the engine's batch limit. Prevents infinite+ // deferral during long calls or perpetual output-audio.let deferral_cap_hit = now_in_session&& deferral_started- .is_some_and(|t| t.elapsed().as_secs() >= MAX_DEFERRAL_SECS);+ .is_some_and(|t| t.elapsed().as_secs() >= max_deferral_secs);if session_just_ended || deferral_cap_hit {// Reconcile: session ended or deferral cap reached@@ -576,7 +578,7 @@ impl AudioManager {deferral_started = None;if deferral_cap_hit {info!(- "batch mode: deferral cap ({MAX_DEFERRAL_SECS}s) reached during active session, force-transcribing"+ "batch mode: deferral cap ({max_deferral_secs}s) reached during active session, force-transcribing");} else {info!(diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rsindex 23694dfb3..31a3fc83a 100644--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs@@ -46,15 +46,16 @@ struct PendingTranscription {}/// Default maximum batch duration in seconds when no user override is set.-/// Cloud transcription (Deepgram via api.screenpi.pe) is capped at 200s to stay-/// well under Cloudflare's 100 MB edge upload limit (~48 kHz stereo f32 WAV).-fn default_max_batch_duration_secs(engine: &AudioTranscriptionEngine) -> u64 {+/// Audio is encoded as MP3 (64 kbps mono 16 kHz) before upload, so durations+/// are bounded by the compressed size, not raw WAV.+///+/// - Deepgram via Cloudflare: 100 MB upload limit ÷ 64 kbps ≈ 3.5 h → cap at 5000 s (~83 min)+/// - OpenAI-compatible: 25 MB limit ÷ 64 kbps ≈ 52 min → cap at 3000 s (~50 min)+/// - Local Whisper / Qwen-ASR: quality degrades past ~10 min → cap at 600 s+pub fn default_max_batch_duration_secs(engine: &AudioTranscriptionEngine) -> u64 {match engine {- // Cloud: 200s ≈ 37 MB WAV (mono 48 kHz f32), safe for Cloudflare edge- AudioTranscriptionEngine::Deepgram => 200,- // OpenAI-compatible has 25 MB limit (~10 min at typical bitrates)- AudioTranscriptionEngine::OpenAICompatible => 200,- // Local Whisper quality degrades past ~10 min+ AudioTranscriptionEngine::Deepgram => 5000,+ AudioTranscriptionEngine::OpenAICompatible => 3000,_ => 600,}}diff --git a/crates/screenpipe-config/src/recording.rs b/crates/screenpipe-config/src/recording.rsindex 8723b4c78..19636aeb1 100644--- a/crates/screenpipe-config/src/recording.rs+++ b/crates/screenpipe-config/src/recording.rs@@ -75,8 +75,8 @@ pub struct RecordingSettings {pub filter_music: bool,/// Maximum batch duration in seconds for batch transcription.- /// None = use engine-aware defaults (Deepgram=3600s, Whisper/OpenAI=600s).- /// Previously stored in SettingsStore.extra["batchMaxDurationSecs"].+ /// None = use engine-aware defaults (Deepgram=5000s, OpenAI=3000s, Whisper=600s).+ /// Also controls the max deferral cap during active meetings.#[serde(rename = "batchMaxDurationSecs", default)]pub batch_max_duration_secs: Option<u64>,