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: hardcode batch duration per engine, only expose slider for custom endpoints
Louis Beaumont853de89815a3
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsxindex 88b192036..f5bc7b80e 100644--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx@@ -1610,12 +1610,13 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre}/></div>- {["smart", "batch"].includes(settings.transcriptionMode ?? "realtime") && (+ {["smart", "batch"].includes(settings.transcriptionMode ?? "realtime") &&+ settings.audioTranscriptionEngine === "openai-compatible" && (<div className="mt-2.5 pt-2.5 border-t border-border/50"><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 for full meetings. 0 = auto (Deepgram ~83min, OpenAI ~50min, Whisper ~10min). Audio is compressed to MP3 before upload." />+ <HelpTooltip text="Maximum audio to batch before transcribing. Depends on your endpoint's file size limit. 0 = auto (~50min). Audio is compressed to MP3 before upload." /></span><span className="text-xs font-mono text-foreground">{(settings.batchMaxDurationSecs ?? 0) === 0diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rsindex b0ee86405..10a961030 100644--- a/crates/screenpipe-audio/src/audio_manager/manager.rs+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs@@ -453,14 +453,20 @@ impl AudioManager {// (i.e. the 45s output-speech window expires between deliveries).let mut had_deferred_segments = false;- // 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(+ // Max deferral cap: hardcoded per engine (user override only for OpenAI-compatible).+ // This lets meetings accumulate audio up to the engine's optimal capacity.+ let max_deferral_secs = match *audio_transcription_engine {+ AudioTranscriptionEngine::OpenAICompatible => {+ batch_max_duration_secs.unwrap_or_else(|| {+ super::reconciliation::default_max_batch_duration_secs(+ &audio_transcription_engine,+ )+ })+ }+ _ => 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() {diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rsindex 31a3fc83a..8cd07fdc7 100644--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs@@ -45,17 +45,20 @@ struct PendingTranscription {file_path: String,}-/// Default maximum batch duration in seconds when no user override is set.+/// Maximum batch duration in seconds per engine./// 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+/// - OpenAI-compatible: user-configurable (unknown engine limits), default 3000 s (~50 min)+/// - Parakeet: no sliding window, handles long-form well → cap at 3600 s (60 min)+/// - Local Whisper: processes in 30s windows with context carryover → cap at 600 s (10 min)+/// - Qwen3-ASR: similar to Whisper architecture → cap at 600 s (10 min)pub fn default_max_batch_duration_secs(engine: &AudioTranscriptionEngine) -> u64 {match engine {AudioTranscriptionEngine::Deepgram => 5000,AudioTranscriptionEngine::OpenAICompatible => 3000,+ AudioTranscriptionEngine::Parakeet => 3600,_ => 600,}}@@ -137,8 +140,14 @@ pub async fn reconcile_untranscribed();// Group consecutive chunks by device for batched transcription.- let max_duration =- batch_max_duration_secs.unwrap_or_else(|| default_max_batch_duration_secs(&audio_engine));+ // User override only applies to OpenAI-compatible (unknown engine limits).+ // All other engines use hardcoded optimal defaults.+ let max_duration = match *audio_engine {+ AudioTranscriptionEngine::OpenAICompatible => {+ batch_max_duration_secs.unwrap_or_else(|| default_max_batch_duration_secs(&audio_engine))+ }+ _ => default_max_batch_duration_secs(&audio_engine),+ };let batches = group_chunks_by_device(&chunks, max_duration);debug!("reconciliation: grouped into {} batches (max {}s each)",